Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/templateutil.py @ 37229:9bcf096a2da2
templatefilters: declare input type as date where appropriate
I'm not sure if the templateutil.date type can be a thing. Currently it's
just a constant.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 18 Mar 2018 16:12:44 +0900 |
parents | 920589f52be9 |
children | dc4bb1422f2b |
comparison
equal
deleted
inserted
replaced
37228:920589f52be9 | 37229:9bcf096a2da2 |
---|---|
22 | 22 |
23 class ResourceUnavailable(error.Abort): | 23 class ResourceUnavailable(error.Abort): |
24 pass | 24 pass |
25 | 25 |
26 class TemplateNotFound(error.Abort): | 26 class TemplateNotFound(error.Abort): |
27 pass | |
28 | |
29 # stub for representing a date type; may be a real date type that can | |
30 # provide a readable string value | |
31 class date(object): | |
27 pass | 32 pass |
28 | 33 |
29 class hybrid(object): | 34 class hybrid(object): |
30 """Wrapper for list or dict to support legacy template | 35 """Wrapper for list or dict to support legacy template |
31 | 36 |
359 return stringify(thing) | 364 return stringify(thing) |
360 | 365 |
361 _unwrapfuncbytype = { | 366 _unwrapfuncbytype = { |
362 None: _unwrapvalue, | 367 None: _unwrapvalue, |
363 bytes: stringify, | 368 bytes: stringify, |
369 date: unwrapdate, | |
364 int: unwrapinteger, | 370 int: unwrapinteger, |
365 } | 371 } |
366 | 372 |
367 def unwrapastype(thing, typ): | 373 def unwrapastype(thing, typ): |
368 """Move the inner value object out of the wrapper and coerce its type""" | 374 """Move the inner value object out of the wrapper and coerce its type""" |