posativ / acrylamid

(unmaintained) static blog generator in python with incremental rendering ⛺
http://posativ.org/acrylamid/
Other
277 stars 40 forks source link

OverflowError: mktime argument out of range #133

Closed maphew closed 11 years ago

maphew commented 11 years ago

I'm converting some old webpages to acrylamid, as I don't know what date they were written I entered time: 01.01.1900 in the metadata. Not altogether unexpectedly acrylamid doesn't know what to do with it. I want to use a date that's obviously incorrect until I get around to unearthing the real publication dates. What are my options?

Thanks.

B:\www\acr>acrylamid -C compile
Traceback (most recent call last):
  File "B:\o4w\apps\Python27\Scripts\acrylamid-script.py", line 9, in <module>
    load_entry_point('acrylamid==0.6.0', 'console_scripts', 'acrylamid')()
  File "B:\o4w\apps\Python27\lib\site-packages\acrylamid\__init__.py", line 173,
 in Acryl
    commands.compile(conf, env)
  File "B:\o4w\apps\Python27\lib\site-packages\acrylamid\commands.py", line 219,
 in compile
    for buf, path in v.generate(conf, env, data):
  File "B:\o4w\apps\Python27\lib\site-packages\acrylamid\views\feeds.py", line 6
8, in generate
    updated=updated, entrylist=entrylist))
  File "B:\o4w\apps\Python27\lib\site-packages\acrylamid\templates\jinja2.py", l
ine 121, in render
    self.template.stream(**kw).dump(buf)
  File "B:\o4w\apps\Python27\lib\site-packages\jinja2\environment.py", line 1072
, in dump
    fp.writelines(iterable)
  File "B:\o4w\apps\Python27\lib\site-packages\jinja2\environment.py", line 1116
, in next
    return self._next()
  File "B:\o4w\apps\Python27\lib\site-packages\jinja2\environment.py", line 918,
 in generate
    yield self.environment.handle_exception(exc_info, True)
  File "theme/rss.xml", line 24, in top-level template code
    {{ render_item(env, conf, entry) }}
  File "theme/rss.xml", line 6, in template
    <pubDate>{{ entry.date | rfc822 }}</pubDate>
  File "B:\o4w\apps\Python27\lib\site-packages\acrylamid\views\feeds.py", line 1
10, in <lambda>
    'rfc822', lambda x: unicode(format_date_time(mktime(x.timetuple()))))
OverflowError: mktime argument out of range
posativ commented 11 years ago

Better use time: 1.1.1970 where the UNIX time epoch begins ;-)

posativ commented 11 years ago

Fixed, but better use something above 1.1.1900 (such as february) as it defaults to 1.1.1900 00:00:00 and depending on your timezone this may actually be before 1900 and is not supported by python's datetime API.

maphew commented 11 years ago

great, thank you very much!