[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/PageTemplate/tests/testpackage - __init__.py:1.1.2.1 content.py:1.1.2.1 view.pt:1.1.2.1
Jim Fulton
jim@zope.com
Thu, 23 May 2002 14:01:16 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/PageTemplate/tests/testpackage
In directory cvs.zope.org:/tmp/cvs-serv26429/lib/python/Zope/App/PageTemplate/tests/testpackage
Added Files:
Tag: Zope-3x-branch
__init__.py content.py view.pt
Log Message:
This all started with wanting to be able to use url;view in a ZPT path. :)
That lead me to:
- Massive traversal refactoring.
Namespace handling is now centralized in Zope.App.Traversing.
- ZPT refactoring, including some renaming that touches pretty much everything. :)
- The application specific ZPT support was moved into
Zope.App.PageTemplate.
- To get page template files (for use in views):
from Zope.App.PageTemplate import ViewPageTemplateFile
- Fixed up security so that ZPT expressions only have access to
safe builtins and so that modules namespace does imports safely.
- Got ZPTPage working!
- renaming url to absolute_url and got absolute_url to work in paths.
- Cleaned up the (as yet unused) RestrictedInterpreter module in
Zope.Security. In particular, changed to use a separate
RestrictedBuiltins module.
=== Added File Zope3/lib/python/Zope/App/PageTemplate/tests/testpackage/__init__.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
#
##############################################################################
"""Sample content for testing."""
=== Added File Zope3/lib/python/Zope/App/PageTemplate/tests/testpackage/content.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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 Zope.App.PageTemplate import ViewPageTemplateFile
class Content:
def getSomething(self):
return 42
class PTComponent(object):
def __init__(self, content):
self.__content = content
def getContext(self):
return self.__content
index = ViewPageTemplateFile("view.pt")
=== Added File Zope3/lib/python/Zope/App/PageTemplate/tests/testpackage/view.pt ===
<span tal:replace="context/getSomething"/>