Show More
@@ -52,18 +52,16 b' def date(context, mapping, args):' | |||
|
52 | 52 | # i18n: "date" is a keyword |
|
53 | 53 | raise error.ParseError(_("date expects one or two arguments")) |
|
54 | 54 | |
|
55 |
date = eval |
|
|
55 | date = evaldate(context, mapping, args[0], | |
|
56 | # i18n: "date" is a keyword | |
|
57 | _("date expects a date information")) | |
|
56 | 58 | fmt = None |
|
57 | 59 | if len(args) == 2: |
|
58 | 60 | fmt = evalstring(context, mapping, args[1]) |
|
59 | try: | |
|
60 | 61 |
|
|
61 | 62 |
|
|
62 | 63 |
|
|
63 | 64 |
|
|
64 | except (TypeError, ValueError): | |
|
65 | # i18n: "date" is a keyword | |
|
66 | raise error.ParseError(_("date expects a date information")) | |
|
67 | 65 | |
|
68 | 66 | @templatefunc('dict([[key=]value...])', argspec='*args **kwargs') |
|
69 | 67 | def dict_(context, mapping, args): |
@@ -330,6 +330,10 b' def unwrapdate(thing, err=None):' | |||
|
330 | 330 | return dateutil.parsedate(thing) |
|
331 | 331 | except AttributeError: |
|
332 | 332 | raise error.ParseError(err or _('not a date tuple nor a string')) |
|
333 | except error.ParseError: | |
|
334 | if not err: | |
|
335 | raise | |
|
336 | raise error.ParseError(err) | |
|
333 | 337 | |
|
334 | 338 | def evalinteger(context, mapping, arg, err=None): |
|
335 | 339 | return unwrapinteger(evalrawexp(context, mapping, arg), err) |
General Comments 0
You need to be logged in to leave comments.
Login now