problem with a css cycler

From: Adriano Varoli Piazza (moranar_at_daleclick.com)
Date: 03/20/04


Date: Sat, 20 Mar 2004 19:29:12 -0300
To: python-list@python.org

Hello all
I am trying to build a css cycler in python, to change the css used in a
website every X number of days, using a list of files: the first X days
it'd show file1, then file2, then file3, then back to the first one.

The code I came up with is the following:

css = ["file1", "file2", "file3"]
i = 0
max_i = 3
today = int(raw_input("today's date: "))
stored_day = 1

if 3 <= (today - stored_day):
        stored_day = today
        i += 1
        if i > max_i:
                i = 0
print "Variable today is %s .\n" % today
print "Variable stored_day is %s .\n" % stored_day
print "Variable i is %s .\n" % i
print "Variable css is now %s \n" % css[i]
----------
The problem with this is that it works only for the first X days. How do
I make it "keep state" for the next iterations?

Thanks

-- 
Adriano Varoli Piazza
The Inside Out: http://moranar.com.ar
ICQ: 4410132
MSN: adrianomd@hotmail.com
Claves gpg / pgp en hkp://subkeys.pgp.net