Skip to content

Commit

Permalink
Merged CacheManagement_branch and added help topics.
Browse files Browse the repository at this point in the history
  • Loading branch information
hathawsh committed Dec 12, 2000
1 parent d343ac9 commit 27344d4
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions DT_String.py
Expand Up @@ -82,7 +82,7 @@
# attributions are listed in the accompanying credits file.
#
##############################################################################
"$Id: DT_String.py,v 1.38 2000/09/01 14:00:41 brian Exp $"
"$Id: DT_String.py,v 1.39 2000/12/12 21:20:25 shane Exp $"

from string import split, strip
import regex, ts_regex
Expand All @@ -91,7 +91,7 @@
from DT_Var import Var, Call, Comment
from DT_Return import ReturnTag, DTReturn


_marker = [] # Create a new marker object.

class String:
"""Document templates defined from strings.
Expand Down Expand Up @@ -418,6 +418,14 @@ def initvars(self, globals, vars):
self.globals=vars
self._vars={}

ZDocumentTemplate_beforeRender__roles__ = ()
def ZDocumentTemplate_beforeRender(self, md, default):
return default

ZDocumentTemplate_afterRender__roles__ = ()
def ZDocumentTemplate_afterRender(self, md, result):
pass

def __call__(self,client=None,mapping={},**kw):
'''\
Generate a document from a document template.
Expand Down Expand Up @@ -525,8 +533,14 @@ def __call__(self,client=None,mapping={},**kw):
pushed=pushed+1

try:
try: return render_blocks(self._v_blocks, md)
except DTReturn, v: return v.v
value = self.ZDocumentTemplate_beforeRender(md, _marker)
if value is _marker:
try: result = render_blocks(self._v_blocks, md)
except DTReturn, v: result = v.v
self.ZDocumentTemplate_afterRender(md, result)
return result
else:
return value
finally:
if pushed: md._pop(pushed) # Get rid of circular reference!
md.level=level # Restore previous level
Expand Down

0 comments on commit 27344d4

Please sign in to comment.