[Zope3-checkins]
SVN: Zope3/trunk/src/zope/pagetemplate/pagetemplatefile.py
Don't shadow. remove empty lines
Julien Anguenot
ja at nuxeo.com
Fri Oct 14 00:12:57 EDT 2005
Log message for revision 39126:
Don't shadow. remove empty lines
Changed:
U Zope3/trunk/src/zope/pagetemplate/pagetemplatefile.py
-=-
Modified: Zope3/trunk/src/zope/pagetemplate/pagetemplatefile.py
===================================================================
--- Zope3/trunk/src/zope/pagetemplate/pagetemplatefile.py 2005-10-14 04:06:21 UTC (rev 39125)
+++ Zope3/trunk/src/zope/pagetemplate/pagetemplatefile.py 2005-10-14 04:12:56 UTC (rev 39126)
@@ -27,7 +27,6 @@
from zope.pagetemplate.pagetemplate import PageTemplate
-
DEFAULT_ENCODING = "utf-8"
meta_pattern = re.compile(
@@ -62,14 +61,14 @@
def _prepare_html(self, text):
match = meta_pattern.search(text)
if match is not None:
- type, encoding = match.groups()
+ type_, encoding = match.groups()
# TODO: Shouldn't <meta>/<?xml?> stripping
# be in PageTemplate.__call__()?
text = meta_pattern.sub("", text)
else:
- type = None
+ type_ = None
encoding = DEFAULT_ENCODING
- return unicode(text, encoding), type
+ return unicode(text, encoding), type_
def _read_file(self):
__traceback_info__ = self.filename
@@ -79,17 +78,17 @@
except:
f.close()
raise
- type = sniff_type(text)
- if type == "text/xml":
+ type_ = sniff_type(text)
+ if type_ == "text/xml":
text += f.read()
else:
# For HTML, we really want the file read in text mode:
f.close()
f = open(self.filename)
text = f.read()
- text, type = self._prepare_html(text)
+ text, type_ = self._prepare_html(text)
f.close()
- return text, type
+ return text, type_
def _cook_check(self):
if self._v_last_read and not __debug__:
@@ -101,8 +100,8 @@
mtime = 0
if self._v_program is not None and mtime == self._v_last_read:
return
- text, type = self._read_file()
- self.pt_edit(text, type)
+ text, type_ = self._read_file()
+ self.pt_edit(text, type_)
self._cook()
if self._v_errors:
logging.error('PageTemplateFile: Error in template: %s',
@@ -116,7 +115,6 @@
def __getstate__(self):
raise TypeError("non-picklable object")
-
XML_PREFIXES = [
"<?xml", # ascii, utf-8
"\xef\xbb\xbf<?xml", # utf-8 w/ byte order mark
More information about the Zope3-Checkins
mailing list