Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
fb271802
Commit
fb271802
authored
May 21, 2006
by
Philipp von Weitershausen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More API BBB: Provide hook (pt_macros) for subclasses to do stuff when
macro access happens.
parent
9a829cef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
lib/python/Products/PageTemplates/PageTemplate.py
lib/python/Products/PageTemplates/PageTemplate.py
+21
-6
No files found.
lib/python/Products/PageTemplates/PageTemplate.py
View file @
fb271802
...
...
@@ -17,6 +17,8 @@ $Id$
import
sys
import
ExtensionClass
import
zope.pagetemplate.pagetemplate
from
zope.pagetemplate.pagetemplate
import
PTRuntimeError
from
zope.pagetemplate.pagetemplate
import
PageTemplateTracebackSupplement
from
zope.tales.expressions
import
SimpleModuleImporter
from
Products.PageTemplates.Expressions
import
getEngine
...
...
@@ -31,13 +33,11 @@ zope.deprecation.deprecated(
"to zope.pagetemplate.pagetemplate.SimpleModuleImporter (this is a "
"class, not an instance)."
)
import
zope.deferredimport
zope
.
deferredimport
.
deprecatedFrom
(
"
It
has moved to zope.pagetemplate.pagetemplate. This reference will "
zope
.
deprecation
.
deprecated
(
(
'PTRuntimeError'
,
'PageTemplateTracebackSupplement'
),
"Zope 2 uses the Zope 3 ZPT engine now. The object you're importing "
"has moved to zope.pagetemplate.pagetemplate. This reference will "
"be gone in Zope 2.12."
,
'zope.pagetemplate.pagetemplate'
,
'PTRuntimeError'
,
'PageTemplateTracebackSupplement'
)
##############################################################################
...
...
@@ -65,6 +65,21 @@ class PageTemplate(ExtensionClass.Base,
c
[
'root'
]
=
self
return
c
@
property
def
macros
(
self
):
return
self
.
pt_macros
()
# sub classes may override this to do additional stuff for macro access
def
pt_macros
(
self
):
self
.
_cook_check
()
if
self
.
_v_errors
:
__traceback_supplement__
=
(
PageTemplateTracebackSupplement
,
self
,
{})
raise
PTRuntimeError
,
(
'Page Template %s has errors: %s'
%
(
self
.
id
,
self
.
_v_errors
))
return
self
.
_v_macros
# these methods are reimplemented or duplicated here because of
# different call signatures in the Zope 2 world
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment