mirror of
https://github.com/pretix/pretix.git
synced 2026-08-28 13:34:40 +00:00
Fixed localization and error reporting with exceptions thrown in celery
This commit is contained in:
@@ -342,3 +342,16 @@ def language(lng):
|
||||
yield
|
||||
finally:
|
||||
translation.activate(_lng)
|
||||
|
||||
|
||||
class LazyLocaleException(Exception):
|
||||
def __init__(self, msg, msgargs=None):
|
||||
self.msg = msg
|
||||
self.msgargs = msgargs
|
||||
super().__init__(msg, msgargs)
|
||||
|
||||
def __str__(self):
|
||||
if self.msgargs:
|
||||
return ugettext(self.msg) % self.msgargs
|
||||
else:
|
||||
return ugettext(self.msg)
|
||||
|
||||
Reference in New Issue
Block a user