[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Traversing - ParameterParsing.py:1.1.2.3 Traverser.py:1.1.2.13
Jim Fulton
jim@zope.com
Mon, 10 Jun 2002 10:52:16 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/Traversing
In directory cvs.zope.org:/tmp/cvs-serv30254/lib/python/Zope/App/Traversing
Modified Files:
Tag: Zope-3x-branch
ParameterParsing.py Traverser.py
Log Message:
Implemented:
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/PathNamespaceQualificationSyntax
without a short-hand syntax for the creation namespace which may go
away.
=== Zope3/lib/python/Zope/App/Traversing/ParameterParsing.py 1.1.2.2 => 1.1.2.3 ===
"""
+import re
+
+namespace_pattern = re.compile('[+][+]([a-zA-Z0-9_]+)[+][+]')
+
def parameterizedNameParse(name):
"""Parse a name with parameters, including namespace parameters.
@@ -29,29 +33,14 @@
- sequence of parameters, as name-value pairs.
"""
- l = name.find('::')
- if l > 0:
- ns = name[:l]
- name = name[l+2:]
+ ns = ''
+ if name[:2] == '@@':
+ ns = 'view'
+ name = name[2:]
else:
- ns = ''
-
- if ';' not in name:
- return ns, name, ()
-
-
- parts = name.split(';')
- nm = parts[:1][0]
- parms = ()
- for param in parts[1:]:
- l = param.find('=')
- if l >= 0:
- pname = param[:l]
- pval = param[l+1:]
- else:
- pname = param
- pval = ''
- parms += ((pname, pval),)
-
+ match = namespace_pattern.match(name)
+ if match:
+ prefix, ns = match.group(0, 1)
+ name = name[len(prefix):]
- return ns, nm, parms
+ return ns, name, ()
=== Zope3/lib/python/Zope/App/Traversing/Traverser.py 1.1.2.12 => 1.1.2.13 ===
- if ':' in name or ';' in name:
+ if name and name[:1] in '@+':
ns, nm, parms = parameterizedNameParse(name)
if ns:
curr = namespaceLookup(name, ns, nm, parms,