[Zope3-checkins] CVS: Zope3/src/zope/schema - _bootstrapinterfaces.py:1.1 _bootstrapfields.py:1.24 interfaces.py:1.34

Shane Hathaway shane at zope.com
Wed Oct 15 16:28:23 EDT 2003


Update of /cvs-repository/Zope3/src/zope/schema
In directory cvs.zope.org:/tmp/cvs-serv14213

Modified Files:
	_bootstrapfields.py interfaces.py 
Added Files:
	_bootstrapinterfaces.py 
Log Message:
Fixed circular import.

Moved the interfaces that _bootstrapfields requires into a new module,
_bootstrapinterfaces.  This way the dependency chain is clearer.


=== Added File Zope3/src/zope/schema/_bootstrapinterfaces.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
#
##############################################################################
"""Bootstrap schema interfaces and exceptions

$Id: _bootstrapinterfaces.py,v 1.1 2003/10/15 20:28:22 shane Exp $
"""
from zope.interface import Interface


class StopValidation(Exception):
    """Raised if the validation is completed early.

    Note that this exception should be always caught, since it is just
    a way for the validator to save time.
    """


class ValidationError(Exception):
    """Raised if the Validation process fails."""

    def __cmp__(self, other):
        return cmp(self.args, other.args)

    def __repr__(self):
        return ' '.join(map(str, self.args))

class IFromUnicode(Interface):
    """Parse a unicode string to a value

    We will often adapt fields to this interface to support views and
    other applications that need to conver raw data as unicode
    values.

    """

    def fromUnicode(str):
        """Convert a unicode string to a value.
        """


=== Zope3/src/zope/schema/_bootstrapfields.py 1.23 => 1.24 ===
--- Zope3/src/zope/schema/_bootstrapfields.py:1.23	Tue Sep 23 20:37:42 2003
+++ Zope3/src/zope/schema/_bootstrapfields.py	Wed Oct 15 16:28:22 2003
@@ -19,8 +19,8 @@
 import warnings
 
 from zope.interface import Attribute, providedBy, implements
-from zope.schema.interfaces import StopValidation, ValidationError
-from zope.schema.interfaces import IFromUnicode
+from zope.schema._bootstrapinterfaces import StopValidation, ValidationError
+from zope.schema._bootstrapinterfaces import IFromUnicode
 from zope.schema._schema import getFields
 from zope.schema import errornames
 


=== Zope3/src/zope/schema/interfaces.py 1.33 => 1.34 ===
--- Zope3/src/zope/schema/interfaces.py:1.33	Thu Sep 25 11:24:31 2003
+++ Zope3/src/zope/schema/interfaces.py	Wed Oct 15 16:28:22 2003
@@ -15,7 +15,11 @@
 
 $Id$
 """
+
 from zope.interface import Interface, Attribute
+from zope.schema._bootstrapfields import Field, Text, TextLine, Bool, Int
+from zope.schema._bootstrapfields import Container, Iterable
+
 try:
     from zope.i18n import MessageIDFactory
     _ = MessageIDFactory("zope")
@@ -23,41 +27,11 @@
     import gettext
     gettext.install(domain='zope')
 
+# Import from _bootstrapinterfaces only because other packages will expect
+# to find these interfaces here.
+from zope.schema._bootstrapinterfaces import StopValidation, ValidationError
+from zope.schema._bootstrapinterfaces import IFromUnicode
 
-
-class StopValidation(Exception):
-    """Raised if the validation is completed early.
-
-    Note that this exception should be always caught, since it is just
-    a way for the validator to save time.
-    """
-
-
-class ValidationError(Exception):
-    """Raised if the Validation process fails."""
-
-    def __cmp__(self, other):
-        return cmp(self.args, other.args)
-
-    def __repr__(self):
-        return ' '.join(map(str, self.args))
-
-class IFromUnicode(Interface):
-    """Parse a unicode string to a value
-
-    We will often adapt fields to this interface to support views and
-    other applications that need to conver raw data as unicode
-    values.
-
-    """
-
-    def fromUnicode(str):
-        """Convert a unicode string to a value.
-        """
-
-# Delay these imports to avoid circular import problems
-from zope.schema._bootstrapfields import Field, Text, TextLine, Bool, Int
-from zope.schema._bootstrapfields import Container, Iterable
 
 class IField(Interface):
     """Basic Schema Field Interface.




More information about the Zope3-Checkins mailing list