[Zope3-checkins] CVS: Zope3/src/zope/configuration - fields.py:1.3
Jim Fulton
jim@zope.com
Tue, 29 Jul 2003 13:13:22 -0400
Update of /cvs-repository/Zope3/src/zope/configuration
In directory cvs.zope.org:/tmp/cvs-serv23186
Modified Files:
fields.py
Log Message:
Allow spaces around paths in directive attributes.
=== Zope3/src/zope/configuration/fields.py 1.2 => 1.3 ===
--- Zope3/src/zope/configuration/fields.py:1.2 Tue Jul 29 12:29:01 2003
+++ Zope3/src/zope/configuration/fields.py Tue Jul 29 13:13:17 2003
@@ -145,7 +145,7 @@
return values
class Path(schema.Text):
- """A file path name, which may be input as a relative path
+ r"""A file path name, which may be input as a relative path
Input paths are converted to absolute paths and normalized.
@@ -170,6 +170,12 @@
>>> n.split(os.sep)
[u'', u'a', u'b']
+ This should also work with extra spaces around the path:
+ >>> p = " \n %s \n\n " % p
+ >>> n = field.fromUnicode(p)
+ >>> n.split(os.sep)
+ [u'', u'a', u'b']
+
Now try a relative path:
>>> p = unicode(os.path.join('a', 'b'))
@@ -183,6 +189,7 @@
implements(IFromUnicode)
def fromUnicode(self, u):
+ u = u.strip()
if os.path.isabs(u):
return os.path.normpath(u)