Re: pyarchive.py breaks on Python 2.1

Jesús Roncero Franco <jesus-/[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
On Tuesday 20 April 2004 21:31, Wilhelm Fitzpatrick wrote:
> pyarchive.py appears to have a dependency on a post Python 2.1 feature:
>
>    File "/home/lagatita/blog/plugins/pyarchives.py", line 59, in
> genLinearArchive
>      timedict = dict([(x, time.strftime('%' + x, timetuple))
> NameError: global name 'dict' is not defined

yes, it uses python 2.2 I believe. This is what i did:

lista = []
for x in list('bmYy'):
    lista.append( (x, time.strftime('%' + x, timetuple)) )
timedict = {}
for key,value in lista:
    timedict[key] = value
#timedict = dict([(x, time.strftime('%' + x, timetuple))
#                for x in list('bmYy')])
fulldict.update(timedict)
#if (timedict['Y'] + timedict['m']) not in archives:
if (timedict['Y'] + timedict['m']) not in archives.keys():
    archives[timedict['Y'] + timedict['m']] = (template % fulldict)


I am no expert in python, but I believe it works
-- 
 jabber: golan [@] bulmalug.net 
 Out: 14.25 ºC --  In: 22.62 ºC


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.