comparison roundup/cgi/templating.py @ 1453:b72f422d1e5e

better handling of format param
author Richard Jones <richard@users.sourceforge.net>
date Wed, 19 Feb 2003 23:32:50 +0000
parents d0c8bc8534ba
children a11e27d80737
comparison
equal deleted inserted replaced
1451:d0c8bc8534ba 1453:b72f422d1e5e
986 interval = date.Date('.') - self._value 986 interval = date.Date('.') - self._value
987 if pretty: 987 if pretty:
988 return interval.pretty() 988 return interval.pretty()
989 return str(interval) 989 return str(interval)
990 990
991 def pretty(self, format='%d %B %Y'): 991 _marker = []
992 def pretty(self, format=_marker):
992 ''' Render the date in a pretty format (eg. month names, spaces). 993 ''' Render the date in a pretty format (eg. month names, spaces).
993 994
994 The format string is a standard python strftime format string. 995 The format string is a standard python strftime format string.
995 Note that if the day is zero, and appears at the start of the 996 Note that if the day is zero, and appears at the start of the
996 string, then it'll be stripped from the output. This is handy 997 string, then it'll be stripped from the output. This is handy
997 for the situatin when a date only specifies a month and a year. 998 for the situatin when a date only specifies a month and a year.
998 ''' 999 '''
999 return self._value.pretty() 1000 if format is not self._marker:
1001 return self._value.pretty(format)
1002 else:
1003 return self._value.pretty()
1000 1004
1001 def local(self, offset): 1005 def local(self, offset):
1002 ''' Return the date/time as a local (timezone offset) date/time. 1006 ''' Return the date/time as a local (timezone offset) date/time.
1003 ''' 1007 '''
1004 return DateHTMLProperty(self._client, self._nodeid, self._prop, 1008 return DateHTMLProperty(self._client, self._nodeid, self._prop,

Roundup Issue Tracker: http://roundup-tracker.org/