[Zope3-checkins] CVS: Zope3/src/zope/tal - driver.py:1.1.2.2 htmltalparser.py:1.1.2.2 interfaces.py:1.1.2.2 runtest.py:1.1.2.2 setpath.py:1.1.2.2 taldefs.py:1.1.2.2 talgenerator.py:1.1.2.2 talgettext.py:1.1.2.2 talinterpreter.py:1.1.2.2 talparser.py:1.1.2.2 timer.py:1.1.2.2 xmlparser.py:1.1.2.2
Fred L. Drake, Jr.
fred@zope.com
Mon, 23 Dec 2002 15:39:00 -0500
Update of /cvs-repository/Zope3/src/zope/tal
In directory cvs.zope.org:/tmp/cvs-serv3332
Modified Files:
Tag: NameGeddon-branch
driver.py htmltalparser.py interfaces.py runtest.py setpath.py
taldefs.py talgenerator.py talgettext.py talinterpreter.py
talparser.py timer.py xmlparser.py
Log Message:
Fix imports to support the grand renaming.
=== Zope3/src/zope/tal/driver.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/tal/driver.py:1.1.2.1 Mon Dec 23 14:33:27 2002
+++ Zope3/src/zope/tal/driver.py Mon Dec 23 15:38:28 2002
@@ -165,7 +165,7 @@
strictinsert=1, i18nInterpolate=1):
from zope.tal.talinterpreter import TALInterpreter
program, macros = it
- assert TALDefs.isCurrentVersion(program)
+ assert zope.tal.taldefs.isCurrentVersion(program)
if engine is None:
engine = DummyEngine(macros)
TALInterpreter(program, macros, engine, stream, wrap=0,
=== Zope3/src/zope/tal/htmltalparser.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/tal/htmltalparser.py:1.1.2.1 Mon Dec 23 14:33:27 2002
+++ Zope3/src/zope/tal/htmltalparser.py Mon Dec 23 15:38:28 2002
@@ -17,11 +17,12 @@
import sys
-from zope.tal.talgenerator import TALGenerator
from HTMLParser import HTMLParser, HTMLParseError
-from zope.tal.taldefs import \
- ZOPE_METAL_NS, ZOPE_TAL_NS, ZOPE_I18N_NS, METALError, TALError, \
- I18NError
+
+from zope.tal.taldefs import ZOPE_METAL_NS, ZOPE_TAL_NS, ZOPE_I18N_NS, \
+ METALError, TALError, I18NError
+from zope.tal.talgenerator import TALGenerator
+
BOOLEAN_HTML_ATTRS = [
# List of Boolean attributes in HTML that may be given in
=== Zope3/src/zope/tal/interfaces.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/tal/interfaces.py:1.1.2.1 Mon Dec 23 14:33:27 2002
+++ Zope3/src/zope/tal/interfaces.py Mon Dec 23 15:38:28 2002
@@ -1,7 +1,6 @@
"""Interface that a TALES engine provides to the METAL/TAL implementation."""
-from zope.interface import Interface
-from zope.interface.element import Attribute
+from zope.interface import Attribute, Interface
class ITALESCompiler(Interface):
=== Zope3/src/zope/tal/runtest.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/tal/runtest.py:1.1.2.1 Mon Dec 23 14:33:27 2002
+++ Zope3/src/zope/tal/runtest.py Mon Dec 23 15:38:28 2002
@@ -16,12 +16,13 @@
Driver program to run METAL and TAL regression tests.
"""
-import sys
-import os
-from cStringIO import StringIO
import glob
+import os
+import sys
import traceback
+from cStringIO import StringIO
+
if __name__ == "__main__":
import setpath # Local hack to tweak sys.path etc.
@@ -62,7 +63,7 @@
del args[0]
if not args:
prefix = os.path.join("tests", "input", "test*.")
- if tests.utils.skipxml:
+ if zope.tal.tests.utils.skipxml:
xmlargs = []
else:
xmlargs = glob.glob(prefix + "xml")
@@ -81,7 +82,7 @@
if not unittesting:
print arg,
sys.stdout.flush()
- if tests.utils.skipxml and arg.endswith(".xml"):
+ if zope.tal.tests.utils.skipxml and arg.endswith(".xml"):
print "SKIPPED (XML parser not available)"
continue
save = sys.stdout, sys.argv
@@ -89,7 +90,7 @@
try:
sys.stdout = stdout = StringIO()
sys.argv = [""] + opts + locopts + [arg]
- driver.main()
+ zope.tal.driver.main()
finally:
sys.stdout, sys.argv = save
except SystemExit:
=== Zope3/src/zope/tal/setpath.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/tal/setpath.py:1.1.2.1 Mon Dec 23 14:33:27 2002
+++ Zope3/src/zope/tal/setpath.py Mon Dec 23 15:38:28 2002
@@ -28,7 +28,7 @@
except IOError:
try:
# If we can import ZODB, our sys.path is set up well enough already
- import ZODB
+ import zodb
except ImportError:
raise IOError("Can't find ZODB package. Please edit %s to point to "
"your Zope's lib/python directory" % path)
@@ -41,4 +41,4 @@
if dir not in sys.path:
sys.path.append(dir)
# Must import this first to initialize Persistence properly
- import ZODB
+ import zodb
=== Zope3/src/zope/tal/taldefs.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/tal/taldefs.py:1.1.2.1 Mon Dec 23 14:33:27 2002
+++ Zope3/src/zope/tal/taldefs.py Mon Dec 23 15:38:28 2002
@@ -2,21 +2,19 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
Common definitions used by TAL and METAL compilation an transformation.
"""
-from types import ListType, TupleType
-
from zope.tal.interfaces import ITALESErrorInfo
TAL_VERSION = "1.4"
@@ -150,7 +148,7 @@
def getProgramMode(program):
version = getProgramVersion(program)
- if (version == TAL_VERSION and isinstance(program[1], TupleType) and
+ if (version == TAL_VERSION and isinstance(program[1], tuple) and
len(program[1]) == 2):
opcode, mode = program[1]
if opcode == "mode":
@@ -159,7 +157,7 @@
def getProgramVersion(program):
if (len(program) >= 2 and
- isinstance(program[0], TupleType) and len(program[0]) == 2):
+ isinstance(program[0], tuple) and len(program[0]) == 2):
opcode, version = program[0]
if opcode == "version":
return version
@@ -172,7 +170,7 @@
_entnx_re = re.compile('&(#X[A-F0-9]*)(?![A-F0-9;])', re.I)
_entnd_re = re.compile('&(#[0-9][0-9]*)(?![0-9;])')
del re
-
+
def attrEscape(s):
"""Replace special characters '&<>' by character entities,
except when '&' already begins a syntactically valid entity."""
=== Zope3/src/zope/tal/talgenerator.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/tal/talgenerator.py:1.1.2.1 Mon Dec 23 14:33:27 2002
+++ Zope3/src/zope/tal/talgenerator.py Mon Dec 23 15:38:28 2002
@@ -15,11 +15,10 @@
Code generator for TALInterpreter intermediate code.
"""
-import re
import cgi
+import re
-import zope.tal.taldefs
-
+from zope.tal import taldefs
from zope.tal.taldefs import NAME_RE, TAL_VERSION
from zope.tal.taldefs import I18NError, METALError, TALError
from zope.tal.taldefs import parseSubstitution
@@ -29,6 +28,7 @@
I18N_CONTENT = 2
I18N_EXPRESSION = 3
+
class TALGenerator:
inMacroUse = 0
@@ -162,7 +162,7 @@
if item[1] is None:
s = item[0]
else:
- s = '%s="%s"' % (item[0], TALDefs.attrEscape(item[1]))
+ s = '%s="%s"' % (item[0], taldefs.attrEscape(item[1]))
attrlist[i] = item[0], s
new.append(" " + s)
# if no non-optimizable attributes were found, convert to plain text
@@ -261,7 +261,7 @@
self.emitRawText(cgi.escape(text))
def emitDefines(self, defines):
- for part in TALDefs.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:
@@ -476,20 +476,20 @@
self.position = position
for key, value in taldict.items():
- if key not in TALDefs.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 TALDefs.KNOWN_METAL_ATTRIBUTES:
+ if key not in taldefs.KNOWN_METAL_ATTRIBUTES:
raise METALError("bad METAL attribute: " + `key`,
position)
if not value:
raise TALError("missing value for METAL attribute: " +
`key`, position)
for key, value in i18ndict.items():
- if key not in TALDefs.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: " +
@@ -639,7 +639,7 @@
self.pushProgram()
if attrsubst or i18nattrs:
if attrsubst:
- repldict = TALDefs.parseAttributeReplacements(attrsubst)
+ repldict = taldefs.parseAttributeReplacements(attrsubst)
else:
repldict = {}
if i18nattrs:
=== Zope3/src/zope/tal/talgettext.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/tal/talgettext.py:1.1.2.1 Mon Dec 23 14:33:27 2002
+++ Zope3/src/zope/tal/talgettext.py Mon Dec 23 15:38:28 2002
@@ -24,9 +24,9 @@
Print this message and exit.
"""
-import sys
-import os
import getopt
+import os
+import sys
from zope.tal.htmltalparser import HTMLTALParser
from zope.tal.talinterpreter import TALInterpreter
=== Zope3/src/zope/tal/talinterpreter.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/tal/talinterpreter.py:1.1.2.1 Mon Dec 23 14:33:27 2002
+++ Zope3/src/zope/tal/talinterpreter.py Mon Dec 23 15:38:28 2002
@@ -15,16 +15,17 @@
Interpreter for a pre-compiled TAL program.
"""
-import sys
import getopt
import re
-from types import ListType
+import sys
+
from cgi import escape
# Do not use cStringIO here! It's not unicode aware. :(
from StringIO import StringIO
from zope.tal.taldefs import quote, TAL_VERSION, TALError, METALError
-from zope.tal.taldefs import isCurrentVersion, getProgramVersion, getProgramMode
+from zope.tal.taldefs import isCurrentVersion
+from zope.tal.taldefs import getProgramVersion, getProgramMode
from zope.tal.talgenerator import TALGenerator
from zope.tal.translationcontext import TranslationContext
=== Zope3/src/zope/tal/talparser.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/tal/talparser.py:1.1.2.1 Mon Dec 23 14:33:27 2002
+++ Zope3/src/zope/tal/talparser.py Mon Dec 23 15:38:28 2002
@@ -15,9 +15,10 @@
Parse XML and compile to TALInterpreter intermediate code.
"""
-from zope.tal.xmlparser import XMLParser
from zope.tal.taldefs import XML_NS, ZOPE_I18N_NS, ZOPE_METAL_NS, ZOPE_TAL_NS
from zope.tal.talgenerator import TALGenerator
+from zope.tal.xmlparser import XMLParser
+
class TALParser(XMLParser):
=== Zope3/src/zope/tal/timer.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/tal/timer.py:1.1.2.1 Mon Dec 23 14:33:27 2002
+++ Zope3/src/zope/tal/timer.py Mon Dec 23 15:38:28 2002
@@ -16,13 +16,15 @@
Helper program to time compilation and interpretation
"""
+import getopt
import sys
import time
-import getopt
+
from cPickle import dumps, loads
from cStringIO import StringIO
from zope.tal.driver import FILE, compilefile, interpretit
+
def main():
count = 10
=== Zope3/src/zope/tal/xmlparser.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/tal/xmlparser.py:1.1.2.1 Mon Dec 23 14:33:27 2002
+++ Zope3/src/zope/tal/xmlparser.py Mon Dec 23 15:38:28 2002
@@ -17,6 +17,7 @@
import logging
+
class XMLParser:
ordered_attributes = 0