diff roundup/cgi/templating.py @ 1272:cae50587fb96

expose the Date.pretty method to templating
author Richard Jones <richard@users.sourceforge.net>
date Sat, 12 Oct 2002 23:10:36 +0000
parents c3424abf7f77
children 899c6ced2abe
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Sat Oct 12 23:10:08 2002 +0000
+++ b/roundup/cgi/templating.py	Sat Oct 12 23:10:36 2002 +0000
@@ -879,6 +879,16 @@
             return interval.pretty()
         return str(interval)
 
+    def pretty(self, format='%d %B %Y'):
+        ''' Render the date in a pretty format (eg. month names, spaces).
+
+            The format string is a standard python strftime format string.
+            Note that if the day is zero, and appears at the start of the
+            string, then it'll be stripped from the output. This is handy
+            for the situatin when a date only specifies a month and a year.
+        '''
+        return self._value.pretty()
+
 class IntervalHTMLProperty(HTMLProperty):
     def plain(self):
         ''' Render a "plain" representation of the property

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