############################################################################## # # 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 from logging import getLogger import AccessControl from Globals import package_home, InitializeClass, DevelopmentMode from App.config import getConfiguration from Acquisition import aq_parent, aq_inner from ComputedAttribute import ComputedAttribute from OFS.SimpleItem import SimpleItem from OFS.Traversable import Traversable from Shared.DC.Scripts.Script import Script from Shared.DC.Scripts.Signature import FuncCode from Products.PageTemplates.Expressions import SecureModuleImporter from Products.PageTemplates.PageTemplate import PageTemplate from zope.contenttype import guess_content_type from zope.pagetemplate.pagetemplatefile import sniff_type LOG = getLogger('PageTemplateFile') def guess_type(filename, text): # check for XML ourself since guess_content_type can't # detect text/xml if 'filename' won't end with .xml # XXX: fix this in zope.contenttype if text.startswith('