[Zope3-checkins] CVS: Zope3/src/zope/schema - interfaces.py:1.27
Jim Fulton
jim@zope.com
Mon, 28 Jul 2003 18:22:31 -0400
Update of /cvs-repository/Zope3/src/zope/schema
In directory cvs.zope.org:/tmp/cvs-serv30725/src/zope/schema
Modified Files:
interfaces.py
Log Message:
Added IFromUnicode to assist in conversion from unicode data.
=== Zope3/src/zope/schema/interfaces.py 1.26 => 1.27 ===
--- Zope3/src/zope/schema/interfaces.py:1.26 Sun Jul 13 02:47:28 2003
+++ Zope3/src/zope/schema/interfaces.py Mon Jul 28 18:22:27 2003
@@ -38,6 +38,19 @@
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
@@ -325,6 +338,20 @@
if not _is_field(value):
return False
return True
+
+
+class IURI(IBytesLine):
+ """A field containing an absolute URI
+ """
+
+class IId(IBytesLine):
+ """A field containing a unique identifier
+
+ A unique identifier is either an absolute URI ir a dotted name.
+ If it's a dotted name, it should have a module/package name as a prefix.
+
+ """
+
class ISequence(IMinMaxLen, IIterable, IContainer):
u"""Field containing a Sequence value.