[Zope-Checkins] CVS: Zope/lib/python/Products/PageTemplates - PageTemplateFile.py:1.27
Fred L. Drake, Jr.
fred@zope.com
Tue, 22 Apr 2003 12:27:46 -0400
Update of /cvs-repository/Zope/lib/python/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv22954
Modified Files:
PageTemplateFile.py
Log Message:
- clean up some filename manipulation to avoid duplicate work and make
it more readable
- remove unused instance variable
=== Zope/lib/python/Products/PageTemplates/PageTemplateFile.py 1.26 => 1.27 ===
--- Zope/lib/python/Products/PageTemplates/PageTemplateFile.py:1.26 Mon Apr 7 15:21:37 2003
+++ Zope/lib/python/Products/PageTemplates/PageTemplateFile.py Tue Apr 22 12:27:46 2003
@@ -37,7 +37,6 @@
func_defaults = None
func_code = FuncCode((), 0)
- _need__name__=1
_v_last_read=0
_default_bindings = {'name_subpath': 'traverse_subpath'}
@@ -53,12 +52,14 @@
elif not isinstance(_prefix, str):
_prefix = package_home(_prefix)
name = kw.get('__name__')
+ basepath, ext = os.path.splitext(filename)
if name:
- self._need__name__ = 0
self.__name__ = name
else:
- self.__name__ = os.path.splitext(os.path.split(filename)[-1])[0]
- if not os.path.splitext(filename)[1]:
+ self.__name__ = os.path.basename(basepath)
+ if not ext:
+ # XXX This is pretty bogus, but can't be removed since
+ # it's been released this way.
filename = filename + '.zpt'
self.filename = os.path.join(_prefix, filename)