dreikanter / public-static

Programmer's approach to web content management
https://github.com/dreikanter/public-static
BSD 3-Clause "New" or "Revised" License
11 stars 1 forks source link

Time part in the date/time page fields should be optional #3

Closed dreikanter closed 11 years ago

dreikanter commented 11 years ago

Got the following error while trying to parse a page with ctime w/o time (error logging also should be fixed to be more informative):

2013/07/07 04:54:46 DEBUG: Traceback (most recent call last):
  File "C:\python\3.3\lib\site-packages\publicstatic-0.5.0-py3.3.egg\publicstatic\tools.py", line 255, in page_ctime
    result = parse_time(match.group(2))
  File "C:\python\3.3\lib\site-packages\publicstatic-0.5.0-py3.3.egg\publicstatic\tools.py", line 264, in parse_time
    return time.mktime(time.strptime(value.strip(), constants.TIME_FMT))
  File "C:\python\3.3\lib\_strptime.py", line 494, in _strptime_time
    tt = _strptime(data_string, format)[0]
  File "C:\python\3.3\lib\_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data '2010/01/20' does not match format '%Y/%m/%d %H:%M:%S'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\python\3.3\lib\site-packages\publicstatic-0.5.0-py3.3.egg\publicstatic\publicstatic.py", line 524, in main
    p.dispatch()
  File "C:\python\3.3\lib\site-packages\argh-0.23.1-py3.3.egg\argh\helpers.py", line 47, in dispatch
    return dispatch(self, *args, **kwargs)
  File "C:\python\3.3\lib\site-packages\argh-0.23.1-py3.3.egg\argh\dispatching.py", line 121, in dispatch
    for line in lines:
  File "C:\python\3.3\lib\site-packages\argh-0.23.1-py3.3.egg\argh\dispatching.py", line 197, in _execute_command
    for line in result:
  File "C:\python\3.3\lib\site-packages\argh-0.23.1-py3.3.egg\argh\dispatching.py", line 153, in _call
    result = args.function(args)
  File "C:\python\3.3\lib\site-packages\publicstatic-0.5.0-py3.3.egg\publicstatic\publicstatic.py", line 392, in build
    process_blog(conf.get('posts_path'))
  File "C:\python\3.3\lib\site-packages\publicstatic-0.5.0-py3.3.egg\publicstatic\publicstatic.py", line 98, in process_blog
    posts = tools.posts(path)
  File "C:\python\3.3\lib\site-packages\publicstatic-0.5.0-py3.3.egg\publicstatic\tools.py", line 239, in posts
    walk(path, lambda root, rel:
  File "C:\python\3.3\lib\site-packages\publicstatic-0.5.0-py3.3.egg\publicstatic\tools.py", line 233, in walk
    operation(path, relpath)
  File "C:\python\3.3\lib\site-packages\publicstatic-0.5.0-py3.3.egg\publicstatic\tools.py", line 240, in <lambda>
    posts.append((rel, page_ctime(os.path.join(root, rel)))))
  File "C:\python\3.3\lib\site-packages\publicstatic-0.5.0-py3.3.egg\publicstatic\tools.py", line 258, in page_ctime
    raise Exception('error reading page ctime: ' + str(e)) from ex
NameError: global name 'e' is not defined