comparison MoinMoin/action/SyncPages.py @ 3122:a1322262398a

refactored _() getText calls to match new api
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 27 Feb 2008 00:23:46 +0100
parents ba14d391c2ba
children 898a544b8f74
comparison
equal deleted inserted replaced
3121:ca1c60a5285c 3122:a1322262398a
135 135
136 return params 136 return params
137 137
138 def show_password_form(self): 138 def show_password_form(self):
139 _ = self.request.getText 139 _ = self.request.getText
140 d = {"message": _(r"Please enter your password of your account at the remote wiki below. <<BR>> /!\ You should trust both wikis because the password could be read by the particular administrators."), 140 d = {"message": _(r"Please enter your password of your account at the remote wiki below. <<BR>> /!\ You should trust both wikis because the password could be read by the particular administrators.", wiki=True),
141 "passwordlabel": _("Password"), 141 "passwordlabel": _("Password"),
142 "submit": _("Login"), 142 "submit": _("Login"),
143 "cancel": _("Cancel"), 143 "cancel": _("Cancel"),
144 } 144 }
145 html_form = """ 145 html_form = """
178 178
179 if params["direction"] == UP: 179 if params["direction"] == UP:
180 raise ActionStatus(_("The only supported directions are BOTH and DOWN."), "error") 180 raise ActionStatus(_("The only supported directions are BOTH and DOWN."), "error")
181 181
182 if not self.request.cfg.interwikiname: 182 if not self.request.cfg.interwikiname:
183 raise ActionStatus(_("Please set an interwikiname in your wikiconfig (see HelpOnConfiguration) to be able to use this action."), "error") 183 raise ActionStatus(_("Please set an interwikiname in your wikiconfig (see HelpOnConfiguration) to be able to use this action.", wiki=True), "error")
184 184
185 if not params["remoteWiki"]: 185 if not params["remoteWiki"]:
186 raise ActionStatus(_("Incorrect parameters. Please supply at least the ''remoteWiki'' parameter. Refer to HelpOnSynchronisation for help."), "error") 186 raise ActionStatus(_("Incorrect parameters. Please supply at least the ''remoteWiki'' parameter. Refer to HelpOnSynchronisation for help.", wiki=True), "error")
187 187
188 local = MoinLocalWiki(self.request, params["localPrefix"], params["pageList"]) 188 local = MoinLocalWiki(self.request, params["localPrefix"], params["pageList"])
189 try: 189 try:
190 remote = MoinRemoteWiki(self.request, params["remoteWiki"], params["remotePrefix"], params["pageList"], params["user"], params["password"], verbose=debug) 190 remote = MoinRemoteWiki(self.request, params["remoteWiki"], params["remotePrefix"], params["pageList"], params["user"], params["password"], verbose=debug)
191 except (UnsupportedWikiException, NotAllowedException), (msg, ): 191 except (UnsupportedWikiException, NotAllowedException), (msg, ):
192 raise ActionStatus(msg) 192 raise ActionStatus(msg)
193 193
194 if not remote.valid: 194 if not remote.valid:
195 raise ActionStatus(_("The ''remoteWiki'' is unknown."), "error") 195 raise ActionStatus(_("The ''remoteWiki'' is unknown.", wiki=True), "error")
196 # if only the username is supplied, we ask for the password 196 # if only the username is supplied, we ask for the password
197 if params["user"] and not params["password"]: 197 if params["user"] and not params["password"]:
198 return self.show_password_form() 198 return self.show_password_form()
199 except ActionStatus, e: 199 except ActionStatus, e:
200 self.request.theme.add_msg(u'<p class="error">%s</p>\n' % (e.args[0], ), e.args[1]) 200 self.request.theme.add_msg(u'<p class="error">%s</p>\n' % (e.args[0], ), e.args[1])
203 try: 203 try:
204 self.sync(params, local, remote) 204 self.sync(params, local, remote)
205 except Exception, e: 205 except Exception, e:
206 temp_file = StringIO.StringIO() 206 temp_file = StringIO.StringIO()
207 traceback.print_exc(file=temp_file) 207 traceback.print_exc(file=temp_file)
208 self.log_status(self.ERROR, _("A severe error occured:"), raw_suffix=temp_file.getvalue()) 208 self.log_status(self.ERROR, _("A severe error occurred:"), raw_suffix=temp_file.getvalue())
209 raise 209 raise
210 else: 210 else:
211 self.request.theme.add_msg(u"%s" % (_("Synchronisation finished. Look below for the status messages."), ), "info") 211 self.request.theme.add_msg(u"%s" % (_("Synchronisation finished. Look below for the status messages."), ), "info")
212 finally: 212 finally:
213 self.call_rollback_funcs() 213 self.call_rollback_funcs()