[ZPT] My PageTemplateFile first cut

richard@bizarsoftware.com.au richard@bizarsoftware.com.au
Thu, 05 Apr 2001 14:26:27 +1000


This is a multi-part message in MIME format.
--------------D5B3B1621DDE6AFCBB5FF1C7
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

richard@bizarsoftware.com.au wrote:
> Here's a first cut at a PageTemplateFile class. This is intended to
> integrate seamlessly into our existing Product, which it does pretty well.
> In order to have that seamless integration, I had to modify the __call__
> signature and handling so it reflected (HTML|DTML)File. What's the call
> here? If the REQUEST object is put into extra_content as the 'options'
> tuple - as is the case with the PageTemplate.__call__ method - it doesn't
> seem to be assigned to the 'request' attribute. There's no code in
> PageTemplate or TALES to do it that I can see...

I've made a change so that the template is rendered on the correct object
(the 'here' object is now the same as the 'client' argument in DT_String
terminology).


   Richard

-- 
Richard Jones
richard@bizarsoftware.com.au
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)
--------------D5B3B1621DDE6AFCBB5FF1C7
Content-Type: application/octet-stream;
 name="PageTemplateFile.py"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="PageTemplateFile.py"

aW1wb3J0IG9zCmltcG9ydCBHbG9iYWxzCmZyb20gQWNxdWlzaXRpb24gaW1wb3J0IEltcGxp
Y2l0CmZyb20gUGVyc2lzdGVuY2UgaW1wb3J0IFBlcnNpc3RlbnQKZnJvbSBQcm9kdWN0cy5Q
YWdlVGVtcGxhdGVzLlBhZ2VUZW1wbGF0ZSBpbXBvcnQgUGFnZVRlbXBsYXRlCgpjbGFzcyBQ
YWdlVGVtcGxhdGVGaWxlKFBhZ2VUZW1wbGF0ZSwgSW1wbGljaXQsIFBlcnNpc3RlbnQpOgog
ICAgJycnIHdvb3QsIHBhZ2UgdGVtcGxhdGVzCiAgICAnJycKICAgIF92X2xhc3RfcmVhZD0w
CgogICAgZGVmIF9faW5pdF9fKHNlbGYsIGZpbGVuYW1lKToKICAgICAgICBzZWxmLmZpbGVu
YW1lID0gZmlsZW5hb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