Mercurial > p > roundup > code
diff roundup/cgi/templating.py @ 2466:7b248ea0a2e5
add translation to Unauthorised exception; mark missed text for translation
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Tue, 15 Jun 2004 09:15:14 +0000 |
| parents | c18a7d4259e3 |
| children | 31cd032291c5 |
line wrap: on
line diff
--- a/roundup/cgi/templating.py Tue Jun 15 09:12:29 2004 +0000 +++ b/roundup/cgi/templating.py Tue Jun 15 09:15:14 2004 +0000 @@ -87,12 +87,17 @@ pass class Unauthorised(Exception): - def __init__(self, action, klass): + def __init__(self, action, klass, translator=None): self.action = action self.klass = klass + if translator: + self._ = translator.gettext + else: + self._ = translationService.gettext def __str__(self): - return 'You are not allowed to %s items of class %s'%(self.action, - self.klass) + return self._('You are not allowed to %(action)s ' + 'items of class %(class)s') % { + 'action': self.action, 'class': self.klass} def find_template(dir, name, extension): ''' Find a template in the nominated dir @@ -681,7 +686,7 @@ def history(self): self.view_check() - return 'New node - no history' + return self._('New node - no history') def renderWith(self, name, **kwargs): ''' Render this class with the given template.
