[Zope-Checkins] SVN: Zope/trunk/doc/CHANGES.txt
Log message for revision 40687: Changed: U Zope/trunk/doc/CHANGES.txt -=- Modified: Zope/trunk/doc/CHANGES.txt === --- Zope/trunk/doc/CHANGES.txt 2005-12-11 08:42:50 UTC (rev 40686) +++ Zope/trunk/doc/CHANGES.txt 2005-12-11 08:44:31 UTC (rev 40687) @@ -26,6 +26,9 @@ Features added + - OFS.content_types: moved code to zope.app.content_types and added +method aliases + - ObjectManager now has an hasObject method to test presence. This brings it in line with BTreeFolder. ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/zope/ updated to latest Z3 trunk
Log message for revision 40688: updated to latest Z3 trunk Changed: _U Zope/trunk/lib/python/zope/ -=- Property changes on: Zope/trunk/lib/python/zope ___ Name: svn:externals - app -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/app cachedescriptors -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/cachedescriptors component-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/component configuration-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/configuration documenttemplate -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/documenttemplate event-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/event exceptions -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/exceptions hookable -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/hookable i18n -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/i18n i18nmessageid-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/i18nmessageid interface-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/interface modulealias -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/modulealias pagetemplate -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/pagetemplate proxy-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/proxy publisher-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/publisher schema -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/schema security -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/security server -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/server structuredtext -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/structuredtext tal -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/tal tales-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/tales testing -r 39830 svn://svn.zope.org/repos/main/zope.testing/trunk/src/zope/testing thread -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/thread deprecation -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/deprecation dottedname -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/dottedname formlib -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/formlib index-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/index testbrowser -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/testbrowser + app -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/app cachedescriptors -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/cachedescriptors component-r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/component configuration-r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/configuration documenttemplate -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/documenttemplate event-r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/event exceptions -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/exceptions hookable -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/hookable i18n -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/i18n i18nmessageid-r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/i18nmessageid interface-r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/interface modulealias -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/modulealias pagetemplate -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/pagetemplate proxy-r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/proxy publisher-r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/publisher schema -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/schema security -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/security server -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/server structuredtext -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/structuredtext tal -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/tal tales-r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/tales testing -r 39830 svn://svn.zope.org/repos/main/zope.testing/trunk/src/zope/testing thread -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/thread deprecation -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/deprecation dottedname -r 40659 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/dottedname formlib -r 40659
[Zope-Checkins] SVN: Zope/branches/ajung-zpt-integration/lib/python/zope/ updated Z3 trunk
Log message for revision 40690: updated Z3 trunk Changed: _U Zope/branches/ajung-zpt-integration/lib/python/zope/ -=- Property changes on: Zope/branches/ajung-zpt-integration/lib/python/zope ___ Name: svn:externals - app -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/app cachedescriptors -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/cachedescriptors component-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/component configuration-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/configuration documenttemplate -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/documenttemplate event-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/event exceptions -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/exceptions hookable -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/hookable i18n -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/i18n i18nmessageid-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/i18nmessageid interface-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/interface modulealias -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/modulealias pagetemplate -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/pagetemplate proxy-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/proxy publisher-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/publisher schema -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/schema security -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/security server -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/server structuredtext -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/structuredtext tal -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/tal tales-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/tales testing -r 39830 svn://svn.zope.org/repos/main/zope.testing/trunk/src/zope/testing thread -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/thread deprecation -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/deprecation dottedname -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/dottedname formlib -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/formlib index-r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/index testbrowser -r 40549 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/testbrowser + app -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/app cachedescriptors -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/cachedescriptors component-r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/component configuration-r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/configuration documenttemplate -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/documenttemplate event-r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/event exceptions -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/exceptions hookable -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/hookable i18n -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/i18n i18nmessageid-r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/i18nmessageid interface-r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/interface modulealias -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/modulealias pagetemplate -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/pagetemplate proxy-r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/proxy publisher-r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/publisher schema -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/schema security -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/security server -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/server structuredtext -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/structuredtext tal -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/tal tales-r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/tales testing -r 39830 svn://svn.zope.org/repos/main/zope.testing/trunk/src/zope/testing thread -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/thread deprecation -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/deprecation dottedname -r 40688 svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/dottedname formlib -r 40688
[Zope-Checkins] SVN: Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/__init__.py cleanup
Log message for revision 40691: cleanup Changed: U Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/__init__.py -=- Modified: Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/__init__.py === --- Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/__init__.py 2005-12-11 09:40:24 UTC (rev 40690) +++ Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/__init__.py 2005-12-11 09:47:00 UTC (rev 40691) @@ -11,14 +11,10 @@ # ## -__doc__='''Package wrapper for Page Templates +__doc__= Zope Page Templates (mostly a wrapper around the Zope 3 + ZPT implementation. + -This wrapper allows the Page Template modules to be segregated in a -separate package. - -$Id: __init__.py 40218 2005-11-18 14:39:19Z andreasjung $''' -__version__='$$'[11:-2] - # Placeholder for Zope Product data misc_ = {} ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py.scary added
Log message for revision 40693: added Changed: A Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py.scary -=- Added: Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py.scary === --- Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py.scary 2005-12-11 09:48:04 UTC (rev 40692) +++ Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py.scary 2005-12-11 11:06:41 UTC (rev 40693) @@ -0,0 +1,446 @@ +## +# +# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (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 +# +## + + Zope Page Template module (wrapper for the Zope 3 ZPT implementation) + +__version__='$Revision: 1.48 $'[11:-2] + +import re +from urllib import quote +import os, AccessControl, Acquisition +from Globals import ImageFile, package_home, InitializeClass +from OFS.SimpleItem import SimpleItem +from OFS.content_types import guess_content_type +from DateTime.DateTime import DateTime +from Shared.DC.Scripts.Script import Script +from Shared.DC.Scripts.Signature import FuncCode +from AccessControl import getSecurityManager + +from OFS.History import Historical, html_diff +from OFS.Cache import Cacheable +from OFS.Traversable import Traversable +from OFS.PropertyManager import PropertyManager + +from Products.PageTemplates.Expressions import SecureModuleImporter + +from AccessControl import Unauthorized +from AccessControl.Permissions import view, ftp_access, change_page_templates, view_management_screens + +from webdav.Lockable import ResourceLockedError +from webdav.WriteLockInterface import WriteLockInterface +from zope.pagetemplate.pagetemplate import PageTemplate + +# regular expression to extract the encoding from the XML preamble +encoding_reg= re.compile('\?xml.*?encoding=(.*?).*?\?', re.M) + +class Src(Acquisition.Explicit): + I am scary code + +index_html = None +PUT = document_src = Acquisition.Acquired + +def __before_publishing_traverse__(self, ob, request): +if getattr(request, '_hacked_path', 0): +request._hacked_path = 0 + +def __call__(self, REQUEST, RESPONSE): + +return self.document_src(REQUEST) + + +def sniffEncoding(text, default_encoding='utf-8'): + try to determine the encoding from html or xml + +# XXX: look at pagetemplates.py (BOM!!!) +if text.startswith('?xml'): +mo = encoding_reg.search(text) +if mo: +return mo.group(1) +return default_encoding + +_default_content_fn = os.path.join(package_home(globals()), 'pt', 'default.html') + + +class ZPT(Script, PageTemplate, Historical, Cacheable, + Traversable, PropertyManager): + Z2 wrapper class for Zope 3 page templates + +__implements__ = (WriteLockInterface,) + +meta_type = 'ZPT' + +func_defaults = None +func_code = FuncCode((), 0) + +_default_bindings = {'name_subpath': 'traverse_subpath'} + +manage_options = ( +{'label':'Edit', 'action':'pt_editForm', + 'help': ('PageTemplates', 'PageTemplate_Edit.stx')}, +{'label':'Test', 'action':'ZScriptHTML_tryForm'}, +) + PropertyManager.manage_options \ ++ Historical.manage_options \ ++ SimpleItem.manage_options \ ++ Cacheable.manage_options + + +_properties=({'id':'title', 'type': 'ustring', 'mode': 'w'}, + {'id':'content_type', 'type':'string', 'mode': 'w'}, + {'id':'expand', 'type':'boolean', 'mode': 'w'}, + ) + +security = AccessControl.ClassSecurityInfo() +security.declareObjectProtected(view) +security.declareProtected(view, '__call__') + +def __init__(self, id, text=None, content_type=None, encoding='utf-8'): +self.id = id +self.ZBindings_edit(self._default_bindings) +self.pt_edit(text, content_type, encoding) + +security.declareProtected(change_page_templates, 'pt_encoding') +def pt_encoding(self): +encoding = sniffEncoding(self.read()) +return encoding + +# Use the encoding of the document as encoding for the ZMI to +# avoid any kind of encoding troubles +from ComputedAttribute import ComputedAttribute +management_page_charset = ComputedAttribute(pt_encoding, 1) + +security.declareProtected(change_page_templates, 'pt_edit') +def pt_edit(self, text, content_type,
[Zope-Checkins] SVN: Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py This version is now fully functional and without dependencies from Products.PageTemplates
Log message for revision 40698: This version is now fully functional and without dependencies from Products.PageTemplates Changed: U Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py D Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py.scary -=- Modified: Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py === --- Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py 2005-12-11 11:21:09 UTC (rev 40697) +++ Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py 2005-12-11 12:02:36 UTC (rev 40698) @@ -16,36 +16,41 @@ __version__='$Revision: 1.48 $'[11:-2] import re -from urllib import quote -import os, AccessControl, Acquisition +import os +import Acquisition from Globals import ImageFile, package_home, InitializeClass from OFS.SimpleItem import SimpleItem from OFS.content_types import guess_content_type from DateTime.DateTime import DateTime from Shared.DC.Scripts.Script import Script from Shared.DC.Scripts.Signature import FuncCode -from AccessControl import getSecurityManager from OFS.History import Historical, html_diff from OFS.Cache import Cacheable from OFS.Traversable import Traversable from OFS.PropertyManager import PropertyManager -from Products.PageTemplates.Expressions import SecureModuleImporter -from Products.PageTemplates.PageTemplateFile import PageTemplateFile - -from AccessControl import Unauthorized +from AccessControl import getSecurityManager, safe_builtins, ClassSecurityInfo from AccessControl.Permissions import view, ftp_access, change_page_templates, view_management_screens from webdav.Lockable import ResourceLockedError from webdav.WriteLockInterface import WriteLockInterface - from zope.pagetemplate.pagetemplate import PageTemplate -#from zope.pagetemplate.pagetemplatefile import PageTemplateFile # regular expression to extract the encoding from the XML preamble encoding_reg= re.compile('\?xml.*?encoding=(.*?).*?\?', re.M) + +class SecureModuleImporter: +__allow_access_to_unprotected_subobjects__ = 1 +def __getitem__(self, module): +mod = safe_builtins['__import__'](module) +path = module.split('.') +for name in path[1:]: +mod = getattr(mod, name) +return mod + + class Src(Acquisition.Explicit): I am scary code @@ -64,6 +69,7 @@ def sniffEncoding(text, default_encoding='utf-8'): try to determine the encoding from html or xml +# XXX: look at pagetemplates.py (BOM!!!) if text.startswith('?xml'): mo = encoding_reg.search(text) if mo: @@ -101,12 +107,13 @@ {'id':'expand', 'type':'boolean', 'mode': 'w'}, ) -security = AccessControl.ClassSecurityInfo() +security = ClassSecurityInfo() security.declareObjectProtected(view) security.declareProtected(view, '__call__') def __init__(self, id, text=None, content_type=None, encoding='utf-8'): self.id = id +self.expand = 0 self.ZBindings_edit(self._default_bindings) self.pt_edit(text, content_type, encoding) @@ -124,15 +131,8 @@ def pt_edit(self, text, content_type, encoding='utf-8'): text = text.strip() -#if content_type == 'text/html': -#if not text.startswith('?xml'): -## not XHTML - convert it to unicode -#text = unicode(text, encoding) - if not isinstance(text, unicode): text = unicode(text, encoding) - -print content_type, type(text),repr(text) self.ZCacheable_invalidate() PageTemplate.pt_edit(self, text, content_type) @@ -238,7 +238,7 @@ 'options': {}, 'root': root, 'request': getattr(root, 'REQUEST', None), - 'modules': SecureModuleImporter, + 'modules': SecureModuleImporter(), } return c @@ -258,7 +258,7 @@ except AttributeError: pass -security=getSecurityManager() +security = AccessControl.getSecurityManager() bound_names['user'] = security.getUser() # Retrieve the value from the cache. @@ -332,6 +332,9 @@ def document_src(self, REQUEST=None, RESPONSE=None): Return expanded document source. +print 'src', self.read() + + if RESPONSE is not None: RESPONSE.setHeader('Content-Type', 'text/plain') if REQUEST is not None and REQUEST.get('raw'): @@ -363,15 +366,10 @@ def wl_isLocked(self): return 0 -security.declareProtected(view_management_screens, 'source_dot_xml') +security.declareProtected(view_management_screens, 'getSource') +getSource = Src() source_dot_xml = Src() -security.declareProtected(view_management_screens, 'pt_editForm') -pt_editForm = PageTemplateFile('pt/ptEdit.pt', globals()) -
[Zope-Checkins] SVN: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PageTemplateFile.py added
Log message for revision 40700: added Changed: A Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PageTemplateFile.py -=- Added: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PageTemplateFile.py === --- Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PageTemplateFile.py 2005-12-11 12:53:04 UTC (rev 40699) +++ Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PageTemplateFile.py 2005-12-11 13:08:03 UTC (rev 40700) @@ -0,0 +1,31 @@ + +import os + +from Globals import package_home, InitializeClass +from ZopePageTemplate import ZopePageTemplate + +class PageTemplateFile(ZopePageTemplate): + +def __init__(self, filename, _prefix=None, **kw): +self.ZBindings_edit(self._default_bindings) +if _prefix is None: +_prefix = getConfiguration().softwarehome +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.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) + +ZopePageTemplate.__init__(self, os.path.basename(self.filename), open(self.filename).read(), 'text/html') + + +InitializeClass(PageTemplateFile) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/P removed
Log message for revision 40701: removed Changed: D Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PathIterator.py D Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PythonExpr.py -=- Deleted: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PathIterator.py === --- Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PathIterator.py 2005-12-11 13:08:03 UTC (rev 40700) +++ Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PathIterator.py 2005-12-11 13:09:25 UTC (rev 40701) @@ -1,46 +0,0 @@ -## -# -# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (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 -# -## - -Path Iterator - -A TALES Iterator with the ability to use first() and last() on -subpaths of elements. - - -__version__='$Revision: 1.4 $'[11:-2] - -import TALES -from Expressions import restrictedTraverse, Undefs, getSecurityManager - -class Iterator(TALES.Iterator): -def __bobo_traverse__(self, REQUEST, name): -if name in ('first', 'last'): -path = REQUEST['TraversalRequestNameStack'] -names = list(path) -names.reverse() -path[:] = [tuple(names)] -return getattr(self, name) - -def same_part(self, name, ob1, ob2): -if name is None: -return ob1 == ob2 -if isinstance(name, type('')): -name = name.split('/') -name = filter(None, name) -securityManager = getSecurityManager() -try: -ob1 = restrictedTraverse(ob1, name, securityManager) -ob2 = restrictedTraverse(ob2, name, securityManager) -except Undefs: -return 0 -return ob1 == ob2 Deleted: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PythonExpr.py === --- Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PythonExpr.py 2005-12-11 13:08:03 UTC (rev 40700) +++ Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PythonExpr.py 2005-12-11 13:09:25 UTC (rev 40701) @@ -1,86 +0,0 @@ -## -# -# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (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 -# -## - -Generic Python Expression Handler - - -__version__='$Revision: 1.13 $'[11:-2] - -from TALES import CompilerError -from sys import exc_info -from DeferExpr import DeferWrapper - -class getSecurityManager: -'''Null security manager''' -def validate(self, *args, **kwargs): -return 1 -addContext = removeContext = validate - -class PythonExpr: -def __init__(self, name, expr, engine): -self.expr = expr = expr.strip().replace('\n', ' ') -try: -d = {} -exec 'def f():\n return %s\n' % expr.strip() in d -self._f = d['f'] -except: -raise CompilerError, ('Python expression error:\n' - '%s: %s') % exc_info()[:2] -self._get_used_names() - -def _get_used_names(self): -self._f_varnames = vnames = [] -for vname in self._f.func_code.co_names: -if vname[0] not in '$_': -vnames.append(vname) - -def _bind_used_names(self, econtext, _marker=[]): -# Bind template variables -names = {'CONTEXTS': econtext.contexts} -vars = econtext.vars -getType = econtext.getCompiler().getTypes().get -for vname in self._f_varnames: -val = vars.get(vname, _marker) -if val is _marker: -has = val = getType(vname) -if has: -val = ExprTypeProxy(vname, val, econtext) -names[vname] = val -else: -names[vname] = val -for
[Zope-Checkins] SVN: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ cleanup
Log message for revision 40703: cleanup Changed: D Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/CHANGES.txt D Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/examples/ -=- Deleted: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/CHANGES.txt === --- Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/CHANGES.txt 2005-12-11 13:22:40 UTC (rev 40702) +++ Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/CHANGES.txt 2005-12-11 13:23:19 UTC (rev 40703) @@ -1,27 +0,0 @@ -Page Template changes - - This file contains change information for the current release. - Change information for previous versions can be found in the - file HISTORY.txt. - -Version 1.5.0 - - Features Added - -- Error reporting is improved, with line numbers added. - -- In the ZMI, errors are separated from the text and highlighted. - -- A template can be marked explicitly as XML or HTML by giving -it a boolean 'is_html' property. - -- New icon, provided by Michael R. Bernstein. - - Bugs Fixed - -- The starting properties could be deleted. This is only -fixed for new templates. - -- Collector 596 fixed; manage_addPageTemplate can now be - called with a text argument but no REQUEST.form['file']. - E.g. when called via ZPublisher.Client. ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/ajung-zpt-integration/lib/python/TAL/ you're time has come, no longer needed for Z3 ZPTs
Log message for revision 40704: you're time has come, no longer needed for Z3 ZPTs Changed: D Zope/branches/ajung-zpt-integration/lib/python/TAL/ -=- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ removed
Log message for revision 40705: removed Changed: D Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ -=- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ made unittests pass
Log message for revision 40706: made unittests pass Changed: U Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ZopePageTemplate.py U Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/pt/ptEdit.pt U Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py -=- Modified: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ZopePageTemplate.py === --- Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ZopePageTemplate.py 2005-12-11 13:56:10 UTC (rev 40705) +++ Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ZopePageTemplate.py 2005-12-11 14:46:00 UTC (rev 40706) @@ -214,7 +214,7 @@ setCookie(dtpref_rows, rows, path='/', expires=e) setCookie(dtpref_cols, cols, path='/', expires=e) REQUEST.other.update({dtpref_cols:cols, dtpref_rows:rows}) -return self.manage_main() +return self.pt_editForm() def ZScriptHTML_tryParams(self): Parameters to test the script with. @@ -242,7 +242,7 @@ } return c -security.declareProtected(view_management_screens, 'manage_main', 'read', +security.declareProtected(view_management_screens, 'read', 'ZScriptHTML_tryForm') def _exec(self, bound_names, args, kw): @@ -331,10 +331,6 @@ security.declareProtected(view_management_screens, 'document_src') def document_src(self, REQUEST=None, RESPONSE=None): Return expanded document source. - -print 'src', self.read() - - if RESPONSE is not None: RESPONSE.setHeader('Content-Type', 'text/plain') if REQUEST is not None and REQUEST.get('raw'): @@ -399,11 +395,11 @@ ZopePageTemplate.pt_editForm = FSZPT('pt_editForm', os.path.join(package_home(globals()),'pt', 'ptEdit.pt')) # this is scary, do we need this? -ZopePageTemplate.manage = ZopePageTemplate.manage_main = ZopePageTemplate.pt_editForm +ZopePageTemplate.manage = ZopePageTemplate.pt_editForm manage_addPageTemplateForm= FSZPT('manage_addPageTemplateForm', os.path.join(package_home(globals()), 'pt', 'ptAdd.pt')) -def manage_addPageTemplate(self, id, title='', file=None, encoding='utf-8', submit=None, RESPONSE=None): +def manage_addPageTemplate(self, id, title='', text=None, file=None, encoding='utf-8', submit=None, REQUEST=None, RESPONSE=None): Add a Page Template with optional file content. if file: @@ -411,8 +407,23 @@ text = file.read() encoding = sniffEncoding(text) content_type, dummy = guess_content_type(filename, text) +elif REQUEST and REQUEST.has_key('file'): +f = REQUEST['file'] +filename = f.filename +text = f.read() +encoding = sniffEncoding(text) +headers = getattr(f, 'headers') +if headers.has_key('content_type'): +content_type = headers['content_type'] +else: +content_type, dummy = guess_content_type(filename, text) + else: -text = open(_default_content_fn).read() +if hasattr(text, 'read'): # assume file +text= text.read() +if text is None: +text = '' +text = text or open(_default_content_fn).read() encoding = 'utf-8' content_type = 'text/html' @@ -423,7 +434,7 @@ if RESPONSE: if submit == Add and Edit : -RESPONSE.redirect(zpt.absolute_url() + '/manage_main') +RESPONSE.redirect(zpt.absolute_url() + '/pt_editForm') else: RESPONSE.redirect(self.absolute_url() + '/manage_main') else: Modified: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/pt/ptEdit.pt === --- Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/pt/ptEdit.pt 2005-12-11 13:56:10 UTC (rev 40705) +++ Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/pt/ptEdit.pt 2005-12-11 14:46:00 UTC (rev 40706) @@ -53,7 +53,7 @@ tr td align=left valign=middle class=form-labelEncoding/td td - input type=text readonly name=encoding tal:attributes=value context/pt_encoding/ + input type=text readonly name=encoding tal:attributes=value context/pt_encoding style=background-color: #bb; / /td /tr Modified: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py === --- Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2005-12-11 13:56:10 UTC (rev 40705) +++ Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2005-12-11 14:46:00 UTC (rev 40706) @@ -12,6 +12,7 @@ import
[Zope-Checkins] SVN: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PageTemplateFile.py some more comments
Log message for revision 40707: some more comments Changed: U Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PageTemplateFile.py -=- Modified: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PageTemplateFile.py === --- Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PageTemplateFile.py 2005-12-11 14:46:00 UTC (rev 40706) +++ Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/PageTemplateFile.py 2005-12-11 15:03:29 UTC (rev 40707) @@ -1,3 +1,15 @@ +## +# +# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (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 +# +## import os @@ -2,4 +14,9 @@ from Globals import package_home, InitializeClass +from App.config import getConfiguration from ZopePageTemplate import ZopePageTemplate +# XXX: this needs some more work..this class is *not* used by the +# ZopePageTemplate implementation but most likely only for class +# using PTs for edit/add forms etc. Also the tests don't pass + class PageTemplateFile(ZopePageTemplate): ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins