From 92cf3a2901e3efa58816838e029b3d76ba813ae0 Mon Sep 17 00:00:00 2001 From: "Craig J. Anderson" Date: Sun, 27 Mar 2011 21:12:13 +0000 Subject: [PATCH] new 'o' feature for date format strings. svn: r16950 --- src/plugins/lib/libsubstkeyword.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/plugins/lib/libsubstkeyword.py b/src/plugins/lib/libsubstkeyword.py index 26c5dedc9..2610e55bf 100644 --- a/src/plugins/lib/libsubstkeyword.py +++ b/src/plugins/lib/libsubstkeyword.py @@ -231,7 +231,8 @@ class DateFormat(GenericFormat): else: #count == 4 #found 'yyyy' tmp = "000" + year return tmp[-4:] - + + def month(char_found = "m"): """ The month part only """ month = unicode(date.get_month()) @@ -265,11 +266,18 @@ class DateFormat(GenericFormat): else: #found 'dd' tmp = "0" + day return tmp[-2:] + + + def modifier(): + #ui_mods taken from date.py def lookup_modifier(self, modifier): + ui_mods = ["", _("before"), _("after"), _("about"), + "", "", ""] + return ui_mods[date.get_modifier()].capitalize() + - - code = "ymdM" - upper = "" - function = [year, month, day, month_up] + code = "ymdMo" + upper = "O" + function = [year, month, day, month_up, modifier] return self.generic_format(date, code, upper, function) @@ -1446,5 +1454,4 @@ if __name__ == '__main__': 32, 33, 32, 27, 26, 27, 30, 31, 30, 34, 35, 34, 38, 27, 31, 30, 31, 35, 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 !!" - - \ No newline at end of file +