Skip to content
This repository has been archived by the owner on Dec 17, 2020. It is now read-only.

Commit

Permalink
- added support for TAL debug flags
Browse files Browse the repository at this point in the history
  • Loading branch information
jukart committed Nov 5, 2008
1 parent d95e8a7 commit c9ffa8c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
CHANGES
=======

- added support for TAL debug flags

0.3.2 (2007-11-01)
------------------

Expand Down
11 changes: 11 additions & 0 deletions src/z3c/viewtemplate/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ Now we register a new template on the specific interface of our view.
>>> print view()
<div>IMyView</div>

We can also render the view with debug flags set.

>>> request.debug.sourceAnnotations = True
>>> print view()
<!--
==============================================================================
.../myViewTemplate.pt
==============================================================================
--><div>IMyView</div>
>>> request.debug.sourceAnnotations = False

It is possible to provide the template directly.

We create a new template.
Expand Down
14 changes: 11 additions & 3 deletions src/z3c/viewtemplate/macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,17 @@ def __call__(self, *args, **kwargs):
self.request,
options=kwargs)
context = self.template.pt_getEngineContext(namespace)
TALInterpreter(program, None,
context, output, tal=True, showtal=False,
strictinsert=0, sourceAnnotations=False)()
debug_flags = self.request.debug
TALInterpreter(
program,
None,
context,
output,
tal=True,
showtal=getattr(debug_flags, 'showTAL', 0),
strictinsert=0,
sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
)()
if not self.request.response.getHeader("Content-Type"):
self.request.response.setHeader("Content-Type",
self.contentType)
Expand Down

0 comments on commit c9ffa8c

Please sign in to comment.