[ZPT] My PageTemplateFile first cut

richard@bizarsoftware.com.au richard@bizarsoftware.com.au
Thu, 05 Apr 2001 10:25:08 +1000


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

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...


    Richard

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

aW1wb3J0IG9zCmltcG9ydCBHbG9iYWxzCmZyb20gQWNxdWlzaXRpb24gaW1wb3J0IEltcGxp
Y2l0CmZyb20gUGVyc2lzdGVuY2UgaW1wb3J0IFBlcnNpc3RlbnQKZnJvbSBQcm9kdWN0cy5Q
YWdlVGVtcGxhdGVzLlBhZ2VUZW1wbGF0ZSBpbXBvcnQgUGFnZVRlbXBsYXRlCgpjbGFzcyBQ
YWdlVGVtcGxhdGVGaWxlKFBhZ2VUZW1wbGF0ZSwgSW1wbGljaXQsIFBlcnNpc3RlbnQpOgog
ICAgJycnIHdvb3QsIHBhZ2UgdGVtcGxhdGVzCiAgICAnJycKICAgIF92X2xhc3RfcmVhZD0w
CgogICAgZGVmIF9faW5pdF9fKHNlbGYsIGZpbGVuYW1lKToKICAgICAgICBzZWxmLmZpbGVu
YW1lID0gZmlsZW5hbWUKICAgICAgICBzZWxmLnB0X2VkaXQob3BlbihmaWxlbmFtZSksICd0
ZXh0L2h0bWwnKQogICAgICAgIHNlbGYuX3ZfbGFzdF9yZWFkID0gb3Muc3RhdChmaWxlbmFt
ZSlbOF0KCiAgICBkZWYgX2Nvb2tfY2hlY2soc2VsZik6CiAgICAgICAgbXRpbWUgPSBvcy5z
dGF0KHNlbGYuZmlsZW5hbWUpWzhdCiAgICAgICAgaWYgbXRpbWUgIT0gc2VsZi5fdl9sYXN0
X3JlYWQ6CiAgICAgICAgICAgIHNlbGYucHRfZWRpdChvcGVuKHNlbGYuZmlsZW5hbWUpLCAn
dGV4dC9odG1sJykKICAgICAgICAgICAgc2VsZi5fdl9sYXN0X3JlYWQgPSBtdGltZQoKICAg
IGRlZiBfX2NhbGxfXyhzZWxmLCBvYmosIFJFUVVFU1QsICoqa3dhcmdzKToKICAgICAgICAn
Jycgd29vdCwgcGFnZSB0ZW1wbGF0ZXMKICAgICAgICAnJycKICAgICAgICBzZWxmLl9jb29r
KCkKICAgICAgICBpZiBHbG9iYWxzLkRldmVsb3BtZW50TW9kZToKICAgICAgICAgICAgc2Vs
Zi5fY29va19jaGVjaygpCiAgICAgICAgaWYgbm90IGt3YXJncy5oYXNfa2V5KCdhcmdzJyk6
CiAgICAgICAgICAgIGt3YXJnc1snYXJncyddID0gKG9iaiwgKQogICAgICAgIHJldHVybiBz
ZWxmLnB0X3JlbmRlcihleHRyYV9jb250ZXh0PXsnb3B0aW9ucyc6IGt3YXJncywKICAgICAg
ICAgICAgJ3JlcXVlc3QnOiBSRVFVRVNUfSkKCg==
--------------BF1CF372069378FB2933B0D6--