[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/tal/talparser.py add comments explaining some of the helper methods

Fred L. Drake, Jr. fred at zope.com
Thu Jul 8 17:10:15 EDT 2004


Log message for revision 26236:
add comments explaining some of the helper methods


-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/tal/talparser.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/tal/talparser.py	2004-07-08 20:42:22 UTC (rev 26235)
+++ Zope3/branches/ZopeX3-3.0/src/zope/tal/talparser.py	2004-07-08 21:10:14 UTC (rev 26236)
@@ -72,7 +72,13 @@
         name, namebase, namens = self.fixname(name)
         for key, value in attrlist:
             key, keybase, keyns = self.fixname(key)
-            ns = keyns or namens # default to tag namespace
+            # Default to tag namespace, even though this really only
+            # makes sense for elements in the TAL or METAL namespaces.
+            # This allows <tal:block replace="..."> to be mostly
+            # equivalent to <div tal:replace="...">; removal of the
+            # actual element start and end tags is handled elsewhere
+            # for elements in these namespaces.
+            ns = keyns or namens
             item = key, value
             if ns == 'metal':
                 metaldict[keybase] = value
@@ -89,6 +95,8 @@
         return name, fixedattrlist, taldict, metaldict, i18ndict
 
     def xmlnsattrs(self):
+        # return [(qname, nsURI), ...] for the namespaces declared on
+        # this element; must be called during the start element handler
         newlist = []
         for prefix, uri in self.nsNew:
             if prefix:
@@ -104,6 +112,7 @@
         return newlist
 
     def fixname(self, name):
+        # return (qname, localname, ns-indicator) for the attribute name `name`
         if ' ' in name:
             uri, name = name.split(' ')
             prefix = self.nsDict[uri]



More information about the Zope3-Checkins mailing list