[Zope] Custom Tag Creation <dtml-nocache>

tonyr@ep.newtimes.com tonyr@ep.newtimes.com
Thu, 16 Dec 1999 16:29:16 -0700


I'm looking into modifying ZCache Product by adding a <dtml-nocache> tag
that would exclude some elements of a domument from being
parsed/resolved/published (whichever is correct terminology), for pages
that are bing cached.  The latest version ov ZCache marshals to the FS
and them unmarshals the content back.  I'm tying to marshal these
documents in a partially completed state and them when unmarshaling them
complete the nocached elements and return a completed document.

My first attempt at a tag to accomplish this was to cPickle the "blocks"
given to the tag's __init__ method, then to uncPickle them when the tag
was called again from the ZCache Product.  This works.  The problem I
have is in rerendering the previously pickled portion of the document. 
Inside ZCache I'm calling DocumentTemplate.HTML to rerender the
previously pickled content retrieved from the FS as a string.  This
string retrieved in ZCache is self._v_cache.  Here is a snip of code
(out of ZCache) I'm using to rerender the object:

def index_html(self, REQUEST, RESPONSE)
  ...
  newObj = HTML(self._v_cache,mapping=globals())
  newObj = newObj(REQUEST)
  ...
   RESPONSE.write(newObj)


My problem is the content between the <dtml-nocache> </dtml-nocache>
tags can not reference any of the standard Zope objects / properties
(like ZopeTime, id, etc).  I'm guessing I need something other than
REQUEST and/or globals() to get the proper Zope environment passed over
to the HTML object.

A secondary problem I believe I'm seeing is the inablility to cPickle
DTML expressions.  I was originally hopping the get the actual un
processed DTML between my nocache tags but it appears the tag calls are
handed a partially processed list of some sort.  Does anyone know of a
way to get the contents between tags rather than the list of
sections/blocks???  This would remove my need to pickle the list and I
would be able to just process the previously unprocessed portion of
DTML.

RECAP
=========================
1.    Is there any way obtain a tags raw content?

2.     What is the prefered way of reprocessing Zope DTML content?  
            -render_blocks(section,md) or some other method.

3.    Does anyone know of some custom tags that I may use for
reference 		points?  tsarna's Calendar tag has helped greatly as an
example of what it takes to write a tag.




-- 
-------------------------------
tonyr@ep.newtimes.com
Director of Web Technology
Newtimes Inc.
-------------------------------