Commit 06eeb956 authored by Jeremy Hylton's avatar Jeremy Hylton

Revert previous checkin. TAL must work with Python 1.5.2.

XXX Future issue to resolve: How to shut up deprecation warnings in
the test suite when running with Python 2.2.  The Zope trunk isn't
required to work w/ 2.2 yet, so it's a non-issue at the moment.
parent 61f3cc81
...@@ -90,6 +90,11 @@ import sys ...@@ -90,6 +90,11 @@ import sys
import getopt import getopt
from cgi import escape from cgi import escape
from string import join, lower, rfind
try:
from strop import lower, rfind
except ImportError:
pass
try: try:
from cStringIO import StringIO from cStringIO import StringIO
...@@ -230,9 +235,9 @@ class TALInterpreter: ...@@ -230,9 +235,9 @@ class TALInterpreter:
self.col = 0 self.col = 0
def stream_write(self, s, def stream_write(self, s,
len=len): len=len, rfind=rfind):
self._stream_write(s) self._stream_write(s)
i = s.rfind('\n') i = rfind(s, '\n')
if i < 0: if i < 0:
self.col = self.col + len(s) self.col = self.col + len(s)
else: else:
...@@ -333,7 +338,7 @@ class TALInterpreter: ...@@ -333,7 +338,7 @@ class TALInterpreter:
# Clear 'entering' flag # Clear 'entering' flag
macs[-1][2] = 0 macs[-1][2] = 0
# Convert or drop depth-one METAL attributes. # Convert or drop depth-one METAL attributes.
i = name.rfind(":") + 1 i = rfind(name, ":") + 1
prefix, suffix = name[:i], name[i:] prefix, suffix = name[:i], name[i:]
if suffix == "define-macro": if suffix == "define-macro":
# Convert define-macro as we enter depth one. # Convert define-macro as we enter depth one.
...@@ -357,7 +362,7 @@ class TALInterpreter: ...@@ -357,7 +362,7 @@ class TALInterpreter:
if action > 1: if action > 1:
return self.attrAction(item) return self.attrAction(item)
ok = 1 ok = 1
if self.html and name.lower() in BOOLEAN_HTML_ATTRS: if self.html and lower(name) in BOOLEAN_HTML_ATTRS:
evalue = self.engine.evaluateBoolean(item[3]) evalue = self.engine.evaluateBoolean(item[3])
if evalue is self.Default: if evalue is self.Default:
if action == 1: # Cancelled insert if action == 1: # Cancelled insert
...@@ -486,7 +491,7 @@ class TALInterpreter: ...@@ -486,7 +491,7 @@ class TALInterpreter:
return return
s = escape(text) s = escape(text)
self._stream_write(s) self._stream_write(s)
i = s.rfind('\n') i = rfind(s, '\n')
if i < 0: if i < 0:
self.col = self.col + len(s) self.col = self.col + len(s)
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment