new 'o' feature for date format strings.

svn: r16950
This commit is contained in:
Craig J. Anderson 2011-03-27 21:12:13 +00:00
parent 0204ee48e4
commit 92cf3a2901

View File

@ -232,6 +232,7 @@ class DateFormat(GenericFormat):
tmp = "000" + year tmp = "000" + year
return tmp[-4:] return tmp[-4:]
def month(char_found = "m"): def month(char_found = "m"):
""" The month part only """ """ The month part only """
month = unicode(date.get_month()) month = unicode(date.get_month())
@ -267,9 +268,16 @@ class DateFormat(GenericFormat):
return tmp[-2:] return tmp[-2:]
code = "ymdM" def modifier():
upper = "" #ui_mods taken from date.py def lookup_modifier(self, modifier):
function = [year, month, day, month_up] ui_mods = ["", _("before"), _("after"), _("about"),
"", "", ""]
return ui_mods[date.get_modifier()].capitalize()
code = "ymdMo"
upper = "O"
function = [year, month, day, month_up, modifier]
return self.generic_format(date, code, upper, function) return self.generic_format(date, code, upper, function)
@ -1447,4 +1455,3 @@ if __name__ == '__main__':
34, 35, 38, 39, 38, 33, 32, 33, 36, 37, 36, 40, 41, 40, 44, 33, 32, 33, 34, 35, 38, 39, 38, 33, 32, 33, 36, 37, 36, 40, 41, 40, 44, 33, 32, 33,
36, 37, 36, 40, 41, 40, 44, 38, 39, 38, 42, 46] else "!! bad !!" 36, 37, 36, 40, 41, 40, 44, 38, 39, 38, 42, 46] else "!! bad !!"