[Zope3-checkins] CVS: Zope3/src/zope/configuration - fields.py:1.6
Philipp von Weitershausen
philikon@philikon.de
Sat, 2 Aug 2003 02:51:27 -0400
Update of /cvs-repository/Zope3/src/zope/configuration
In directory cvs.zope.org:/tmp/cvs-serv27596
Modified Files:
fields.py
Log Message:
Made GlobalObject aware of '*'. This is usually passed with for=""
attributes and it means 'any interface'. Handlers will take this as None.
=== Zope3/src/zope/configuration/fields.py 1.5 => 1.6 ===
--- Zope3/src/zope/configuration/fields.py:1.5 Fri Aug 1 15:46:03 2003
+++ Zope3/src/zope/configuration/fields.py Sat Aug 2 02:51:23 2003
@@ -65,7 +65,6 @@
Validation Error
"""
-
implements(IFromUnicode)
def fromUnicode(self, u):
@@ -111,7 +110,10 @@
ValidationError: (u'Constraint not satisfied', 1)
>>> gg.fromUnicode("y")
42
- >>>
+ >>> g = GlobalObject()
+ >>> gg = g.bind(fake)
+ >>> gg.fromUnicode('*')
+ >>>
"""
@@ -128,6 +130,11 @@
def fromUnicode(self, u):
name = str(u.strip())
+
+ # special case, mostly for interfaces
+ if name == '*':
+ return None
+
try:
value = self.context.resolve(name)
except ConfigurationError, v:
@@ -177,7 +184,6 @@
>>>
"""
-
implements(IFromUnicode)
def fromUnicode(self, u):
@@ -289,7 +295,6 @@
super(URI, self)._validate(value)
if uriPattern.match(value) is None:
raise schema.ValidationError(value)
-
class Bool(schema.Bool):
"""A boolean value