##// END OF EJS Templates
formatter: add function to convert date tuple to appropriate format
Yuya Nishihara -
r29678:2f3f18ad default
parent child Browse files
Show More
@@ -47,6 +47,10 b' class baseformatter(object):'
47 self._showitem()
47 self._showitem()
48 self._item = {}
48 self._item = {}
49 @staticmethod
49 @staticmethod
50 def formatdate(date, fmt='%a %b %d %H:%M:%S %Y %1%2'):
51 '''convert date tuple to appropriate format'''
52 return date
53 @staticmethod
50 def formatlist(data, name, fmt='%s', sep=' '):
54 def formatlist(data, name, fmt='%s', sep=' '):
51 '''convert iterable to appropriate list format'''
55 '''convert iterable to appropriate list format'''
52 return list(data)
56 return list(data)
@@ -84,6 +88,10 b' class plainformatter(baseformatter):'
84 def startitem(self):
88 def startitem(self):
85 pass
89 pass
86 @staticmethod
90 @staticmethod
91 def formatdate(date, fmt='%a %b %d %H:%M:%S %Y %1%2'):
92 '''stringify date tuple in the given format'''
93 return util.datestr(date, fmt)
94 @staticmethod
87 def formatlist(data, name, fmt='%s', sep=' '):
95 def formatlist(data, name, fmt='%s', sep=' '):
88 '''stringify iterable separated by sep'''
96 '''stringify iterable separated by sep'''
89 return sep.join(fmt % e for e in data)
97 return sep.join(fmt % e for e in data)
General Comments 0
You need to be logged in to leave comments. Login now