##// END OF EJS Templates
templatefilters: avoid traceback caused by bogus date input (issue3344)...
Christian Ebert -
r17755:bededd3f default
parent child Browse files
Show More
@@ -117,7 +117,7 b' colortable = {'
117 def utcdate(text):
117 def utcdate(text):
118 ''':utcdate: Date. Returns a UTC-date in this format: "2009/08/18 11:00:13".
118 ''':utcdate: Date. Returns a UTC-date in this format: "2009/08/18 11:00:13".
119 '''
119 '''
120 return util.datestr((text[0], 0), '%Y/%m/%d %H:%M:%S')
120 return util.datestr((util.parsedate(text)[0], 0), '%Y/%m/%d %H:%M:%S')
121 # date like in svn's $Date
121 # date like in svn's $Date
122 def svnisodate(text):
122 def svnisodate(text):
123 ''':svnisodate: Date. Returns a date in this format: "2009-08-18 13:00:13
123 ''':svnisodate: Date. Returns a date in this format: "2009-08-18 13:00:13
@@ -129,7 +129,7 b' def svnutcdate(text):'
129 ''':svnutcdate: Date. Returns a UTC-date in this format: "2009-08-18
129 ''':svnutcdate: Date. Returns a UTC-date in this format: "2009-08-18
130 11:00:13Z".
130 11:00:13Z".
131 '''
131 '''
132 return util.datestr((text[0], 0), '%Y-%m-%d %H:%M:%SZ')
132 return util.datestr((util.parsedate(text)[0], 0), '%Y-%m-%d %H:%M:%SZ')
133
133
134 templatefilters.filters.update({'utcdate': utcdate,
134 templatefilters.filters.update({'utcdate': utcdate,
135 'svnisodate': svnisodate,
135 'svnisodate': svnisodate,
@@ -221,7 +221,7 b' def jsonescape(s):'
221
221
222 def localdate(text):
222 def localdate(text):
223 """:localdate: Date. Converts a date to local date."""
223 """:localdate: Date. Converts a date to local date."""
224 return (text[0], util.makedate()[1])
224 return (util.parsedate(text)[0], util.makedate()[1])
225
225
226 def nonempty(str):
226 def nonempty(str):
227 """:nonempty: Any text. Returns '(none)' if the string is empty."""
227 """:nonempty: Any text. Returns '(none)' if the string is empty."""
General Comments 0
You need to be logged in to leave comments. Login now