[Checkins] SVN: z3c.pt/trunk/ Simplify changelog and remove
conditional import
Hanno Schlichting
plone at hannosch.info
Sat Jul 12 09:38:20 EDT 2008
Log message for revision 88287:
Simplify changelog and remove conditional import
Changed:
U z3c.pt/trunk/CHANGES.txt
U z3c.pt/trunk/src/z3c/pt/generation.py
-=-
Modified: z3c.pt/trunk/CHANGES.txt
===================================================================
--- z3c.pt/trunk/CHANGES.txt 2008-07-12 13:35:19 UTC (rev 88286)
+++ z3c.pt/trunk/CHANGES.txt 2008-07-12 13:38:19 UTC (rev 88287)
@@ -4,9 +4,7 @@
Version 0.8.x
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Require zope.i18n 3.5.
-
-- Added optional support for using zope.i18n 3.5's new negotiate function.
+- Require zope.i18n 3.5 and add support for using its new negotiate function.
If you use the `zope_i18n_allowed_languages` environment variable the target
language for a template is only negotiated once per template, instead of
once for each translate function call. This more than doubles the speed
Modified: z3c.pt/trunk/src/z3c/pt/generation.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/generation.py 2008-07-12 13:35:19 UTC (rev 88286)
+++ z3c.pt/trunk/src/z3c/pt/generation.py 2008-07-12 13:38:19 UTC (rev 88287)
@@ -1,4 +1,5 @@
import zope.i18n
+from zope.i18n import negotiate
import cgi
import StringIO
@@ -23,15 +24,10 @@
\treturn _out.getvalue()
"""
-negotiate = getattr(zope.i18n, 'negotiate', None)
-if negotiate is None:
- def _negotiate(context, target_language):
+def _negotiate(context, target_language):
+ if target_language is not None:
return target_language
-else:
- def _negotiate(context, target_language):
- if target_language is not None:
- return target_language
- return negotiate(context)
+ return negotiate(context)
def initialize_i18n():
return (None, _negotiate, zope.i18n.translate)
More information about the Checkins
mailing list