comparison MoinMoin/action/SyncPages.py @ 4410:b1116a99d62b

merged moin/1.8
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 02 Nov 2008 02:15:55 +0100
parents d9de4fa12f23 1c373ce7f3a4
children e78462e0c7f1
comparison
equal deleted inserted replaced
4388:5a43d52e2110 4410:b1116a99d62b
44 self.pagename = pagename 44 self.pagename = pagename
45 self.page = PageEditor(request, pagename) 45 self.page = PageEditor(request, pagename)
46 self.status = [] 46 self.status = []
47 self.rollback = set() 47 self.rollback = set()
48 48
49 def log_status(self, level, message="", substitutions=(), raw_suffix=""): 49 def log_status(self, level, message=u"", substitutions=(), raw_suffix=u""):
50 """ Appends the message with a given importance level to the internal log. """ 50 """ Appends the message with a given importance level to the internal log. """
51 if isinstance(message, str):
52 message = message.decode("utf-8")
53 if isinstance(raw_suffix, str):
54 raw_suffix = raw_suffix.decode("utf-8")
51 self.status.append((level, message, substitutions, raw_suffix)) 55 self.status.append((level, message, substitutions, raw_suffix))
52 56
53 def register_rollback(self, func): 57 def register_rollback(self, func):
54 self.rollback.add(func) 58 self.rollback.add(func)
55 59
72 """ Transforms self.status into a user readable table. """ 76 """ Transforms self.status into a user readable table. """
73 table_line = u"|| %(smiley)s || %(message)s%(raw_suffix)s ||" 77 table_line = u"|| %(smiley)s || %(message)s%(raw_suffix)s ||"
74 table = [] 78 table = []
75 79
76 for line in self.status: 80 for line in self.status:
77 if line[1]: 81 level, message, substitutions, raw_suffix = line
78 if line[2]: 82 if message:
79 macro_args = [line[1]] + list(line[2]) 83 if substitutions:
84 macro_args = [message] + list(substitutions)
80 message = u"<<GetText2(|%s)>>" % (packLine(macro_args), ) 85 message = u"<<GetText2(|%s)>>" % (packLine(macro_args), )
81 else: 86 else:
82 message = u"<<GetText(%s)>>" % (line[1], ) 87 message = u"<<GetText(%s)>>" % (message, )
83 else: 88 else:
84 message = u"" 89 message = u""
85 table.append(table_line % {"smiley": line[0][1], 90 table.append(table_line % {"smiley": level[1],
86 "message": message, 91 "message": message,
87 "raw_suffix": line[3].replace("\n", "<<BR>>")}) 92 "raw_suffix": raw_suffix.replace("\n", "<<BR>>")})
88 93
89 return "\n".join(table) 94 return "\n".join(table)
90 95
91 def parse_page(self): 96 def parse_page(self):
92 """ Parses the parameter page and returns the read arguments. """ 97 """ Parses the parameter page and returns the read arguments. """