Skip to content

Commit ee20506

Browse files
author
Alexander Smishlajev
committed
always use translation service set in the tracker client instance;
add vim modeline
1 parent 8724155 commit ee20506

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

roundup/cgi/templating.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(self, action, klass, translator=None):
6262
if translator:
6363
self._ = translator.gettext
6464
else:
65-
self._ = translationService.gettext
65+
self._ = TranslationService.get_translation().gettext
6666
def __str__(self):
6767
return self._('You are not allowed to %(action)s '
6868
'items of class %(class)s') % {
@@ -406,14 +406,16 @@ def view_check(self):
406406
view this class.
407407
'''
408408
if not self.is_view_ok():
409-
raise Unauthorised("view", self._classname)
409+
raise Unauthorised("view", self._classname,
410+
translator=self._client.translator)
410411

411412
def edit_check(self):
412413
''' Raise the Unauthorised exception if the user's not permitted to
413414
edit this class.
414415
'''
415416
if not self.is_edit_ok():
416-
raise Unauthorised("edit", self._classname)
417+
raise Unauthorised("edit", self._classname,
418+
translator=self._client.translator)
417419

418420
def input_html4(**attrs):
419421
"""Generate an 'input' (html4) element with given attributes"""
@@ -441,7 +443,7 @@ def gettext(self, msgid):
441443
"""Return the localized translation of msgid"""
442444
if self._context is None:
443445
self._context = context(self._client)
444-
return translationService.translate(domain="roundup",
446+
return self._client.translator.translate(domain="roundup",
445447
msgid=msgid, context=self._context)
446448

447449
_ = gettext
@@ -1355,7 +1357,7 @@ def __init__(self, client, classname, nodeid, prop, name, value,
13551357
HTMLProperty.__init__(self, client, classname, nodeid, prop, name,
13561358
value, anonymous=anonymous)
13571359
if self._value:
1358-
self._value.setTranslator(translationService)
1360+
self._value.setTranslator(self._client.translator)
13591361
self._offset = offset
13601362

13611363
def plain(self):
@@ -1477,7 +1479,7 @@ def __init__(self, client, classname, nodeid, prop, name, value,
14771479
HTMLProperty.__init__(self, client, classname, nodeid, prop,
14781480
name, value, anonymous)
14791481
if self._value:
1480-
self._value.setTranslator(translationService)
1482+
self._value.setTranslator(self._client.translator)
14811483

14821484
def plain(self):
14831485
''' Render a "plain" representation of the property
@@ -2253,3 +2255,4 @@ def html_quote(self, html):
22532255
'''HTML-quote the supplied text.'''
22542256
return cgi.escape(url)
22552257

2258+
# vim: set et sts=4 sw=4 :

0 commit comments

Comments
 (0)