[ZPT] CVS: Zope27/lib/python/TAL - TALGenerator.py:1.54.26.2 TALParser.py:1.18.26.2
Fred L. Drake, Jr.
fdrake@acm.org
Thu, 5 Sep 2002 16:58:09 -0400
Update of /cvs-repository/Zope27/lib/python/TAL
In directory cvs.zope.org:/tmp/cvs-serv2091
Modified Files:
Tag: Zope-2_7-development-branch
TALGenerator.py TALParser.py
Log Message:
Purge "import *", which is vile.
=== Zope27/lib/python/TAL/TALGenerator.py 1.54.26.1 => 1.54.26.2 ===
--- Zope27/lib/python/TAL/TALGenerator.py:1.54.26.1 Tue Jul 30 16:12:52 2002
+++ Zope27/lib/python/TAL/TALGenerator.py Thu Sep 5 16:58:08 2002
@@ -18,7 +18,11 @@
import re
import cgi
-from TALDefs import *
+import TALDefs
+
+from TALDefs import NAME_RE, TAL_VERSION
+from TALDefs import I18NError, METALError, TALError
+from TALDefs import parseSubstitution
from TranslationContext import TranslationContext, DEFAULT_DOMAIN
I18N_REPLACE = 1
@@ -158,7 +162,7 @@
if item[1] is None:
s = item[0]
else:
- s = "%s=%s" % (item[0], quote(item[1]))
+ s = "%s=%s" % (item[0], TALDefs.quote(item[1]))
attrlist[i] = item[0], s
new.append(" " + s)
# if no non-optimizable attributes were found, convert to plain text
@@ -257,7 +261,7 @@
self.emitRawText(cgi.escape(text))
def emitDefines(self, defines):
- for part in splitParts(defines):
+ for part in TALDefs.splitParts(defines):
m = re.match(
r"(?s)\s*(?:(global|local)\s+)?(%s)\s+(.*)\Z" % NAME_RE, part)
if not m:
@@ -472,20 +476,20 @@
self.position = position
for key, value in taldict.items():
- if key not in KNOWN_TAL_ATTRIBUTES:
+ if key not in TALDefs.KNOWN_TAL_ATTRIBUTES:
raise TALError("bad TAL attribute: " + `key`, position)
if not (value or key == 'omit-tag'):
raise TALError("missing value for TAL attribute: " +
`key`, position)
for key, value in metaldict.items():
- if key not in KNOWN_METAL_ATTRIBUTES:
+ if key not in TALDefs.KNOWN_METAL_ATTRIBUTES:
raise METALError("bad METAL attribute: " + `key`,
- position)
+ position)
if not value:
raise TALError("missing value for METAL attribute: " +
`key`, position)
for key, value in i18ndict.items():
- if key not in KNOWN_I18N_ATTRIBUTES:
+ if key not in TALDefs.KNOWN_I18N_ATTRIBUTES:
raise I18NError("bad i18n attribute: " + `key`, position)
if not value and key in ("attributes", "data", "id"):
raise I18NError("missing value for i18n attribute: " +
@@ -546,8 +550,8 @@
self.inMacroUse = 0
else:
if fillSlot:
- raise METALError, ("fill-slot must be within a use-macro",
- position)
+ raise METALError("fill-slot must be within a use-macro",
+ position)
if not self.inMacroUse:
if defineMacro:
self.pushProgram()
@@ -564,7 +568,7 @@
self.inMacroUse = 1
if defineSlot:
if not self.inMacroDef:
- raise METALError, (
+ raise METALError(
"define-slot must be within a define-macro",
position)
self.pushProgram()
@@ -635,7 +639,7 @@
self.pushProgram()
if attrsubst or i18nattrs:
if attrsubst:
- repldict = parseAttributeReplacements(attrsubst)
+ repldict = TALDefs.parseAttributeReplacements(attrsubst)
else:
repldict = {}
if i18nattrs:
=== Zope27/lib/python/TAL/TALParser.py 1.18.26.1 => 1.18.26.2 ===
--- Zope27/lib/python/TAL/TALParser.py:1.18.26.1 Tue Jul 30 16:12:52 2002
+++ Zope27/lib/python/TAL/TALParser.py Thu Sep 5 16:58:08 2002
@@ -16,7 +16,7 @@
"""
from XMLParser import XMLParser
-from TALDefs import *
+from TALDefs import XML_NS, ZOPE_I18N_NS, ZOPE_METAL_NS, ZOPE_TAL_NS
from TALGenerator import TALGenerator
class TALParser(XMLParser):