mirror of
https://github.com/vale981/ablog
synced 2025-03-05 17:21:38 -05:00
Improved error message on date parsing
This commit is contained in:
parent
493fdf1a8c
commit
697e599ba8
1 changed files with 3 additions and 4 deletions
|
@ -92,7 +92,7 @@ class UpdateDirective(Directive):
|
|||
|
||||
has_content = True
|
||||
required_arguments = 1
|
||||
optional_arguments = 0#1
|
||||
optional_arguments = 0
|
||||
final_argument_whitespace = True
|
||||
option_spec = {}
|
||||
|
||||
|
@ -182,10 +182,9 @@ def _get_update_dates(section, docname, post_date_format):
|
|||
try:
|
||||
update = datetime.strptime(update_node['date'], post_date_format)
|
||||
except ValueError:
|
||||
raise ValueError('invalid post update date in: ' + docname)
|
||||
raise ValueError('invalid post update date (%s) in: %s Expected format: %s' % (update_node['date'], docname, post_date_format))
|
||||
|
||||
substitute = nodes.title(u'',
|
||||
update_node[0][0].astext() + u' ' + update.strftime(post_date_format))
|
||||
substitute = nodes.title(u'', update_node[0][0].astext() + u' ' + update.strftime(post_date_format))
|
||||
update_node[0].replace_self(substitute)
|
||||
# for now, let updates look like note
|
||||
update_node['classes'] = ['note', 'update']
|
||||
|
|
Loading…
Add table
Reference in a new issue