comparison piecrust/templating/jinjaengine.py @ 537:7df0a959791c

templating: Make more date functions accept 'now' as an input.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 29 Jul 2015 23:47:02 -0700
parents 63ae5eae90ca
children cbd5cdec0695
comparison
equal deleted inserted replaced
536:119ac8018964 537:7df0a959791c
309 def title_case(value): 309 def title_case(value):
310 return value.title() 310 return value.title()
311 311
312 312
313 def get_xml_date(value): 313 def get_xml_date(value):
314 if value == 'now':
315 value = time.time()
314 return strict_rfc3339.timestamp_to_rfc3339_localoffset(int(value)) 316 return strict_rfc3339.timestamp_to_rfc3339_localoffset(int(value))
315 317
316 318
317 def get_email_date(value, localtime=False): 319 def get_email_date(value, localtime=False):
320 if value == 'now':
321 value = time.time()
318 return email.utils.formatdate(value, localtime=localtime) 322 return email.utils.formatdate(value, localtime=localtime)
319 323
320 324
321 def get_now_date(): 325 def get_now_date():
322 return time.time() 326 return time.time()