projects
/
Plinn.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Mise à jour localisation.
[Plinn.git]
/
utils.py
diff --git
a/utils.py
b/utils.py
index
470b49a
..
7c5ceb7
100755
(executable)
--- a/
utils.py
+++ b/
utils.py
@@
-27,6
+27,8
@@
import re
from types import StringType
from random import randrange
from Acquisition import aq_base
from types import StringType
from random import randrange
from Acquisition import aq_base
+from quopri import encodestring
+from zope.globalrequest import getRequest
from AccessControl.PermissionRole import rolesForPermissionOn
from AccessControl import ModuleSecurityInfo
from AccessControl import getSecurityManager
from AccessControl.PermissionRole import rolesForPermissionOn
from AccessControl import ModuleSecurityInfo
from AccessControl import getSecurityManager
@@
-194,7
+196,7
@@
security.declarePublic('Message')
Message = MessageFactory('plinn')
security.declarePublic('translate')
Message = MessageFactory('plinn')
security.declarePublic('translate')
-def translate(message, context):
+def translate(message, context
=None
):
""" Translate i18n message.
"""
if isinstance(message, Exception):
""" Translate i18n message.
"""
if isinstance(message, Exception):
@@
-202,7
+204,11
@@
def translate(message, context):
message = message[0]
except (TypeError, IndexError):
pass
message = message[0]
except (TypeError, IndexError):
pass
- return i18ntranslate(message, domain='plinn', context=context.REQUEST)
+ if not context :
+ request = getRequest()
+ else :
+ request = context.REQUEST
+ return i18ntranslate(message, domain='plinn', context=request)
security.declarePublic('desacc')
desacc = Utf8Utils.desacc
security.declarePublic('desacc')
desacc = Utf8Utils.desacc
@@
-251,6
+257,11
@@
def getAdapterByInterface(ob, dotted_name, default=_marker) :
else :
return default
else :
return default
+def encodeQuopriEmail(name, email) :
+ qpName = encodestring(name).replace('=\n', '')
+ return '''"=?utf-8?q?%s?=" <%s>''' % (qpName, email)
+
+
def _sudo(func, userid=None) :
"""
execute func or any callable object
def _sudo(func, userid=None) :
"""
execute func or any callable object