[Checkins] SVN: zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/ Centralize the conditional import dance.
Tres Seaver
tseaver at palladion.com
Tue Feb 23 14:14:05 EST 2010
Log message for revision 109377:
Centralize the conditional import dance.
Changed:
U zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/_bootstrapinterfaces.py
A zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/_messageid.py
U zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/interfaces.py
U zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/tests/test_objectfield.py
-=-
Modified: zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/_bootstrapinterfaces.py
===================================================================
--- zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/_bootstrapinterfaces.py 2010-02-23 19:02:38 UTC (rev 109376)
+++ zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/_bootstrapinterfaces.py 2010-02-23 19:14:05 UTC (rev 109377)
@@ -17,12 +17,7 @@
"""
import zope.interface
-try:
- from zope.i18nmessageid import MessageFactory
-except ImportError:
- _ = lambda x: unicode(x)
-else:
- _ = MessageFactory("zope")
+from zope.schema._messageid import _
class StopValidation(Exception):
"""Raised if the validation is completed early.
Added: zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/_messageid.py
===================================================================
--- zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/_messageid.py (rev 0)
+++ zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/_messageid.py 2010-02-23 19:14:05 UTC (rev 109377)
@@ -0,0 +1,20 @@
+##############################################################################
+#
+# Copyright (c) 2000 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+try:
+ from zope.i18nmessageid import MessageFactory
+except ImportError:
+ _ = lambda x: unicode(x)
+else:
+ _ = MessageFactory("zope")
Modified: zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/interfaces.py
===================================================================
--- zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/interfaces.py 2010-02-23 19:02:38 UTC (rev 109376)
+++ zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/interfaces.py 2010-02-23 19:14:05 UTC (rev 109377)
@@ -19,12 +19,7 @@
from zope.interface import Interface, Attribute
-try:
- from zope.i18nmessageid import MessageFactory
-except ImportError:
- _ = lambda x: unicode(x)
-else:
- _ = MessageFactory("zope")
+from zope.schema._messageid import _
# Import from _bootstrapinterfaces only because other packages will expect
# to find these interfaces here.
Modified: zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/tests/test_objectfield.py
===================================================================
--- zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/tests/test_objectfield.py 2010-02-23 19:02:38 UTC (rev 109376)
+++ zope.schema/branches/tseaver-optional_i18nmessageid/src/zope/schema/tests/test_objectfield.py 2010-02-23 19:14:05 UTC (rev 109377)
@@ -28,12 +28,7 @@
from zope.schema.interfaces import IBeforeObjectAssignedEvent
from zope.testing.cleanup import CleanUp
-try:
- from zope.i18nmessageid import MessageFactory
-except ImportError:
- _ = lambda x: unicode(x)
-else:
- _ = MessageFactory("zope")
+from zope.schema._messageid import _
class ITestSchema(Interface):
More information about the checkins
mailing list