From mail@peterbe.com Wed Aug 1 13:38:50 2001 From: mail@peterbe.com (Peter Bengtsson) Date: Wed, 1 Aug 2001 14:38:50 +0200 Subject: [ZPT] suggestion: content and/or silent repeat References: <001701c11936$bba0f1e0$aa6d1c3f@workstation> Message-ID: <012f01c11a86$ecd89000$1c64a8c0@PBN> > > > > > > > > > > > > > > > > > > >
#IdMeta-TypeTitle
#IdMeta-TypeTitle
#IdMeta-TypeTitle
> > This seems surprisingly clunky for the graceful ZPT system--it produces > multiple tbody groupings incorrectly. I personally think this is very good piece of code. Somewhat clunky with the too odd/even conditions but cool if you open the code in Dreamweaver. But, like you said "forgive a newbie" Cheers, Peter From Gary & Karyn" <012f01c11a86$ecd89000$1c64a8c0@PBN> Message-ID: <002101c11a89$43fbc620$b04079a5@workstation> > I personally think this is very good piece of code. > Somewhat clunky with the too odd/even conditions but cool if you open the > code in Dreamweaver. > > But, like you said "forgive a newbie" > > Cheers, Peter Hi, Peter. Thanks for your response. Did you happen to read my follow-up to Magnus Heino, who also questioned my questioning via a W3C link? My point is that the repetition of the tbody tags that this code produces is no kind of logical table body grouping, and thus IMHO is sliding towards the direction of hack. As Magnus pointed out, it is valid HTML, within the letter of the W3C "law". However, I feel it unnecessarily breaks the spirit of the law by once again moving towards the direction of using logical markup tags in the name of display--something we are only now beginning to conquer elsewhere (i.e. moving away from table tags for display, font tags, etc.) thanks to the more widespread decent support of CSS in current browsers. I understand your point about the two odd/even conditions but also see where the ZPT designers are coming from: a lack of full-fledged control structures in a templating language will encourage better separation of content, logic, and presentation. Thanks Gary From mail@peterbe.com Wed Aug 1 15:05:53 2001 From: mail@peterbe.com (Peter Bengtsson) Date: Wed, 1 Aug 2001 16:05:53 +0200 Subject: [ZPT] suggestion: content and/or silent repeat References: <001701c11936$bba0f1e0$aa6d1c3f@workstation> <012f01c11a86$ecd89000$1c64a8c0@PBN> <002101c11a89$43fbc620$b04079a5@workstation> Message-ID: <003201c11a9b$470c5c50$1c64a8c0@PBN> > I understand your point about the two odd/even conditions but also see where > the ZPT designers are coming from: a lack of full-fledged control structures > in a templating language will encourage better separation of content, logic, > and presentation. Like I said to my collegues after being asked to investigate ZPT. "it's syntax is cleared and namespaces aren't mangled like in DTML, the way they work force you to write proper HTML (so our page will many almost work in Netscape), plus it's nifty that you can open them in Dreamweaver" Those were my reasons for why ZPT is "better" than DTML. From Gary & Karyn" <012f01c11a86$ecd89000$1c64a8c0@PBN> <002101c11a89$43fbc620$b04079a5@workstation> <003201c11a9b$470c5c50$1c64a8c0@PBN> Message-ID: <00d901c11aa0$5f6f3e20$b04079a5@workstation> > Those were my reasons for why ZPT is "better" than DTML. Heartily agreed. :-) Gary From Georges J Baladi Jr" This is a multi-part message in MIME format. ------=_NextPart_000_017D_01C11AB9.06222EE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I am not sure if exists some kind of retrieve proprierts from the parent = folder object when using ZPT. Some example (my english is not very = good!): root (title aaa) index_html (my page template) folder1 (title xxx) folder2 (title yyy) folder3 (title zzz) if I call /folder1/foilder2/folder3 and the page template has this code: The title This is Page Template template id. I will have: This is Page Template aaa. If I replace container/title with here/title I will have: This is Page = Template zzz. But, if I want something like: "This is Page Template yyy" I can=B4t use = request/URL2/title. I am using some python code to retrieve the needed = value, but I sugest something like: here/parent/title or parent/title. Thanks, Georges Baladi ------=_NextPart_000_017D_01C11AB9.06222EE0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
 
I am not sure if exists some kind of = retrieve=20 proprierts from the parent folder object when using ZPT. Some example = (my=20 english is not very good!):
 
root (title aaa)
  index_html (my page = template)
  folder1 (title xxx)
     folder2 (title = yyy)
        =20 folder3 (title zzz)
 
 
if I call /folder1/foilder2/folder3 and = the page=20 template has this code:
 
<html>
 =20 <head>
    <title>The=20 title</title>
  </head>
 =20 <body>
        This is Page = Template=20 <em
    tal:content=3D"container/title">template = id</em>.
  </body>
</html>
 
I will have: This is Page Template=20 aaa.
 
If I replace container/title with = here/title I will=20 have: This is Page Template zzz.
 
But, if I want something like: "This is = Page=20 Template yyy" I can=B4t use request/URL2/title. I am using some python = code to=20 retrieve the needed value, but I sugest something like: = here/parent/title or=20 parent/title.
 
Thanks,
 
Georges = Baladi
 
------=_NextPart_000_017D_01C11AB9.06222EE0-- From evan@zope.com Wed Aug 1 22:47:38 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 01 Aug 2001 17:47:38 -0400 Subject: [ZPT] Here Parent References: <018001c11ad2$2e378790$0901a8c0@intranet.madisoncomunicacao.com.br> Message-ID: <3B6878FA.90508@zope.com> Georges J Baladi Jr wrote: > But, if I want something like: "This is Page Template yyy" I can´t use > request/URL2/title. I am using some python code to retrieve the needed > value, but I sugest something like: here/parent/title or parent/title. Try "here/aq_parent/title". Cheers, Evan @ Zope From tino@wildenhain.de Thu Aug 2 12:44:08 2001 From: tino@wildenhain.de (Tino Wildenhain) Date: Thu, 02 Aug 2001 13:44:08 +0200 Subject: [ZPT] Here Parent In-Reply-To: <018001c11ad2$2e378790$0901a8c0@intranet.madisoncomunicacao.com.br> References: <018001c11ad2$2e378790$0901a8c0@intranet.madisoncomunicacao.com. br> Message-ID: <18409674.996759848@BUZZER> Hi Georges, I would have no use for this and may be others also dont. So if you need it, you can make an PythonScript named parent like this in the root: return(container.REQUEST.PARENTS[-1:0][0]) and call it: here/parent/title Regards Tino --On Mittwoch, 1. August 2001 18:37 -0300 Georges J Baladi Jr=20 wrote: > > Hi, > > I am not sure if exists some kind of retrieve proprierts from the parent > folder object when using ZPT. Some example (my english is not very > good!): > root (title aaa) > index_html (my page template) > folder1 (title xxx) > folder2 (title yyy) > folder3 (title zzz) > > > if I call /folder1/foilder2/folder3 and the page template has this code: > > > > The title > > > This is Page Template tal:content=3D"container/title">template id. > > > > > I will have: This is Page Template aaa. > > If I replace container/title with here/title I will have: This is Page > Template zzz. > But, if I want something like: "This is Page Template yyy" I can=B4t use > request/URL2/title. I am using some python code to retrieve the needed > value, but I sugest something like: here/parent/title or parent/title. > Thanks, > > Georges Baladi > From tony.mcdonald@ncl.ac.uk Sun Aug 5 22:07:36 2001 From: tony.mcdonald@ncl.ac.uk (Tony McDonald) Date: Sun, 05 Aug 2001 22:07:36 +0100 Subject: [ZPT] Problems with authenticating macros Message-ID: Hi, I have a structure /medfac acl_users (UserDB) index_html (PT) standard_look_and_feel (PT) Index_html uses standard_look_and_feel Standard_look_and_feel has the 'View' permission off on 'Acquire permission' and on for 'Authenticated'. Thing is when I try to get through to /medfac/ (and by implication, load up index_html) I get this error (without getting the login box); Error Type: Undefined Error Value: "You are not authorized to access standard_look_and_feel." not found in "here/standard_look_and_feel/macros/master" With this traceback Do PageTemplates work differently wrt authentication? This is src Zope 2.4.0 on Solaris. Cheers Tone. -- Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/ The Medical School, Newcastle University Tel: +44 191 243 6140 A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope From tony.mcdonald@ncl.ac.uk Mon Aug 6 09:49:24 2001 From: tony.mcdonald@ncl.ac.uk (Tony McDonald) Date: Mon, 06 Aug 2001 09:49:24 +0100 Subject: [ZPT] ZPT does validation of documents? Message-ID: Hi all, Just thought I'd share this with you;
Ok. Compilation is fine. Whereas

Gives a compile-time error Is this because METAL (or TAL) is doing some sort of HTML validation? Tone -- Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/ The Medical School, Newcastle University Tel: +44 191 243 6140 A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope From tino@wildenhain.de Mon Aug 6 11:50:07 2001 From: tino@wildenhain.de (Tino Wildenhain) Date: Mon, 06 Aug 2001 12:50:07 +0200 Subject: [ZPT] ZPT does validation of documents? In-Reply-To: References: Message-ID: <14640118.997102207@BUZZER> Hi Tony, of course it does. Its because TAL needs an impression of what tag encloses which block. Regards Tino --On Montag, 6. August 2001 09:49 +0100 Tony McDonald wrote: > Hi all, > Just thought I'd share this with you; > >
>
    >
  • >
>
> > Ok. Compilation is fine. > > Whereas > >

>

    >
  • >
>

> > Gives a compile-time error > > > > Is this because METAL (or TAL) is doing some sort of HTML validation? > > Tone > -- > Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/ > The Medical School, Newcastle University Tel: +44 191 243 6140 > A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope > > > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt From tony.mcdonald@ncl.ac.uk Mon Aug 6 11:54:12 2001 From: tony.mcdonald@ncl.ac.uk (Tony McDonald) Date: Mon, 06 Aug 2001 11:54:12 +0100 Subject: [ZPT] ZPT does validation of documents? In-Reply-To: <14640118.997102207@BUZZER> Message-ID: On 6/8/01 11:50 am, "Tino Wildenhain" wrote: > Hi Tony, > > of course it does. Its because TAL needs an impression > of what tag encloses which block. > > Regards > Tino Cheers Tino, Is there nothing TAL/METAL can't do - I'll find out next that it washes whiter and repairs bad credit ratings next! :) Tone. -- Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/ The Medical School, Newcastle University Tel: +44 191 243 6140 A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope From phil.harris@zope.co.uk Mon Aug 6 12:21:30 2001 From: phil.harris@zope.co.uk (Phil Harris) Date: Mon, 6 Aug 2001 12:21:30 +0100 Subject: [ZPT] ZPT does validation of documents? References: Message-ID: <002501c11e69$f20c0d40$0102a8c0@typhoon> Tone, Nothing will get *your* shirts whiter and your credit rating is so fscked there's no hope ;) Phil > Is there nothing TAL/METAL can't do - I'll find out next that it washes > whiter and repairs bad credit ratings next! :) From rbickers-dated-997772363.53b7fa@logicetc.com Tue Aug 7 07:59:22 2001 From: rbickers-dated-997772363.53b7fa@logicetc.com (Ron Bickers) Date: Tue, 7 Aug 2001 02:59:22 -0400 Subject: [ZPT] dtml-with to ZPT problem Message-ID: I've been ZPT-ing for a couple days now. It's quite different and has taken a bit of patience, but it's nice. I've run into a problem I can't figure out. I have the following DTML method that runs on an RDFSummary object: 'channel' is a PersistentMapping in the RDFSummary object that has, among other things, a 'description'. I can't get this to work in ZPT. I've tried the following:
...gives a "description not found in here/channel/description" error.
...gives an Unauthorized with the following (tailend) traceback: File /home/bickersfam/zope/Products/PageTemplates/ZRPythonExpr.py, line 121, in __call__ (Info: channel['description']) File Python expression "channel['description']", line 2, in f (Object: guarded_getitem) File /usr/local/zope-2.4.0/lib/python/AccessControl/ZopeGuards.py, line 155, in guarded_getitem File /usr/local/zope-2.4.0/lib/python/AccessControl/SecurityManager.py, line 149, in validate File /usr/local/zope-2.4.0/lib/python/AccessControl/ZopeSecurityPolicy.py, line 172, in validate Unauthorized: description I've tried several other variations that seem like the same thing, but no luck. Any ideas? _______________________ Ron Bickers Logic Etc, Inc. From tony.mcdonald@ncl.ac.uk Tue Aug 7 09:46:51 2001 From: tony.mcdonald@ncl.ac.uk (Tony McDonald) Date: Tue, 07 Aug 2001 09:46:51 +0100 Subject: [ZPT] ZPT does validation of documents? In-Reply-To: <002501c11e69$f20c0d40$0102a8c0@typhoon> Message-ID: On 6/8/01 12:21 pm, "Phil Harris" wrote: > Tone, > > Nothing will get *your* shirts whiter and your credit rating is so fscked > there's no hope ;) > > Phil > >> Is there nothing TAL/METAL can't do - I'll find out next that it washes >> whiter and repairs bad credit ratings next! :) Thank you Mr Harris - you'll be hearing from my lawyers... -- Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/ The Medical School, Newcastle University Tel: +44 191 243 6140 A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope From evan@zope.com Tue Aug 7 15:39:48 2001 From: evan@zope.com (Evan Simpson) Date: Tue, 7 Aug 2001 10:39:48 -0400 Subject: [ZPT] CVS: Products/PageTemplates - ZopePageTemplate.py:1.15 Message-ID: <200108071439.f77EdmR21990@cvs.baymountain.com> Update of /cvs-repository/Products/PageTemplates In directory cvs.zope.org:/tmp/cvs-serv21983 Modified Files: ZopePageTemplate.py Log Message: Don't expand macros when doing history comparison. === Products/PageTemplates/ZopePageTemplate.py 1.14 => 1.15 === 'manage_historyCompare')( self, rev1, rev2, REQUEST, - historyComparisonResults=html_diff(rev1.read(), rev2.read()) ) + historyComparisonResults=html_diff(rev1._text, rev2._text) ) def pt_getContext(self): root = self.getPhysicalRoot() From evan@zope.com Tue Aug 7 15:43:38 2001 From: evan@zope.com (Evan Simpson) Date: Tue, 7 Aug 2001 10:43:38 -0400 Subject: [ZPT] CVS: Products/PageTemplates - CHANGES.txt:1.16 Message-ID: <200108071443.f77EhcV22168@cvs.baymountain.com> Update of /cvs-repository/Products/PageTemplates In directory cvs.zope.org:/tmp/cvs-serv22161 Modified Files: CHANGES.txt Log Message: === Products/PageTemplates/CHANGES.txt 1.15 => 1.16 === Features Added + - ZPTs are now cache-enabled + + - Added property sheet to ZPT + Bugs Fixed - Expressions with embedded newlines were broken + + - History comparison tried to expand macros From tony.mcdonald@ncl.ac.uk Tue Aug 7 15:49:07 2001 From: tony.mcdonald@ncl.ac.uk (Tony McDonald) Date: Tue, 07 Aug 2001 15:49:07 +0100 Subject: [ZPT] CVS: Products/PageTemplates - CHANGES.txt:1.16 In-Reply-To: <200108071443.f77EhcV22168@cvs.baymountain.com> Message-ID: On 7/8/01 3:43 pm, "Evan Simpson" wrote: > === Products/PageTemplates/CHANGES.txt 1.15 => 1.16 === > Features Added > > + - ZPTs are now cache-enabled > + > + - Added property sheet to ZPT > + I was going to ask about *both* these things today - Nice one Evan! Tone. -- Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/ The Medical School, Newcastle University Tel: +44 191 243 6140 A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope From evan@zope.com Tue Aug 7 15:49:42 2001 From: evan@zope.com (Evan Simpson) Date: Tue, 7 Aug 2001 10:49:42 -0400 Subject: [ZPT] CVS: Packages/TAL - CHANGES.txt:1.7 Message-ID: <200108071449.f77Engj22435@cvs.baymountain.com> Update of /cvs-repository/Packages/TAL In directory cvs.zope.org:/tmp/cvs-serv22428 Modified Files: CHANGES.txt Log Message: *** empty log message *** === Packages/TAL/CHANGES.txt 1.6 => 1.7 === Features Added + - Added TAL statement: omit_tag="[]" replaces + the statement tag with its contents if the boolean + expression is true or omitted. + + - The TAL and METAL namespaces can be applied to tag names, + tags in these namespaces are removed from rendered output + (leaving the contents in place, as with omit_tag) + whenever attributes in these namespaces would be, and + tag attributes without explicit namespaces default to the + tag's namespace (per XML spec). + Bugs Fixed From evan@zope.com Tue Aug 7 15:58:07 2001 From: evan@zope.com (Evan Simpson) Date: Tue, 7 Aug 2001 10:58:07 -0400 Subject: [ZPT] CVS: Packages/TAL/tests/input - test_metal1.html:1.2 Message-ID: <200108071458.f77Ew7b22823@cvs.baymountain.com> Update of /cvs-repository/Packages/TAL/tests/input In directory cvs.zope.org:/tmp/cvs-serv22775/input Modified Files: test_metal1.html Log Message: Added failing unit test for bug === Packages/TAL/tests/input/test_metal1.html 1.1 => 1.2 === + + + INSLOT + + + + + From evan@zope.com Tue Aug 7 15:58:07 2001 From: evan@zope.com (Evan Simpson) Date: Tue, 7 Aug 2001 10:58:07 -0400 Subject: [ZPT] CVS: Packages/TAL/tests/output - test_metal1.html:1.2 Message-ID: <200108071458.f77Ew7Z22825@cvs.baymountain.com> Update of /cvs-repository/Packages/TAL/tests/output In directory cvs.zope.org:/tmp/cvs-serv22775/output Modified Files: test_metal1.html Log Message: Added failing unit test for bug === Packages/TAL/tests/output/test_metal1.html 1.1 => 1.2 === +INNER + + INSLOT + + +INSLOT From rbickers-dated-997802587.a34ba2@logicetc.com Tue Aug 7 16:23:06 2001 From: rbickers-dated-997802587.a34ba2@logicetc.com (Ron Bickers) Date: Tue, 7 Aug 2001 11:23:06 -0400 Subject: [ZPT] dtml-with to ZPT problem In-Reply-To: Message-ID: > -----Original Message----- > From: zpt-admin@zope.org [mailto:zpt-admin@zope.org]On Behalf Of Ron > Bickers > 'channel' is a PersistentMapping in the RDFSummary object that has, among > other things, a 'description'. > > I can't get this to work in ZPT. I've tried the following: > >
> > ...gives a "description not found in here/channel/description" error. After messing around with the source of ZPT and RDFSummary, I found that it has something to do with permission to access the PersistentMapping object, but I don't know why. The above here/channel/description actually raises an Unauthorized exception that ZPT captures and turns into an Undefined. I verified this by modifying ZPT to return the actual exception. I also tried to access something in channel that I knew wasn't there and I got a KeyError instead of Unauthorized, as expected. So ZPT knows the key is there, it just can't get to it. I then modified RDFSummary to use a plain Python dictionary instead of the PersistentMapping just to test. After that, 'here/channel/description' returned exactly what I expect it to. Now I don't know where else to look. _______________________ Ron Bickers Logic Etc, Inc. From rbickers-dated-997803595.84d54f@logicetc.com Tue Aug 7 16:39:54 2001 From: rbickers-dated-997803595.84d54f@logicetc.com (Ron Bickers) Date: Tue, 7 Aug 2001 11:39:54 -0400 Subject: [ZPT] CVS: Packages/TAL - CHANGES.txt:1.7 In-Reply-To: <200108071449.f77Engj22435@cvs.baymountain.com> Message-ID: > + - The TAL and METAL namespaces can be applied to tag names, > + tags in these namespaces are removed from rendered output > + (leaving the contents in place, as with omit_tag) > + whenever attributes in these namespaces would be, and > + tag attributes without explicit namespaces default to the > + tag's namespace (per XML spec). Does this mean I can do the following? This stuff will not be surrounded by
anymore.
_______________________ Ron Bickers Logic Etc, Inc. From evan@zope.com Tue Aug 7 16:50:20 2001 From: evan@zope.com (Evan Simpson) Date: Tue, 07 Aug 2001 11:50:20 -0400 Subject: [ZPT] dtml-with to ZPT problem References: Message-ID: <3B700E3C.4020808@zope.com> Ron Bickers wrote: >>'channel' is a PersistentMapping in the RDFSummary object that has, among >>other things, a 'description'. >> > After messing around with the source of ZPT and RDFSummary, I found that it > has something to do with permission to access the PersistentMapping object, > but I don't know why. I don't know the internals of RDFSummary, but if it's using a raw PersistentMapping, then that's the problem. PersistentMappings don't have any security declarations on them, so they're unusable from restricted code (like ZPT, DTML, Scripts). If you are able to use the contents of 'channel' from DTML or a Python Script, then I'm barking up the wrong tree. Cheers, Evan @ Zope From evan@zope.com Tue Aug 7 17:00:46 2001 From: evan@zope.com (Evan Simpson) Date: Tue, 07 Aug 2001 12:00:46 -0400 Subject: [ZPT] CVS: Packages/TAL - CHANGES.txt:1.7 References: Message-ID: <3B7010AE.7030006@zope.com> Ron Bickers wrote: >>+ - The TAL and METAL namespaces can be applied to tag names, >>+ tags in these namespaces are removed from rendered output >>+ (leaving the contents in place, as with omit_tag) >>+ whenever attributes in these namespaces would be, and >>+ tag attributes without explicit namespaces default to the >>+ tag's namespace (per XML spec). > > Does this mean I can do the following? > > > This stuff will not be surrounded by
anymore. >
Yes, although your opening and closing tags need to match (namespace and all). Cheers, Evan @ Zope From rbickers-dated-997805522.125cb8@logicetc.com Tue Aug 7 17:12:02 2001 From: rbickers-dated-997805522.125cb8@logicetc.com (Ron Bickers) Date: Tue, 7 Aug 2001 12:12:02 -0400 Subject: [ZPT] dtml-with to ZPT problem In-Reply-To: <3B700E3C.4020808@zope.com> Message-ID: > -----Original Message----- > From: Evan Simpson [mailto:evan@zope.com] > I don't know the internals of RDFSummary, but if it's using a raw > PersistentMapping, then that's the problem. PersistentMappings don't > have any security declarations on them, so they're unusable from > restricted code (like ZPT, DTML, Scripts). If you are able to use the > contents of 'channel' from DTML or a Python Script, then I'm barking up > the wrong tree. Well, I can't get it to work in a Python Script either, but this most definitely works in DTML: RDFSummary has channel defined as follows: self.channel = Globals.PersistentMapping(channel), where channel is initially {}. What can/should be done with this product to provide the proper access to channel? This really isn't a ZPT-specific question, but maybe there should be a way to provide the access that the DTML mapping does above? _______________________ Ron Bickers Logic Etc, Inc. From rbickers-dated-997805713.c4caec@logicetc.com Tue Aug 7 17:15:13 2001 From: rbickers-dated-997805713.c4caec@logicetc.com (Ron Bickers) Date: Tue, 7 Aug 2001 12:15:13 -0400 Subject: [ZPT] CVS: Packages/TAL - CHANGES.txt:1.7 In-Reply-To: <3B7010AE.7030006@zope.com> Message-ID: > -----Original Message----- > From: Evan Simpson [mailto:evan@zope.com] > > Does this mean I can do the following? > > > > > > This stuff will not be surrounded by
anymore. > >
> > > Yes, although your opening and closing tags need to match (namespace and > all). Ah, yes....
This very nice. Using the omit_tag like this would give the same results, correct?
No more div surround.
Hmmm. Is there any particular reason we have fill-slot, define-macro, etc. (with dashes) and omit_tag with underscore? _______________________ Ron Bickers Logic Etc, Inc. From evan@zope.com Tue Aug 7 18:52:40 2001 From: evan@zope.com (Evan Simpson) Date: Tue, 07 Aug 2001 13:52:40 -0400 Subject: [ZPT] CVS: Packages/TAL - CHANGES.txt:1.7 References: Message-ID: <3B702AE8.80700@zope.com> Ron Bickers wrote: > This very nice. Using the omit_tag like this would give the same results, > correct? > >
> No more div surround. >
Yep. > Hmmm. Is there any particular reason we have fill-slot, define-macro, etc. > (with dashes) and omit_tag with underscore? Typo in my CHANGES entry -- it's 'omit-tag'. Cheers, Evan @ Zope From evan@zope.com Tue Aug 7 20:01:37 2001 From: evan@zope.com (Evan Simpson) Date: Tue, 07 Aug 2001 15:01:37 -0400 Subject: [ZPT] Page Template as standard_error_message References: <20010729163102.4DB623969A@aadal.tanghus.dk> Message-ID: <3B703B11.4090605@zope.com> Thomas Olsen wrote: > Can't I use a Page Template as standard_error_message? When I tried to I just > get what seems to be a built-in error page... I just discovered (and fixed, in CVS) that standard_error_message only worked if it was DTML, not Templates or Scripts. The fix will be in Zope 2.4.1 Cheers, Evan @ Zope From tol@tanghus.dk Tue Aug 7 21:37:59 2001 From: tol@tanghus.dk (Thomas Olsen) Date: Tue, 7 Aug 2001 22:37:59 +0200 Subject: [ZPT] Page Template as standard_error_message In-Reply-To: <3B703B11.4090605@zope.com> References: <20010729163102.4DB623969A@aadal.tanghus.dk> <3B703B11.4090605@zope.com> Message-ID: <20010807203800.6CC0D38543@aadal.tanghus.dk> Great! Guess I'll do a CVS checkout :-) On Tuesday 07 August 2001 21:01, Evan Simpson wrote: > Thomas Olsen wrote: > > Can't I use a Page Template as standard_error_message? When I tried to I > > just get what seems to be a built-in error page... > > I just discovered (and fixed, in CVS) that standard_error_message only > worked if it was DTML, not Templates or Scripts. > > The fix will be in Zope 2.4.1 > > Cheers, > > Evan @ Zope -- Regards Thomas Olsen From Gary & Karyn" Message-ID: <002c01c11f83$7b223220$b47a173f@workstation> *Thanks* for the many great ZPT changes across the board, Evan. Off to grok more of them. g From rbickers-dated-997822883.2c2114@logicetc.com Tue Aug 7 22:01:23 2001 From: rbickers-dated-997822883.2c2114@logicetc.com (Ron Bickers) Date: Tue, 7 Aug 2001 17:01:23 -0400 Subject: [ZPT] Changing standard_html_header/footer Message-ID: I saw in the archives a nice hack to take the header/footer out of my ZPT standard_html_template to produce the standard_html_header/footer for use by DTML objects. It included making the standard_html_header/footer a Python Script, which can't be done at the root since they are protected from deletion. I worked around this by making two separate Python Scripts which are called from the non-deleteable header/footer DTML methods. It works, but it's a hack on a hack. The only argument I heard for not being able to delete standard_html_(header,footer,error) is that they are expected by many products to be around, and if they were deleted, things would break. Is this the only reason? If so, would it not be reasonable to have a simple but sufficient hard-coded version of these methods in Zope to fall back on in case they are missing from the ZODB? Then we could delete them, change them to Scripts, or do whatever else we might find handy without things breaking in case of their absence. _______________________ Ron Bickers Logic Etc, Inc. From evan@zope.com Tue Aug 7 22:17:36 2001 From: evan@zope.com (Evan Simpson) Date: Tue, 07 Aug 2001 17:17:36 -0400 Subject: [ZPT] suggestion: content and/or silent repeat References: <001d01c119c1$1e18aa40$73221b3f@workstation> Message-ID: <3B705AF0.407@zope.com> Gary & Karyn wrote: > I stand by my statement that the ZPT repeat solution I quoted is not as > graceful as most of the rest of the ZPT system. True. I'm probably going to put up a proposal (similar to yours, I think) for tal:repeat-content. > On another note, I am unfamiliar with mailman, and find no place at Zope or > gnu to RTFM. I see that responses to my posts are directed to me and to the > zpt list. Is this done manually as an etiquette or automatically by the > mailman program? I think it's just people doing reply-to-all in their mail clients. Did you find http://www.gnu.org/software/mailman/mailman.html? Cheers, Evan @ Zope From richard@bizarsoftware.com.au Wed Aug 8 00:13:22 2001 From: richard@bizarsoftware.com.au (Richard Jones) Date: Wed, 8 Aug 2001 09:13:22 +1000 Subject: [ZPT] Page Template as standard_error_message In-Reply-To: <3B703B11.4090605@zope.com> References: <20010729163102.4DB623969A@aadal.tanghus.dk> <3B703B11.4090605@zope.com> Message-ID: <01080809132200.01694@ike> On Wednesday 08 August 2001 05:01, Evan Simpson wrote: > Thomas Olsen wrote: > > Can't I use a Page Template as standard_error_message? When I tried to I > > just get what seems to be a built-in error page... > > I just discovered (and fixed, in CVS) that standard_error_message only > worked if it was DTML, not Templates or Scripts. > > The fix will be in Zope 2.4.1 Finally! Thanks Evan! Richard From rbickers-dated-997833512.01aa79@logicetc.com Wed Aug 8 00:58:32 2001 From: rbickers-dated-997833512.01aa79@logicetc.com (Ron Bickers) Date: Tue, 7 Aug 2001 19:58:32 -0400 Subject: [ZPT] page layout by "including" objects Message-ID: In the course of using Zope and DTML, I commonly break my pages into different objects and use to include them where desired. I can't quite get my mind wrapped around the best way to do this using ZPT. I started to do the following all over the place, but this doesn't seem right.
My Object Inserted Here
The ZPT macros seem to fit this purpose, but so far using them is causing my head to hurt. Are macros indeed good for this purpose, or would another way be better? As an example, I have a Folder 'Quotes' with DTML documents that contain short text quotes, and a DMTL method 'view' in that folder as follows: [stuff to make pretty table] [stuff to make pretty table]
I can then put something like the following in a DTML document 'randomquote': Now anytime I want to add a random quote to my page, I just use . How would this be done cleanly in ZPT? _______________________ Ron Bickers Logic Etc, Inc. From rbickers-dated-997833938.ff5611@logicetc.com Wed Aug 8 01:05:38 2001 From: rbickers-dated-997833938.ff5611@logicetc.com (Ron Bickers) Date: Tue, 7 Aug 2001 20:05:38 -0400 Subject: [ZPT] ZPT on DTML documents vs. methods Message-ID: Given a Page Template 'view' that contains this:
Contents
Why does http://host/aDTMLMethod/view return the contents of the DTML Method, but http://host/aDTMLDocument/view return an error instead of the DTML Document contents? The error I get is exceptions.AttributeError on guarded_getattr in "". Is it accurate to conceptualize Page Templates as methods that can display the contents of their parent? _______________________ Ron Bickers Logic Etc, Inc. From steve@spvi.com Wed Aug 8 03:06:26 2001 From: steve@spvi.com (Steve Spicklemire) Date: Tue, 7 Aug 2001 21:06:26 -0500 Subject: [ZPT] page layout by "including" objects In-Reply-To: Message-ID: <200108080208.f78288p50729@obsidian.spvi.com> On Tuesday, August 7, 2001, at 06:58 PM, Ron Bickers wrote: > The ZPT macros seem to fit this purpose, but so far using them is > causing my > head to hurt. Are macros indeed good for this purpose, or would > another way > be better? > This is what macros are designed to do, and they do it quite well! -steve From rbickers-dated-997846659.f230e4@logicetc.com Wed Aug 8 04:37:39 2001 From: rbickers-dated-997846659.f230e4@logicetc.com (Ron Bickers) Date: Tue, 7 Aug 2001 23:37:39 -0400 Subject: [ZPT] page layout by "including" objects In-Reply-To: <200108080208.f78288p50729@obsidian.spvi.com> Message-ID: > -----Original Message----- > From: zpt-admin@zope.org [mailto:zpt-admin@zope.org]On Behalf Of Steve > Spicklemire > > The ZPT macros seem to fit this purpose, but so far using them is > > causing my > > head to hurt. Are macros indeed good for this purpose, or would > > another way > > be better? > > > > This is what macros are designed to do, and they do it quite well! Perfect! I'm slowly starting to sort this stuff out in my head. ZPT is a bit more verbose than DTML in many cases, but I really like the design and how everything fits together. _______________________ Ron Bickers Logic Etc, Inc. From rbickers-dated-997847843.142b17@logicetc.com Wed Aug 8 04:57:23 2001 From: rbickers-dated-997847843.142b17@logicetc.com (Ron Bickers) Date: Tue, 7 Aug 2001 23:57:23 -0400 Subject: [ZPT] page layout by "including" objects In-Reply-To: Message-ID: > -----Original Message----- > From: zpt-admin@zope.org [mailto:zpt-admin@zope.org]On Behalf Of Ron > Bickers > Sent: Tuesday, August 07, 2001 7:59 PM > To: ZPT List > Subject: [ZPT] page layout by "including" objects It's nice when I can answer my own questions, I think. I'll give this one a shot and someone can tell me if I've done something stupid or if there's a better way. > As an example, I have a Folder 'Quotes' with DTML documents that contain > short text quotes, and a DMTL method 'view' in that folder as follows: > > > [stuff to make pretty table] > > [stuff to make pretty table] >
A ZPT 'view' in place of the DTML method as follows: [pretty stuff] [/pretty stuff]
Quote
> I can then put something like the following in a DTML document > 'randomquote': > > > > ZPT 'randomquote': Random Quote Table Q: Is it safe to redefine 'here' in the div block? > Now anytime I want to add a random quote to my page, I just use randomquote>. My Random Quote Table Did I miss anything? I suppose I could combine the two macros for effeciency, but it should work either way. _______________________ Ron Bickers Logic Etc, Inc. From magnus.heino@rivermen.se Wed Aug 8 06:19:49 2001 From: magnus.heino@rivermen.se (Magnus Heino (Rivermen)) Date: Wed, 8 Aug 2001 07:19:49 +0200 Subject: SV: [ZPT] page layout by "including" objects Message-ID: > ZPT 'randomquote': > > > > use-macro="root/Quotes/view/macros/viewquote">Random Quote > Table > > > > Q: Is it safe to redefine 'here' in the div block? Though I don't see the need for doing it, I guess it should be safe in the example above. > Did I miss anything? I suppose I could combine the two macros for > effeciency, but it should work either way.
Quote
/Magnus From norton@arseed.co.jp Wed Aug 8 10:04:14 2001 From: norton@arseed.co.jp (Joseph Wayne Norton) Date: Wed, 08 Aug 2001 18:04:14 +0900 Subject: [ZPT] problems with cvs version of PageTemplates and guarded_attr Message-ID: Hello. I have 2 issues and I currently have the following configuration: Zope 2.4.0 src distribution (with patch included at end): ZTUtils-1.0.0-cvs (latest cvs version) TAL-1.3.3-cvs (latest cvs version) PageTemplates-1.3.3-cvs (latest cvs version) CMF-1.1-cvs (latest cvs version) #1) With the above configuration, I'm getting an error while using a ZPT skin that calls a DTML skin. Error Type: TALESError Error Value: exceptions.TypeError on propertyLabel() takes exactly 2 arguments (1 given) in "" (Object: RestrictedDTML) File /export/arseed/tfs-lib/zope/zope-2.4.0/lib/python/DocumentTemplate/DT_String.py, line 544, in __call__ (Object: RestrictedDTML) File /export/arseed/tfs-lib/zope/zope-2.4.0/lib/python/DocumentTemplate/DT_In.py, line 770, in renderwob (Object: propertyMap) File /export/arseed/tfs-lib/zope/zope-2.4.0/lib/python/DocumentTemplate/DT_Util.py, line 224, in eval (Object: propertyLabel(id)) (Info: propertyLabel) TALESError: (see above) However, if I revert back to a prior version of PageTemplates that DOES NOT INCLUDE the following patch ... everything works fine. Here is the patch that has been excluded: diff --recursive PageTemplates/ZRPythonExpr.py PageTemplates-1.3.3-cvs/ZRPythonExpr.py 91c91 < __version__='$Revision: 1.5 $'[11:-2] --- > __version__='$Revision: 1.6 $'[11:-2] 132a133,136 > from AccessControl.DTML import RestrictedDTML > class Rtd(RestrictedDTML, TemplateDict): > this = None > 134,135c138 < td = TemplateDict() < td.this = None --- > td = Rtd() 137c140 < td._push(InstanceDict(ns['here'], td, guarded_getattr)) --- > td._push(InstanceDict(ns['here'], td)) Any suggestions on how to debug? #2) I am using a ZPT skin that invokes a DTML skin that calls the Calendar CalendarTag product. Everything works fine if the patch listed below is applied to the Zope 2.4.0 src distribution. Honestly, I'm not quite sure what is the best way to add the guarded_attr functionality to the Calendar CalendarTag product. It appears to be not as simple as just adding the RestrictedDTML mix-in. I had posted a prior question to zope-dev but I know I realize the issue is due to the Calendar CalendarTag product. I also do not quite understand the implications toward security if the patch below is left intact on a production zope site. Any suggesions on how to proceed? thanks-and-regards, - joe n. # Here is my patch against the 2.4.0 source: ################################################################### *** ./DocumentTemplate/DT_Util.py --- ./DocumentTemplate/DT_Util.py 148c148 < get = md.guarded_getattr --- > get = getattr(md, 'guarded_getattr', None) 159c159 < get = md.guarded_getattr --- > get = getattr(md, 'guarded_getattr', None) *** ./DocumentTemplate/cDocumentTemplate.c --- ./DocumentTemplate/cDocumentTemplate.c 130,134c130,139 < else < UNLESS(self->guarded_getattr=PyObject_GetAttr(self->namespace, < py_guarded_getattr)) < return NULL; < --- > else if (PyObject_HasAttr(self->namespace,py_guarded_getattr)) > { > UNLESS(self->guarded_getattr=PyObject_GetAttr(self->namespace, > py_guarded_getattr)) > return NULL; > } else > { > self->guarded_getattr = Py_None; > } > *** ./DocumentTemplate/pDocumentTemplate.py --- ./DocumentTemplate/pDocumentTemplate.py 129c129 < self.guarded_getattr = namespace.guarded_getattr --- > self.guarded_getattr = getattr(namespace, 'guarded_getattr', None) From rbickers-dated-997886078.5c8194@logicetc.com Wed Aug 8 15:34:38 2001 From: rbickers-dated-997886078.5c8194@logicetc.com (Ron Bickers) Date: Wed, 8 Aug 2001 10:34:38 -0400 Subject: [ZPT] page layout by "including" objects In-Reply-To: Message-ID: > -----Original Message----- > From: zpt-admin@zope.org [mailto:zpt-admin@zope.org]On Behalf Of Magnus > > > > > > > use-macro="root/Quotes/view/macros/viewquote">Random Quote > > Table > > > > > > > > Q: Is it safe to redefine 'here' in the div block? > > Though I don't see the need for doing it, I guess it should be safe in the > example above. The idea was that I could create the 'view' template that uses 'here' and call it from the Web, as in '/Quotes/quote1/view' such that 'here' would be 'quote1'. In addition to being able to call it via the Web, I could also define 'here' as a specific quote (as shown above) and use the same 'view' template to display it. Make sense? >
> > > > >
tal:content="python:whrandom.choice(root.Quotes.objectValues())">Q > uote
>
Exactly. This is a simple example. However, if I were to have a complex 'view' template for a single quote and wanted to reuse it in situations other than this random choice one, it would make sense to break it down into two macros, right? For example, I might want to loop through 4 random quotes and 'view' each, or sort them all by date, etc. _______________________ Ron Bickers Logic Etc, Inc. From evan@zope.com Wed Aug 8 15:43:07 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 08 Aug 2001 10:43:07 -0400 Subject: [ZPT] page layout by "including" objects References: Message-ID: <3B714FFB.9080507@zope.com> Ron Bickers wrote: >>>Q: Is it safe to redefine 'here' in the div block? >>> >>Though I don't see the need for doing it, I guess it should be safe in the >>example above. > > The idea was that I could create the 'view' template that uses 'here' and > call it from the Web, as in '/Quotes/quote1/view' such that 'here' would be > 'quote1'. In addition to being able to call it via the Web, I could also > define 'here' as a specific quote (as shown above) and use the same 'view' > template to display it. Make sense? Yes, but you're probably better off using 'here' as a fallback rather than redefining it. In other words, define a variable such as 'chosen_quote', and use "chosen_quote | here" instead of "here". That way, if 'chosen_quote' isn't defined, 'here' will be used. Cheers, Evan @ Zope From rbickers-dated-997887852.2cd3f9@logicetc.com Wed Aug 8 16:04:11 2001 From: rbickers-dated-997887852.2cd3f9@logicetc.com (Ron Bickers) Date: Wed, 8 Aug 2001 11:04:11 -0400 Subject: [ZPT] page layout by "including" objects In-Reply-To: <3B714FFB.9080507@zope.com> Message-ID: > -----Original Message----- > From: Evan Simpson [mailto:evan@zope.com] > Yes, but you're probably better off using 'here' as a fallback rather > than redefining it. In other words, define a variable such as > 'chosen_quote', and use "chosen_quote | here" instead of "here". That > way, if 'chosen_quote' isn't defined, 'here' will be used. Ok. I didn't think of that. Would that be better because it avoids the potential confusion of redefining 'here', or is there some other technical reason for it? _______________________ Ron Bickers Logic Etc, Inc. From evan@zope.com Wed Aug 8 16:15:49 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 08 Aug 2001 11:15:49 -0400 Subject: [ZPT] page layout by "including" objects References: Message-ID: <3B7157A5.3070301@zope.com> Ron Bickers wrote: > Ok. I didn't think of that. Would that be better because it avoids the > potential confusion of redefining 'here', or is there some other technical > reason for it? Just to avoid redefining 'here'. It's not necessarily a problem to do so, but it would make me nervous. Cheers, Evan @ Zope From evan@zope.com Wed Aug 8 16:41:28 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 08 Aug 2001 11:41:28 -0400 Subject: [ZPT] Re: TALESPropertySheet or using TALES as a propertydefinition References: <004e01c11ade$55fd2580$6600000a@netlabs.local> Message-ID: <3B715DA8.7050703@zope.com> Ulrich Eck wrote: > there is some info in the ZPT-Wiki about your vision a new kind of > PropertySheet .. do you have any examples avaliable or are this > just thoughts. Just thoughts, I'm afraid. > I want to be able to define Properties in TALES. > > e.g. id: "mytitle", value: "python:here.title_or_id()" Sorry this response took so long. Here's a sample session that may help (I'm CCing to ZPT in case this may help others): >>> from Products.PageTemplates.Expressions import getEngine >>> e = getEngine() >>> expr = e.compile('python:x+1') >>> c = e.getContext({'x': 1}) >>> c.evaluate(expr) 2 >>> c.evaluateText(expr) '2' >>> c.evaluateBoolean(expr) 1 >>> c.beginScope() >>> c.setLocal('x', 5) >>> c.evaluateText(expr) '6' >>> c.endScope() >>> c.evaluateText(expr) '2' >>> # The following is less efficient, but more direct: >>> c.evaluateText('string:$x!') '2!' The dictionary that you pass to getContext() defines builtin variables. If you want to detect a return value of 'default', compare the value to c.getDefault(). The TALES exception is c.getTALESError(). Cheers, Evan @ Zope From evan@zope.com Wed Aug 8 16:43:29 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 08 Aug 2001 11:43:29 -0400 Subject: [ZPT] Changing standard_html_header/footer References: Message-ID: <3B715E21.8010106@zope.com> Ron Bickers wrote: > If so, would it not be reasonable to have a simple but sufficient hard-coded > version of these methods in Zope to fall back on in case they are missing > from the ZODB? Then we could delete them, change them to Scripts, or do > whatever else we might find handy without things breaking in case of their > absence. Yep, this would be ideal. I was thinking about this the other day, but it's non-trivial to implement, and would probably require a fishbowl proposal. Cheers, Evan @ Zope From rbickers-dated-997891280.729e84@logicetc.com Wed Aug 8 17:01:20 2001 From: rbickers-dated-997891280.729e84@logicetc.com (Ron Bickers) Date: Wed, 8 Aug 2001 12:01:20 -0400 Subject: [ZPT] page layout by "including" objects In-Reply-To: <3B7157A5.3070301@zope.com> Message-ID: > -----Original Message----- > From: Evan Simpson [mailto:evan@zope.com] > > Ok. I didn't think of that. Would that be better because it avoids the > > potential confusion of redefining 'here', or is there some > other technical > > reason for it? > > Just to avoid redefining 'here'. It's not necessarily a problem to do > so, but it would make me nervous. To me, redefining 'here' for a given block seems like the equivalent of using dtml-with. That is, putting another object at the top of the namespace such that it's used first to find variables in the enclosed methods. Since page templates recognize 'here' as the "top" so to speak (or the context), this seems like a consistent way to be sure the template will use the desired 'here'. If I use different variables, I would be going back to my template to figure out what I used, given my faulty memory. Perhaps I should leave my DTML ways behind when I work with ZPT? _______________________ Ron Bickers Logic Etc, Inc. From ueck@net-labs.de Wed Aug 8 18:09:53 2001 From: ueck@net-labs.de (Ulrich Eck) Date: Wed, 8 Aug 2001 19:09:53 +0200 Subject: [ZPT] Re: TALESPropertySheet or using TALES as a propertydefinition References: <004e01c11ade$55fd2580$6600000a@netlabs.local> <3B715DA8.7050703@zope.com> Message-ID: <013301c1202c$f0c1d810$3300000a@work01> thank you very much !! > (I'm CCing to ZPT in case this may help others): > for any interested people, here what I made out of Evans tips: -------------------------------------------------------------------------------------- import Globals from Globals import Persistent from Acquisition import aq_inner, aq_parent from AccessControl import getSecurityManager, ClassSecurityInfo from Products.PageTemplates.Expressions import getEngine, _SecureModuleImporter SecureModuleImporter = _SecureModuleImporter() class Expression (Persistent): method_name = '' _expr = None security = ClassSecurityInfo() def __init__(self, method_name): self.method_name = method_name e = getEngine() self._expr = e.compile(method_name) security.declarePrivate('validate') def validate(self, inst, parent, name, value, md): # Zope 2.3.x return getSecurityManager().validate(inst, parent, name, value) def __call__(self, context): e = getEngine() if self._expr is None: self._expr = e.compile(self.method_name) c = e.getContext(context) return c.evaluate(self._expr) Globals.InitializeClass(Expression) def exprNamespace(client,form, field=None, value=None, object=None): root = client.getPhysicalRoot() c = {'form': form, 'field': field, 'value': value, 'here': object, 'nothing': None, 'options': {}, 'root': root, 'request': getattr(root, 'REQUEST', None), 'modules': SecureModuleImporter, } return c -------------------------------------------------------------------------------------- use it like: myExpr = Expression('string:this is a text') ns = exprNamespace(...) result = myExpr(ns) thats it cheers Ulrich Eck From rbickers-dated-997900959.cc4f66@logicetc.com Wed Aug 8 19:42:39 2001 From: rbickers-dated-997900959.cc4f66@logicetc.com (Ron Bickers) Date: Wed, 8 Aug 2001 14:42:39 -0400 Subject: [ZPT] HTMLParseError confusion Message-ID: I get this from an HTML document that I pasted in from Dreamweaver (which says it's valid when I check it). I'm not sure what the problem is. On line 199 of the source, there is no column 20. It only has 7 characters on it, and they are ' ' _______________________ Ron Bickers Logic Etc, Inc. From bkc@murkworks.com Wed Aug 8 19:41:24 2001 From: bkc@murkworks.com (Brad Clements) Date: Wed, 8 Aug 2001 14:41:24 -0400 Subject: [ZPT] Python expressions in Paths? In-Reply-To: <3B715E21.8010106@zope.com> Message-ID: <3B714F94.449.23E7A7@localhost> I've found myself needing to use some simple python expressions in paths, but there seems to be no way to express that. I end up falling back to using defines, but then sometimes I need an outer tag to get the logic correct. omit_tag will help, but still be crufty. Is there any way to evaluate a python expression within a path. Like, tal:content="item.value+'xyz' | string:No such value" where if item.value throws a NameError or KeyError, we move on to processing the string: thing.. This is a poor example of what I mean, sorry. Brad Clements, bkc@murkworks.com (315)268-1000 http://www.murkworks.com (315)268-9812 Fax netmeeting: ils://ils.murkworks.com AOL-IM: BKClements From kdangoor@webelite.com Wed Aug 8 20:59:55 2001 From: kdangoor@webelite.com (Kevin Dangoor) Date: Wed, 8 Aug 2001 15:59:55 -0400 Subject: [ZPT] container when called from METAL Message-ID: <00fa01c12044$b1cad6d0$9801a8c0@KID> I'm not sure I agree with the way "container" is bound in this instance: I have a "Box" instance that contains the following page template: The title
This is where the box content goes.
The macro referenced above is in a "Skin" object. It looks like this: The title

content title or id optional template id

This is Page Template template id.
Box goes here.
The Skin object contains another page template called "box". I get an error when I view the first template (on the Box instance), because "container" in the macro page is bound to the Box, not to the Skin. It seems like container should be bound to the Skin instance, not the Box instance. Or, is there something I'm missing about container? Thanks, Kevin From evan@zope.com Wed Aug 8 21:24:09 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 08 Aug 2001 16:24:09 -0400 Subject: [ZPT] container when called from METAL References: <00fa01c12044$b1cad6d0$9801a8c0@KID> Message-ID: <3B719FE9.8060602@zope.com> Kevin Dangoor wrote: > "container" in the macro page is bound to the Box, not to the Skin. It seems > like container should be bound to the Skin instance, not the Box instance. > Or, is there something I'm missing about container? When a template uses a macro, the macro is grafted into the template before any TAL processing. TAL statements in a macro therefore operate in the same context as "native" parts of the template, and have no idea that they've been brought in from another template. What you're trying to do is tricky, and I'm not sure what the best way to do it is. Sorry, Evan @ Zope From kdangoor@webelite.com Wed Aug 8 21:31:52 2001 From: kdangoor@webelite.com (Kevin Dangoor) Date: Wed, 8 Aug 2001 16:31:52 -0400 Subject: [ZPT] container when called from METAL References: <00fa01c12044$b1cad6d0$9801a8c0@KID> <3B719FE9.8060602@zope.com> Message-ID: <013201c12049$28834ec0$9801a8c0@KID> From: "Evan Simpson" > Kevin Dangoor wrote: > > > "container" in the macro page is bound to the Box, not to the Skin. It seems > > like container should be bound to the Skin instance, not the Box instance. > > Or, is there something I'm missing about container? > > > When a template uses a macro, the macro is grafted into the template > before any TAL processing. TAL statements in a macro therefore operate > in the same context as "native" parts of the template, and have no idea > that they've been brought in from another template. > > What you're trying to do is tricky, and I'm not sure what the best way > to do it is. > > Sorry, > > Evan @ Zope I figured it was something like that. I also figured it would probably not be easy to deal with. In this particular case, I have an easy workaround. It's probably not a big deal for most usage scenarios, but it should probably be documented somewhere... Kevin From Gary & Karyn" <001d01c119c1$1e18aa40$73221b3f@workstation> <3B705AF0.407@zope.com> Message-ID: <001501c12072$6279e200$8b83173f@workstation> ----- Original Message ----- From: "Evan Simpson" > I'm probably going to put up a proposal (similar to yours, I > think) for tal:repeat-content. Sounds great. I look forward to checking it out. > Did > you find http://www.gnu.org/software/mailman/mailman.html? Yes, thanks. It didn't tell me much though. The best I could find was http://www.aurora.edu/~ckolar/mailman/mailman-userguide-0.1.pdf , from a series of links from that page. Still didn't tell me what I wanted to know. I should have downloaded the package I guess, at that point, but I was getting a bit tired of the game. So . . . good to know that it's a "reply all" kind of etiquette though--thank you very much. Gary From waltonl@franklin.edu Thu Aug 9 03:08:45 2001 From: waltonl@franklin.edu (waltonl) Date: Wed, 08 Aug 2001 22:08:45 -0400 Subject: [ZPT] External Method IOError problem ... is this wrong to do? Message-ID: <3B71F0AD.FEF83AFE@franklin.edu> I have an external method that get's called in my main zpt in which I use a multiline string (enclosed in """'s) as a global variable and then I parse it line by line using StringIO - so the jist of the file contents and it's usage is something like this: --------------- global mainMenu = """ lot's of lines of content.in here........ that get parsed using StringIO ......... etc """ def buildMainMenu() global mainMenu menuTree = build3LevelMenuTree(mainMenu) ... etc def build3LevelMenuTree(menuStr): menuTree = [] menufile = StringIO.StringIO(menuStr) for line in menufile.readlines(): .... do some stuff in here that based on value of line appends different things to menuTree list menufile.close() return menuTree -------------------------------- This external method is called from a Problem is that I'm experiencing an intermittent problem of getting Zope has encountered an error while publishing this resource. Error Type: IOError Error Value: [Errno 5] I/O error This is happening even when I'm the only one developing and testing so it doesn't seem like it would be a multithreaded/synchronization issue??? Have I done something wrong in coding it this way? Should I be able to do something like this? Thanks, Lynn From steve@spvi.com Thu Aug 9 12:45:29 2001 From: steve@spvi.com (Steve Spicklemire) Date: Thu, 9 Aug 2001 06:45:29 -0500 Subject: [ZPT] External Method IOError problem ... is this wrong to do? In-Reply-To: <3B71F0AD.FEF83AFE@franklin.edu> Message-ID: <200108091146.f79BkQp59673@obsidian.spvi.com> Hi Lynn, Can you post the whole traceback? thanks, -steve On Wednesday, August 8, 2001, at 09:08 PM, waltonl wrote: > I have an external method that get's called in my main zpt in which I > use a multiline string (enclosed in """'s) as a global variable and > then I parse it line by line using > StringIO - so the jist of the file contents and it's usage is something > like this: > --------------- > global mainMenu = """ > lot's of lines of content.in here........ > that get parsed using StringIO > ......... > etc > """ > > def buildMainMenu() > global mainMenu > menuTree = build3LevelMenuTree(mainMenu) > ... > etc > > def build3LevelMenuTree(menuStr): > menuTree = [] > menufile = StringIO.StringIO(menuStr) > for line in menufile.readlines(): > .... do some stuff in here that based on value of line appends > different things to menuTree list > menufile.close() > return menuTree > -------------------------------- > This external method is called from a > > Problem is that I'm experiencing an intermittent problem of getting Zope > has encountered an error while publishing this resource. > Error Type: IOError > Error Value: [Errno 5] I/O error > > This is happening even when I'm the only one developing and testing so > it doesn't seem like it would be a multithreaded/synchronization > issue??? > > Have I done something wrong in coding it this way? Should I be able to > do something like this? > > Thanks, > Lynn > > > > > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt From dieter@handshake.de Fri Aug 10 22:58:23 2001 From: dieter@handshake.de (Dieter Maurer) Date: Fri, 10 Aug 2001 23:58:23 +0200 (CEST) Subject: [ZPT] HTMLParseError confusion In-Reply-To: References: Message-ID: <15220.22783.280156.806058@lindm.dm> Ron Bickers writes: > > > I get this from an HTML document that I pasted in from Dreamweaver (which > says it's valid when I check it). > > I'm not sure what the problem is. On line 199 of the source, there is no > column 20. It only has 7 characters on it, and they are ' ' Search for an '&' followed by something that does not follow the SGML entity/charref syntax. Dieter From rbickers-dated-998099794.170533@logicetc.com Sat Aug 11 02:56:34 2001 From: rbickers-dated-998099794.170533@logicetc.com (Ron Bickers) Date: Fri, 10 Aug 2001 21:56:34 -0400 Subject: [ZPT] HTMLParseError confusion In-Reply-To: <15220.22783.280156.806058@lindm.dm> Message-ID: > -----Original Message----- > From: zpt-admin@zope.org [mailto:zpt-admin@zope.org]On Behalf Of Dieter > Maurer > > TAL.HTMLParser.HTMLParseError: EOF in middle of entity or > char ref, at line > > 199, column 20 > Search for an '&' followed by something that does not follow > the SGML entity/charref syntax. Sure enough, there was an & on line 95, as in 'Ernst & Young' instead of 'Ernst & Young'. That fixed it, but why did the error refer to a line/column that wasn't anywhere near the problem? _______________________ Ron Bickers Logic Etc, Inc. From dieter@handshake.de Sat Aug 11 08:42:12 2001 From: dieter@handshake.de (Dieter Maurer) Date: Sat, 11 Aug 2001 09:42:12 +0200 (CEST) Subject: [ZPT] HTMLParseError confusion In-Reply-To: References: <15220.22783.280156.806058@lindm.dm> Message-ID: <15220.57812.190321.423494@lindm.dm> Ron Bickers writes: > > > TAL.HTMLParser.HTMLParseError: EOF in middle of entity or > > char ref, at line > > > 199, column 20 > > > Search for an '&' followed by something that does not follow > > the SGML entity/charref syntax. > > Sure enough, there was an & on line 95, as in 'Ernst & Young' instead of > 'Ernst & Young'. That fixed it, but why did the error refer to a > line/column that wasn't anywhere near the problem? Probably because the parser started at the "&" and looked for a matching ';'. It stopped when it reached a closing tag because it knew that the looked for ';' must not be beyond that tag. As space is not allowed in entity names (with the standard SGML declaration), the parser could probably recognize the problem earlier, facilitating localizing the problem: ===> Feature request for the ZPT Tracker Dieter From rbickers-dated-998141436.946658@logicetc.com Sat Aug 11 14:30:36 2001 From: rbickers-dated-998141436.946658@logicetc.com (Ron Bickers) Date: Sat, 11 Aug 2001 09:30:36 -0400 Subject: [ZPT] HTMLParseError confusion In-Reply-To: <15220.57812.190321.423494@lindm.dm> Message-ID: > -----Original Message----- > From: Dieter Maurer [mailto:dieter@handshake.de] > Probably because the parser started at the "&" and looked for a > matching ';'. It stopped when it reached a closing tag because > it knew that the looked for ';' must not be beyond that tag. > > As space is not allowed in entity names (with the > standard SGML declaration), the parser could probably recognize > the problem earlier, facilitating localizing the problem: > > ===> Feature request for the ZPT Tracker The first closing tag after the & is on line 105, and there is a huge table with lots o' stuff between that and line 199. I guess this is really an XML parser issue though, and not ZPT, right? _______________________ Ron Bickers Logic Etc, Inc. From chris@chriscurvey.com Sat Aug 11 18:04:55 2001 From: chris@chriscurvey.com (Chris Curvey) Date: Sat, 11 Aug 2001 13:04:55 -0400 Subject: [ZPT] using ZPT as part of a product? Message-ID: <3B7565B7.2AA96CB9@bellatlantic.net> Hi! I would like to be able to use ZPT in a Zope product that I'm working on. When I use DTML to render the interface, my code looks like this: from Globals import DTMLFile class Minimal: index_html = DTMLFile("www/index_html", globals()) Is there a similar thing for ZPT so that I can just plug the page template into my classes? -Chris (If the answer to this is RTFM, please point me to the appropriate part of the FM :) -- Chris Curvey Curvey Consulting http://www.chriscurvey.com From evan@zope.com Sun Aug 12 18:09:39 2001 From: evan@zope.com (Evan Simpson) Date: Sun, 12 Aug 2001 13:09:39 -0400 Subject: [ZPT] Python expressions in Paths? References: <3B714F94.449.23E7A7@localhost> Message-ID: <3B76B853.3060701@zope.com> Brad Clements wrote: > I've found myself needing to use some simple python expressions in paths, but there seems to be no way to express that. [snip] > tal:content="item.value+'xyz' | string:No such value" Ah, but you *can* use paths in a Python expression, like so: tal:content="python:test(exists('item/value'), item.value+'xyz', 'No such value')" Cheers, Evan @ Zope From dieter@handshake.de Sun Aug 12 19:50:27 2001 From: dieter@handshake.de (Dieter Maurer) Date: Sun, 12 Aug 2001 20:50:27 +0200 (CEST) Subject: [ZPT] using ZPT as part of a product? In-Reply-To: <3B7565B7.2AA96CB9@bellatlantic.net> References: <3B7565B7.2AA96CB9@bellatlantic.net> Message-ID: <15222.53235.601724.925954@lindm.dm> Chris Curvey writes: > I would like to be able to use ZPT in a Zope product that I'm > working on. When I use DTML to render the interface, my code looks like > this: > > from Globals import DTMLFile > > class Minimal: > > index_html = DTMLFile("www/index_html", globals()) > from Products.PageTemplates import PageTableFile may help you. Dieter From evan@zope.com Mon Aug 13 16:33:35 2001 From: evan@zope.com (Evan Simpson) Date: Mon, 13 Aug 2001 11:33:35 -0400 Subject: [ZPT] using ZPT as part of a product? References: <3B7565B7.2AA96CB9@bellatlantic.net> Message-ID: <3B77F34F.5020105@zope.com> Chris Curvey wrote: > Is there a similar thing for ZPT so that I can just plug the page > template into my classes? Just wrote basic docs: http://dev.zope.org/Wikis/DevSite/Projects/ZPT/PageTemplateFiles Cheers, Evan @ Zope From tony.mcdonald@ncl.ac.uk Mon Aug 13 17:36:28 2001 From: tony.mcdonald@ncl.ac.uk (Tony McDonald) Date: Mon, 13 Aug 2001 17:36:28 +0100 Subject: [ZPT] Guarded_getattr woes.. Message-ID: Hi all, I have this fragment of a pagetemplate; ... blah Where data is a coresession object that holds various bits of info about the 'state' of a user. It is defined as 'global' in the body tag of the PageTemplate. It yields this traceback. on or about, Wednesday, August 15, 2001, we have reason to believe that Har= ry Page wrote something along the lines of : HP> Hi All, HP> I have a number of DTML methods that generate snippets of HTML (I must HP> not mix presentation with code, I must ..). When I pull these up in a HP> ZPT with replace or content the HTML is all quoted and therefore doesn't HP> display properly. Is this normal behaviour=3F Is there anyway around th= is=3F HP> Thanks HP> Harry HP> _______________________________________________ HP> ZPT mailing list HP> ZPT@zope.org HP> http://lists.zope.org/mailman/listinfo/zpt From evan@4-am.com Wed Aug 15 16:10:44 2001 From: evan@4-am.com (Evan Simpson) Date: Wed, 15 Aug 2001 11:10:44 -0400 Subject: [ZPT] Re: [Zope] ZPT: How do I see if something is in a sequence? References: <001e01c1253e$5f8dc090$1701640a@pythonic> <004201c12541$27dafed0$0100a8c0@evansys> <002401c12541$5c7b4910$1701640a@pythonic> Message-ID: <3B7A90F4.4080704@4-am.com> alan runyan wrote: > Two things need changing here. First, the condition must be on a tag inside of the tal:repeat's tag. Remember, the order in which statements are evaluated is fixed, and is not affected by the order in which they appear on the tag. Second, don't use 'repeat.member' to access element data. You only use 'repeat' to access things like the iteration number. The business with the order of operations is painful, I'll admit. So, like this: You should also be able to use: tal:content="member/getUserName" If you're using the most recent release of ZPT, you can pre-filter the list, like so: All of this logic could be bundled up in a Script, too, like so: ## Script (Python) "getModerators" moderators = [] for user in container.portal_membership.listMembers(): if 'Moderator' in user.helplink_roles: moderators.append(user) return moderators # End Script Cheers, Evan @ 4-am & Zope From alan runyan" <004201c12541$27dafed0$0100a8c0@evansys> <002401c12541$5c7b4910$1701640a@pythonic> <3B7A90F4.4080704@4-am.com> Message-ID: <001801c1259f$56e9b870$1701640a@pythonic> Evan I greatly appreciate your response to my 2 inqueries. I hope to spur more recipe devleopment on zopelabs using PageTemplates and #irc support so we can have more examples available to the community. > If you're using the most recent release of ZPT, you can pre-filter the > list, like so: > > wow. that definetly could explode a designers head ;) need to get head around PageTemplates before I dive into ZTUtils. I have an adversion to lambda as it seems to make people who are new to python scratch their head. but I'm going to go look at the ZTUtils to see what goodies are waiting for me. > > All of this logic could be bundled up in a Script, too, like so: > > ## Script (Python) "getModerators" > moderators = [] > for user in container.portal_membership.listMembers(): > if 'Moderator' in user.helplink_roles: > moderators.append(user) > return moderators > # End Script > > I agree this is much nicer, but since I'm doing all this TTW I try to keep the Script(Python) explosion down to a minimal. I posted this up on zopelabs, as how to change Custom Properties of a Member object. I am just still getting use to PageTemplates. The error messages seemed a bit terse. Maybe that is just me. I was getting Undefined's, so I should have known to put repeat in
. works beautifully. I'm moving to PageTemplates exclusively. just having a hard time adjusting the HTML tags being block delimiters instead of the explicit or <% %>. ~runyaga From fg@nuxeo.com Wed Aug 15 17:51:33 2001 From: fg@nuxeo.com (Florent Guillaume) Date: 15 Aug 2001 16:51:33 GMT Subject: [ZPT] Re: [Zope] ZPT: How do I see if something is in a sequence? References: <001e01c1253e$5f8dc090$1701640a@pythonic> <004201c12541$27dafed0$0100a8c0@evansys> <002401c12541$5c7b4910$1701640a@pythonic> <3B7A90F4.4080704@4-am.com> Message-ID: <9le9al$ppi$1@dev.in.nuxeo.com> Evan Simpson wrote: > > If I understand the latest changes, you can even do the following, right ? Florent Guillaume Nuxeo From Georges J Baladi Jr" This is a multi-part message in MIME format. ------=_NextPart_000_027A_01C125A0.1F8109F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I have the follow situation: a folder with 19 images a page template that display the images inside a table. I want to put 5 = images in a row. I try this: =20
but omit-tag remove the start AND the end tr when the condition is true = and my page display 4 rows (one with 1 image, 1 with 4 images, 1 with 1 = image and 1 with 4 images). I tried with tal:condition to, but I can=B4t = do what I want. Can I control the start OR the end tag? I think Zope and ZPT are the best solution for web publishing. It=B4s an = excellent software. thanks, Georges Baladi ------=_NextPart_000_027A_01C125A0.1F8109F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
 
I have the follow = situation:
 
a folder with 19 = images
a page template that display the images = inside a=20 table. I want to put 5 images in a row.
 
I try this:
 
<table width=3D"100%" border=3D"0" = cellspacing=3D"0"=20 cellpadding=3D"0">
  <tr tal:repeat=3D"thumb=20 python:here.conteudo.objectValues('Image')" tal:omit-tag=3D"python:p= ath('repeat/thumb/index')%5!=3D0">
     =20 <td><img src=3D"/images/papel/campeonato.jpg" width=3D= "100"=20 height=3D"75" tal:replace=3D"structure thumb"></td> =
   </tr>
 </table>
 
but omit-tag remove the = start AND the end=20 tr when the condition is true and my page display 4 rows (one with 1 = image, 1=20 with 4 images, 1 with 1 image and 1 with 4 images). I tried with = tal:condition=20 to, but I can=B4t do what I want. Can I control the start OR the = end=20 tag?
 
I think Zope and ZPT are the best = solution for web=20 publishing. It=B4s an excellent software.
 
thanks,
 
Georges Baladi
 
------=_NextPart_000_027A_01C125A0.1F8109F0-- From evan@zope.com Wed Aug 15 19:57:28 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 15 Aug 2001 14:57:28 -0400 Subject: [ZPT] Re: [Zope] ZPT: How do I see if something is in a sequence? References: <001e01c1253e$5f8dc090$1701640a@pythonic> <004201c12541$27dafed0$0100a8c0@evansys> <002401c12541$5c7b4910$1701640a@pythonic> <3B7A90F4.4080704@4-am.com> <9le9al$ppi$1@dev.in.nuxeo.com> Message-ID: <3B7AC618.7040805@zope.com> Florent Guillaume wrote: > If I understand the latest changes, you can even do the following, right ? > > Should work, yes. I suspect that most editing tools won't much care what comes after the 'tal:', here, so you could equally well use 'tal:block' or 'tal:feezba'. Now that I think about it, this has the additional advantage that the ZPT parser won't try to validate the block vs. inline-ness of this sort of tag, so you won't have to decide between 'div' and 'span'. Cheers, Evan @ Zope From dieter@handshake.de Wed Aug 15 20:34:27 2001 From: dieter@handshake.de (Dieter Maurer) Date: Wed, 15 Aug 2001 21:34:27 +0200 (CEST) Subject: [ZPT] Maximum size for attribute strings? In-Reply-To: <20010814230326.A4065@thehendricks.org> References: <20010814230326.A4065@thehendricks.org> Message-ID: <15226.52931.926810.726903@lindm.dm> Brent M Hendricks writes: > Is there a maximum length restriction on attribute lengths in ZPT > somewhere? I'm trying to assign an href attribute using > tal:attributes, and my URLs are consistently being truncated to 128 > characters. Just tried it and was able to create a href with 400 characters. .... PageTemplate 1.4 Dieter From dieter@handshake.de Wed Aug 15 20:30:52 2001 From: dieter@handshake.de (Dieter Maurer) Date: Wed, 15 Aug 2001 21:30:52 +0200 (CEST) Subject: [ZPT] Strange permission error with the new release.. In-Reply-To: <200108150117.f7F1HMp93114@obsidian.spvi.com> References: <200108150117.f7F1HMp93114@obsidian.spvi.com> Message-ID: <15226.52716.865966.32823@lindm.dm> Steve Spicklemire writes: > I'm trying the new release on 2.4.0 and when I create a new ZPT and > try to view the default document, I'm getting the following traceback. > When I change it to here/title, it's fine. Am *I* doing something wrong? I just tried it: ZopeCVS (2.4+) and latest PageTemplate installation. Works fine for me.... Dieter From dieter@handshake.de Wed Aug 15 20:04:18 2001 From: dieter@handshake.de (Dieter Maurer) Date: Wed, 15 Aug 2001 21:04:18 +0200 (CEST) Subject: [ZPT] ANN: PageTemplates 1.4.0, TAL 1.4.0, ZTUtils 1.1.0 In-Reply-To: <013a01c124d8$a58cd290$1c64a8c0@PBN> References: <3B7824C3.6060305@zope.com> <013a01c124d8$a58cd290$1c64a8c0@PBN> Message-ID: <15226.51122.267680.660378@lindm.dm> Peter Bengtsson writes: > When will we see ZPT in the help of Zope? > It's annoying to see the PROBLEM(100) > [...]/zope/lib/python/Products/PageTemplates/help > error message all the time. If that's your only problem, just create an empty folder.... Dieter From evan@4-am.com Wed Aug 15 21:15:58 2001 From: evan@4-am.com (Evan Simpson) Date: Wed, 15 Aug 2001 16:15:58 -0400 Subject: [ZPT] Re: [Zope] using ZPT/TAL without zope References: Message-ID: <3B7AD87E.10508@4-am.com> smoerk@gmx.de wrote: > is it possible to use ZPT without Zope in Python program? It is possible to use PageTemplates without Zope, not ZPT (short for Zope Page Templates). With ExtensionClass, TAL, ZTUtils, and PageTemplates on your Python path, you should be able to: >>> from PageTemplates.PageTemplate import PageTemplate >>> pt = PageTemplate() >>> pt.write('''

???

''') >>> print pt(x=1)

11

>>> Cheers, Evan @ 4-am & Zope From evan@zope.com Wed Aug 15 22:28:12 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 15 Aug 2001 17:28:12 -0400 Subject: [ZPT] table loop References: <027d01c125b9$485ff430$0901a8c0@intranet.madisoncomunicacao.com.br> Message-ID: <3B7AE96C.9090506@zope.com> Georges J Baladi Jr wrote: > a folder with 19 images > > a page template that display the images inside a table. I want to put > 5 images in a row. You can't make partial tags with TAL statements, but you can do what you want in a totally different way: ## Script (Python) "getGroupsOfN" ##parameters=seq, at_a_time ## from ZTUtils import Batch b = Batch(seq, at_a_time, orphan=0) batches = [b] while b.next: b = b.next batches.append(b) return batches # End Script
> I think Zope and ZPT are the best solution for web publishing. It´s an > excellent software. Thanks, Evan @ Zope From richard@bizarsoftware.com.au Thu Aug 16 00:55:27 2001 From: richard@bizarsoftware.com.au (Richard Jones) Date: Thu, 16 Aug 2001 09:55:27 +1000 Subject: [ZPT] Cooking takes very long In-Reply-To: <15226.16487.543540.599611@lindm.dm> References: <15226.16487.543540.599611@lindm.dm> Message-ID: <01081609552701.01472@ike> On Wednesday 15 August 2001 19:27, Dieter Maurer wrote: > We have a site with about 20 ZPTs, each about some kB in size. > When the folders that contain these ZPT are shown in the > ZMI's left frame (TreeView), then the construction of this frame > takes excessive time -- something like 1 CPU minute (on a > relatively fast Sun server). We are also seeing this speed problem. We've taken to disabling PT cooking in a lot of places (most times, the page is now cooked when a user requests it the first time). We've got about 8 folders of 10 templates, and that's going to grow considerably over time. Even cooking just one folder of 10 templates of around 10-15kb each takes quite a while on a "slow" processor (500Mhz x86 or slower). One of our outstanding issues is to figure how to not cook uncooked PTs when users delete folders of them :) Richard From steve@spvi.com Thu Aug 16 05:01:28 2001 From: steve@spvi.com (Steve Spicklemire) Date: Wed, 15 Aug 2001 23:01:28 -0500 Subject: [ZPT] Strange permission error with the new release.. In-Reply-To: <15226.52716.865966.32823@lindm.dm> Message-ID: <200108160402.f7G42hp00470@obsidian.spvi.com> Thanks for the datapoint Dieter.. *but* It's very strange. I've tried two different operating systems, two different clean installations of 2.4.0, and an update to the latest CVS version and I still get this error. I guess it's debugger time..... -steve On Wednesday, August 15, 2001, at 02:30 PM, Dieter Maurer wrote: > Steve Spicklemire writes: >> I'm trying the new release on 2.4.0 and when I create a new ZPT and >> try to view the default document, I'm getting the following traceback. >> When I change it to here/title, it's fine. Am *I* doing something >> wrong? > I just tried it: > > ZopeCVS (2.4+) and latest PageTemplate installation. > > Works fine for me.... > > > Dieter From steve@spvi.com Thu Aug 16 05:48:14 2001 From: steve@spvi.com (Steve Spicklemire) Date: Wed, 15 Aug 2001 23:48:14 -0500 Subject: [ZPT] Strange permission error with the new release.. In-Reply-To: <200108160402.f7G42hp00470@obsidian.spvi.com> Message-ID: <200108160449.f7G4nTp00622@obsidian.spvi.com> Hi Folks, Aha.. stepping through with the debugger it seems that the problem is due to the fact that this particular instance was living at the root of my Zope. The default Zope security policy now appears to be implemented in a '.c' extension.. so it's trickier to debug, but it's clearly something to do with the fact that when these things are at the root they are getting title_or_id from the Application object (which has it's own implimentation) rather than a Folder (which I think inherits it from SimpleItem). Strange that I have no trouble with title_or_id in a DTML Method at the root. How is security treated differently in a ZPT? thanks, -steve On Wednesday, August 15, 2001, at 11:01 PM, Steve Spicklemire wrote: > Thanks for the datapoint Dieter.. *but* > > It's very strange. I've tried two different operating systems, two > different clean installations of 2.4.0, and an update to the latest CVS > version and I still get this error. I guess it's debugger time..... > > -steve > > On Wednesday, August 15, 2001, at 02:30 PM, Dieter Maurer wrote: > >> Steve Spicklemire writes: >>> I'm trying the new release on 2.4.0 and when I create a new ZPT and >>> try to view the default document, I'm getting the following traceback. >>> When I change it to here/title, it's fine. Am *I* doing something >>> wrong? >> I just tried it: >> >> ZopeCVS (2.4+) and latest PageTemplate installation. >> >> Works fine for me.... >> >> >> Dieter From dieter@handshake.de Thu Aug 16 18:03:04 2001 From: dieter@handshake.de (Dieter Maurer) Date: Thu, 16 Aug 2001 19:03:04 +0200 (CEST) Subject: [ZPT] [Patch] Delay cooking Message-ID: <15227.64712.427402.218469@lindm.dm> Before a ZPT can be used, it must be cooked. Cooking essentially means parsing the template and transforming it into an internal object. The current ZPT implementation performs cooking immediately when the ZPT is loaded from the ZODB. This may become a problem, as cooking may take a long time. For example, if you have a folder with lots of ZPT's and the folder get displays in the left frame of the ZMI for the first time, then all contained ZPT's are loaded. It can take minutes before the tree display is finally build. There is a patch (ZPT - delay cooking) at URL:http://www.dieter.handshake.de/pyprojects/zope that delays cooking until the ZPT is actually used for something. This speeds up initial operations considerably. Dieter From evan@zope.com Thu Aug 16 18:42:54 2001 From: evan@zope.com (Evan Simpson) Date: Thu, 16 Aug 2001 13:42:54 -0400 Subject: [ZPT] CVS: Packages/ZTUtils - CHANGES.txt:1.2 Zope.py:1.3 Message-ID: <200108161742.f7GHgsZ29974@cvs.baymountain.com> Update of /cvs-repository/Packages/ZTUtils In directory cvs.zope.org:/tmp/cvs-serv29966 Modified Files: CHANGES.txt Zope.py Log Message: Fix incompatibilities and attribution === Packages/ZTUtils/CHANGES.txt 1.1 => 1.2 === file HISTORY.txt. - Version 1.1.0 + Version 1.1.1 Features Added + - Used an algorithm submitted by Tino Wildenhain to add + Roman numeral support to Iterators. + - TreeMakers have a setChildAccess() method that you can use to control tree construction. Child nodes can be accessed through either an attribute name or callback function. @@ -38,3 +41,4 @@ Bugs Fixed + - Version 1.1.0 broke on Python 1.5.2 and Zope <2.4 === Packages/ZTUtils/Zope.py 1.2 => 1.3 === from Batch import Batch from Products.ZCatalog.Lazy import Lazy -from AccessControl.ZopeGuards import guarded_getitem -from AccessControl import getSecurityManager, Unauthorized +from AccessControl import getSecurityManager from string import split, join from types import StringType, ListType, IntType, FloatType from DateTime import DateTime +try: + from AccessControl.ZopeGuards import guarded_getitem +except ImportError: + Unauthorized = 'Unauthorized' + def guarded_getitem(object, index): + v = object[index] + if getSecurityManager().validate(object, object, index, v): + return v + raise Unauthorized, 'unauthorized access to element %s' % `i` +else: + from AccessControl import Unauthorized + class LazyFilter(Lazy): # A LazyFilter that checks with the security policy @@ -128,24 +139,27 @@ e=self._eindex skip = self._skip while i > ind: + e = e + 1 try: - e=e+1 try: v = guarded_getitem(s, e) - except Unauthorized, vv: + except 'Unauthorized', vv: if skip is None: msg = '(item %s): %s' % (index, vv) raise Unauthorized, msg, sys.exc_info()[2] - continue - if skip and not getSecurityManager().checkPermission(skip, v): - continue - if test is None or test(v): - data.append(v) - ind=ind+1 + skip_this = 1 + else: + skip_this = 0 except IndexError: del self._test del self._seq del self._eindex raise IndexError, index + if skip_this: continue + if skip and not getSecurityManager().checkPermission(skip, v): + continue + if test is None or test(v): + data.append(v) + ind=ind+1 self._eindex=e return data[i] From alan runyan" http://www.zopelabs.com/ - a Zope Cookbook is in need of ZPT Examples/Recipes if anyone has some really interesting PageTemplate examples they could send me (I will post them) or post to ZOPELABS (you need to Join to post), I would appreciate it. Especially showing off METAL, ZTUtils, examples that are harder to do in ZPT than in DTML. I have a few contracts that will soak up my free time for the next 2-3 months. I just wanted to send a plea out for interesting ZPT Recipes to the community. I will be focusing on CMF examples in the next few months. All my CMF code will now have PageTemplates and no DTML. Thanks to ZPT development effort. I am sorry I didnt pick up on them earlier they are wonderful. The first time I saw them they looked really foreign. Now its second nature. Although, sometimes I have to kinda step-back a few seconds and say, 'where do i put that repeat? ' but its gorgeous -- thanks. ~runyaga From andrew@malcolmson.ca Fri Aug 17 17:34:02 2001 From: andrew@malcolmson.ca (Andrew Malcolmson) Date: Fri, 17 Aug 2001 12:34:02 -0400 Subject: [ZPT] Re: [Zope] using ZPT/TAL without zope Message-ID: <000001c1273a$6eb9a090$0100a8c0@bx350> This is a multi-part message in MIME format. ------=_NextPart_000_0001_01C12718.E7AB0DD0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This didn't work for me. I put TAL, ZTUtils, and PageTemplates (current versions from http://www.zope.org/Members/4am/ZPT) on the path of my standalone Python 2.1 installation and extracted ExtensionClass from Zope and put that on the path as well. When I try the example below, I get an import error indicating that Acquisition is also needed, after which ComputedAttribute is needed etc. Thanks for ideas. > is it possible to use ZPT without Zope in Python program? It is possible to use PageTemplates without Zope, not ZPT (short for Zope Page Templates). With ExtensionClass, TAL, ZTUtils, and PageTemplates on your Python path, you should be able to: >>> from PageTemplates.PageTemplate import PageTemplate >>> pt = PageTemplate() >>> pt.write('''

???

''') >>> print pt(x=1)

11

------=_NextPart_000_0001_01C12718.E7AB0DD0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

This didn’t work for me.  = I put TAL, ZTUtils, and PageTemplates (current versions from http://www.zope.org/Members/= 4am/ZPT) on the path of my standalone Python 2.1 installation and extracted ExtensionClass from Zope and put that on the path as well.  =

 

When I try the example below, I get an import error indicating that = Acquisition is also needed, after which ComputedAttribute = is needed etc.

 

Thanks for ideas.

 

 

> is it possible to use ZPT without Zope in = Python program?

 

It is possible to use PageTemplates without = Zope, not ZPT (short for =

Zope Page Templates).  With ExtensionClass, TAL, ZTUtils, and =

PageTemplates on your Python path, you should be able to:

 

>>> from PageTemplates.PageTemplate import PageTemplate

>>> pt =3D PageTemplate()

 >>> pt.write('''<p = tal:define=3D"x = options/x"

...       &nbs= p;     tal:content=3D"python:x+1">???&l= t;/p>''')

 >>> print pt(x=3D1)

<p>11</p>

 

------=_NextPart_000_0001_01C12718.E7AB0DD0-- From evan@zope.com Fri Aug 17 17:54:13 2001 From: evan@zope.com (Evan Simpson) Date: Fri, 17 Aug 2001 12:54:13 -0400 Subject: [ZPT] Request for PageTemplate examples References: <001301c12736$b2afafa0$1701640a@pythonic> Message-ID: <3B7D4C35.4040200@zope.com> alan runyan wrote: > http://www.zopelabs.com/ - a Zope Cookbook is in need of ZPT > Examples/Recipes I have added two, and will try to remember to add more. Andrew Malcolmson wrote: > When I try the example below, I get an import error indicating that > Acquisition is also needed, after which ComputedAttribute is needed etc. One of them lists the C extensions from Zope needed to run Page Templates. Cheers, Evan @ Zope From chris@chriscurvey.com Sat Aug 18 02:09:08 2001 From: chris@chriscurvey.com (Chris Curvey) Date: Fri, 17 Aug 2001 21:09:08 -0400 Subject: [ZPT] permissions getting to python modules? Message-ID: <3B7DC034.748CF146@bellatlantic.net> I'm hoping someone will give me an "A-ha!" moment here. I'm trying to get a page to show the current date (e.g. "August 17"). I was building up my page and came up with this: The title For the Week of Date But when I try to test it, Zope starts asking for username and password again. (Not only that, but I can't seem to get to anything anymore, no matter how many times I put in the right username and password.) I think I'm missing something in security, but I can't figure out what. My assumption is that you need special security to call the "time" module because it's outside of Zope. -Chris P.S. I know that the given code will give me a tuple of time values instead of time, I'll give extra credit to anyone who can start me down the path of converting the tuple to "August 17" -- Chris Curvey Curvey Consulting http://www.chriscurvey.com From chris@chriscurvey.com Sat Aug 18 15:46:06 2001 From: chris@chriscurvey.com (Chris Curvey) Date: Sat, 18 Aug 2001 10:46:06 -0400 Subject: [ZPT] permissions getting to python modules? References: <3B7DC034.748CF146@bellatlantic.net> Message-ID: <3B7E7FAD.4F3ED41D@bellatlantic.net> Found it. In order to access module besides string, math and random from ZPT, you need to tell Zope that it's OK to run it. in PageTemplates/__init__.py, add the following lines: from Products.PythonScripts.Utility import allow_module allow_module("time") # or whatever module you want to allow folks to use (I put these lines before "def initialize", I don't know if the location is important.) I'm uncomfortable changing the __init__.py script for someone else's product. Is there a way around this? Chris Curvey wrote: > I'm hoping someone will give me an "A-ha!" moment here. > > I'm trying to get a page to show the current date (e.g. "August 17"). I > was building up my page and came up with this: > > > > The title > > > > > For the Week of tal:replace="python:time.time()">Date > > > > But when I try to test it, Zope starts asking for username and password > again. (Not only that, but I can't seem to get to anything anymore, no > matter how many times I put in the right username and password.) > > I think I'm missing something in security, but I can't figure out what. > My assumption is that you need special security to call the "time" > module because it's outside of Zope. > > -Chris > > P.S. I know that the given code will give me a tuple of time values > instead of time, I'll give extra credit to anyone who can start me down > the path of converting the tuple to "August 17" > > -- > Chris Curvey > Curvey Consulting > http://www.chriscurvey.com > > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt -- Chris Curvey Curvey Consulting http://www.chriscurvey.com From evan@zope.com Sat Aug 18 16:47:01 2001 From: evan@zope.com (Evan Simpson) Date: Sat, 18 Aug 2001 11:47:01 -0400 Subject: [ZPT] permissions getting to python modules? References: <3B7DC034.748CF146@bellatlantic.net> <3B7E7FAD.4F3ED41D@bellatlantic.net> Message-ID: <004701c127fd$08ff4200$0100a8c0@evansys> From: "Chris Curvey" > Found it. In order to access module besides string, math and random from > ZPT, you need to tell Zope that it's OK to run it. [snip] > I'm uncomfortable changing the __init__.py script for someone else's > product. Is there a way around this? In this particular case, you probably should be using the Zope 'DateTime' class instead of the Python 'time' module. It has a lot of date and time formatting options, and is available in Page Templates either through the path "modules/DateTime/DateTime" or directly in Python expressions as "DateTime", for example: "python:DateTime().Date()". In general, when you want to expose modules to restricted code, you're best off creating your own Product (just a subdirectory of the Products directory with an __init__.py) called something like "myModuleSecurity" and placing the security calls in that. Cheers, Evan @ Zope From rbickers-dated-998760418.d76a7d@logicetc.com Sat Aug 18 18:26:58 2001 From: rbickers-dated-998760418.d76a7d@logicetc.com (Ron Bickers) Date: Sat, 18 Aug 2001 13:26:58 -0400 Subject: [ZPT] permissions getting to python modules? In-Reply-To: <004701c127fd$08ff4200$0100a8c0@evansys> Message-ID: > -----Original Message----- > From: zpt-admin@zope.org [mailto:zpt-admin@zope.org]On Behalf Of Evan > Simpson > In general, when you want to expose modules to restricted code, you're > best off creating your own Product (just a subdirectory of the Products > directory with an __init__.py) called something like "myModuleSecurity" > and placing the security calls in that. Cool. This is a handy Zope tip that belongs in an FAQ or in a tips document. Is it already? Thanks! _______________________ Ron Bickers Logic Etc, Inc. From dieter@handshake.de Sat Aug 18 21:14:22 2001 From: dieter@handshake.de (Dieter Maurer) Date: Sat, 18 Aug 2001 22:14:22 +0200 (CEST) Subject: [ZPT] permissions getting to python modules? In-Reply-To: <3B7DC034.748CF146@bellatlantic.net> References: <3B7DC034.748CF146@bellatlantic.net> Message-ID: <15230.52382.57293.872470@lindm.dm> Chris Curvey writes: > I'm trying to get a page to show the current date (e.g. "August 17"). I > was building up my page and came up with this: "here/ZopeTime" would give you the full date, "python: here.ZopeTime().strftime(....)" would give you precise control over the format. Dieter From chrisw@nipltd.com Sun Aug 19 21:47:45 2001 From: chrisw@nipltd.com (Chris Withers) Date: Sun, 19 Aug 2001 21:47:45 +0100 Subject: [ZPT] TAL fragile when interpreting &entities; References: Message-ID: <3B8025F1.AFCED1B0@nipltd.com> Jean Jordaan wrote: > > Filed as 445196. > Shortcut to the issue at SourceForge: > http://makeashorterlink.com/index.php?M1762170 Nice to see this one dead, but I think I found an even nastier one :-S #453059 http://makeashorterlink.com/index.php?F24412B0 (nice tool by the way, we like short links ;-) Help! My brain can't even comprehend what's causing this... cheers, Chris From mail@peterbe.com Mon Aug 20 09:01:36 2001 From: mail@peterbe.com (Peter Bengtsson) Date: Mon, 20 Aug 2001 10:01:36 +0200 Subject: [ZPT] permissions getting to python modules? References: <3B7DC034.748CF146@bellatlantic.net> <3B7E7FAD.4F3ED41D@bellatlantic.net> Message-ID: <00b501c12950$1524f2b0$1c64a8c0@PBN> ----- Original Message ----- From: "Chris Curvey" To: Cc: Sent: Saturday, August 18, 2001 4:46 PM Subject: Re: [ZPT] permissions getting to python modules? > Found it. In order to access module besides string, math and random from > ZPT, you need to tell Zope that it's OK to run it. > > in PageTemplates/__init__.py, add the following lines: > > from Products.PythonScripts.Utility import allow_module > allow_module("time") # or whatever module you want to allow folks to use > > (I put these lines before "def initialize", I don't know if the location is > important.) > > I'm uncomfortable changing the __init__.py script for someone else's > product. Is there a way around this? http://www.zope.org/Members/Caseman/Dynamic_Hotfix A better way not to poke in somebody else's code. > > Chris Curvey wrote: > > > I'm hoping someone will give me an "A-ha!" moment here. > > > > I'm trying to get a page to show the current date (e.g. "August 17"). I > > was building up my page and came up with this: > > > > > > > > The title > > > > > > > > > > For the Week of > tal:replace="python:time.time()">Date > > > > > > > > But when I try to test it, Zope starts asking for username and password > > again. (Not only that, but I can't seem to get to anything anymore, no > > matter how many times I put in the right username and password.) > > > > I think I'm missing something in security, but I can't figure out what. > > My assumption is that you need special security to call the "time" > > module because it's outside of Zope. > > > > -Chris > > > > P.S. I know that the given code will give me a tuple of time values > > instead of time, I'll give extra credit to anyone who can start me down > > the path of converting the tuple to "August 17" > > > > -- > > Chris Curvey > > Curvey Consulting > > http://www.chriscurvey.com > > > > _______________________________________________ > > ZPT mailing list > > ZPT@zope.org > > http://lists.zope.org/mailman/listinfo/zpt > > -- > Chris Curvey > Curvey Consulting > http://www.chriscurvey.com > > > > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt From bkc@murkworks.com Wed Aug 22 18:16:23 2001 From: bkc@murkworks.com (Brad Clements) Date: Wed, 22 Aug 2001 13:16:23 -0400 Subject: [ZPT] Latest Page Templates broke my working ZClasses! Message-ID: <3B83B0EA.5680.2F339567@localhost> I have a Product with some ZClasses that are based on CMF base objects. Under ZPT 1.3, what I describe below worked. Now after upgrading to 1.4 I find that I can't call manage_changeProperties from within a ZPT. I have a ZPT named 'Edit' in the ZClasses Methods folder. I looks like this:

Attributes Changed
Basically the hidden "DoEditSheet" input field kicks off a call to manage_changeProperties. This used to work in 1.3 Now, I get this traceback: Unauthorized You are not authorized to access this resource. Username and password are not correct. Traceback (innermost last): File /usr/holmes/AdkWood/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /usr/holmes/AdkWood/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/holmes/AdkWood/lib/python/ZPublisher/Publish.py, line 162, in publish File /usr/holmes/Zope-2.3.3/lib/python/ZPublisher/BaseRequest.py, line 463, in traverse File /usr/holmes/AdkWood/lib/python/ZPublisher/HTTPResponse.py, line 588, in unauthorized Unauthorized: (see above) As a check, I can manage the zclass instance properties from ZMI. Further, I created a Python Script and made it the target of the form action and it works: if REQUEST.has_key('DoEditSheet'): context.propertysheets.General.manage_changeProperties(REQUEST) REQUEST.RESPONSE.redirect(REQUEST['URL1']+'/Edit') This is a very weird error "password not correct" Any idea how to fix? Brad Clements, bkc@murkworks.com (315)268-1000 http://www.murkworks.com (315)268-9812 Fax netmeeting: ils://ils.murkworks.com AOL-IM: BKClements From rbickers-dated-999110743.8f660b@logicetc.com Wed Aug 22 19:45:43 2001 From: rbickers-dated-999110743.8f660b@logicetc.com (Ron Bickers) Date: Wed, 22 Aug 2001 14:45:43 -0400 Subject: [ZPT] Expand macros when editing Message-ID: I understand (I believe) that the purpose of the "Expand macros when editing" feature is to provide a complete template for when the page is being edited in an HTML editor. However, I don't need the whole template to know what I'm doing on each page, so expanding doesn't buy me anything. In fact, it adds a large amount of clutter when I try to modify the pages through the Web. I found that I can default this to off by changing 'expand = 0' in the product, but I have to remember to do this every time I upgrade. I don't believe there's a way to "unexpand" (perhaps because it's not possible?), so I end up having to go back and clean up the expansion if I forget to turn it off. This is minor but sufficiently annoying. Is there something non-hackish I can do to keep this feature off through upgrades? Thanks! _______________________ Ron Bickers Logic Etc, Inc. From evan@zope.com Wed Aug 22 20:02:22 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 22 Aug 2001 15:02:22 -0400 Subject: [ZPT] Expand macros when editing References: Message-ID: <3B8401BE.8060501@zope.com> Ron Bickers wrote: > I found that I can default this to off by changing 'expand = 0' in the > product, but I have to remember to do this every time I upgrade. > I don't believe there's a way to "unexpand" (perhaps because it's not > possible?), so I end up having to go back and clean up the expansion > if I forget to turn it off. I already have a to-do item to make expansion/unexpansion more useful and regular. This includes: - When a template is unexpanded, use-macro bodies should be "stripped". This means omitting the contents of used macros, apart from filled slots. - There should be a way to remember (cookie?) which state you prefer, without hardcoding it. Cheers, Evan @ Zope From rbickers-dated-999112392.5ef678@logicetc.com Wed Aug 22 20:13:12 2001 From: rbickers-dated-999112392.5ef678@logicetc.com (Ron Bickers) Date: Wed, 22 Aug 2001 15:13:12 -0400 Subject: [ZPT] Expand macros when editing In-Reply-To: <3B8401BE.8060501@zope.com> Message-ID: > -----Original Message----- > From: Evan Simpson [mailto:evan@zope.com] > I already have a to-do item to make expansion/unexpansion more useful > and regular. This includes: Excellent. > - There should be a way to remember (cookie?) which state you prefer, > without hardcoding it. I've often thought about how nice it might be to have some special place in the Zope tree to assign defaults for different products. Like a registry, I suppose. I have several products where I wish defaults were different but they're hard coded in the product. The products would have to support it, of course, but it would be easier than, say, every product creating an "add" form that has a bunch of options with the defaults filled in. Is this a worthy suggestion for the collector? _______________________ Ron Bickers Logic Etc, Inc. From evan@zope.com Wed Aug 22 20:34:32 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 22 Aug 2001 15:34:32 -0400 Subject: [ZPT] Expand macros when editing References: Message-ID: <3B840948.1070701@zope.com> Ron Bickers wrote: > I've often thought about how nice it might be to have some special place in > the Zope tree to assign defaults for different products. If the "Control Panel" lived up to its name, I would expect to be able to go to /Control_Panel/Products/FooProduct and see a "Configure" tab. I think this would make a fine fishbowl proposal. On the other hand, the new Coponent Architecture may solve this once and for all. Cheers, Evan @ Zope From rbickers-dated-999114050.b366dc@logicetc.com Wed Aug 22 20:40:50 2001 From: rbickers-dated-999114050.b366dc@logicetc.com (Ron Bickers) Date: Wed, 22 Aug 2001 15:40:50 -0400 Subject: [ZPT] Expand macros when editing In-Reply-To: <3B840948.1070701@zope.com> Message-ID: > -----Original Message----- > From: Evan Simpson [mailto:evan@zope.com] > If the "Control Panel" lived up to its name, I would expect to be able > to go to /Control_Panel/Products/FooProduct and see a "Configure" tab. > I think this would make a fine fishbowl proposal. On the other hand, > the new Coponent Architecture may solve this once and for all. Well duh (on me). The Control Panel didn't even cross my mind, but yeah, that would seem obvious. I'm not familiar enough with the new Component Architecture to know how it would cure the problem. Will it give ZPT a Configure tab or does it provide for some other method? _______________________ Ron Bickers Logic Etc, Inc. From evan@zope.com Wed Aug 22 21:10:54 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 22 Aug 2001 16:10:54 -0400 Subject: [ZPT] Expand macros when editing References: Message-ID: <3B8411CE.6060909@zope.com> Ron Bickers wrote: > I'm not familiar enough with the new Component > Architecture to know how it would cure the problem. No one is :-/ It's a work in progress, but one of its concepts runs like this: The Zope root contains a Service Manager. There is a way to create subfolders that have Service Managers, too. When you visit an SM, one of the things you can do there is install a "Package". This will add "Components" and "Services" to the SM. (Why the scare quotes? Because these things aren't well defined yet). You can then configure these things, and they will be available within that part of the site (the whole site, if it's the root SM). Some "Services" are "Factories", which allow you to create objects. So, in this future world, you would go to your site's Service Manager, install the ZPT Package there, then configure the "Page Template" Factory to set 'expand' off in new instances. Maybe. Cheers, Evan @ Zope From rbickers-dated-999116268.89b849@logicetc.com Wed Aug 22 21:17:47 2001 From: rbickers-dated-999116268.89b849@logicetc.com (Ron Bickers) Date: Wed, 22 Aug 2001 16:17:47 -0400 Subject: [ZPT] Expand macros when editing In-Reply-To: <3B8411CE.6060909@zope.com> Message-ID: > -----Original Message----- > From: Evan Simpson [mailto:evan@zope.com] > You can then configure these > things, and they will be available within that part of the site (the > whole site, if it's the root SM). Sounds nice. Does this mean that we may be able to define ZClasses that are only available within a particular part of the site? That would be very useful, esp. for some virtual hosting setups. > So, in this future world, you would go to your site's Service Manager, > install the ZPT Package there, then configure the "Page Template" > Factory to set 'expand' off in new instances. Maybe. I look forward to it. In the mean time, I'll change expand to 0 and wait for a ZPT setCookie to save the day. Thanks! _______________________ Ron Bickers Logic Etc, Inc. From zope@meadowbase.com Thu Aug 23 13:11:40 2001 From: zope@meadowbase.com (zope@meadowbase.com) Date: Thu, 23 Aug 2001 05:11:40 -0700 Subject: [ZPT] Page Templates in WebDAV arrive as rendered HTML Message-ID: <000001c12bcc$d9a5a980$6701a8c0@fpotter5> Hi there, I'm a ZPT newbie but experienced with Zope/DTML/Python. Also never really used WebDAV. Things I read about ZPT say that I should be able to edit them with a WebDAV client. I installed WebIFS, a Win32 WebDAV client that makes DAV content look like another drive in the file system. When I pull down a Page Template object to edit it, I get the final HTML, not the page template text itself. How can I edit a Page Template using WebDAV? Any pointers? --- Francis Potter From evan@zope.com Thu Aug 23 15:28:35 2001 From: evan@zope.com (Evan Simpson) Date: Thu, 23 Aug 2001 10:28:35 -0400 Subject: [ZPT] Page Templates in WebDAV arrive as rendered HTML References: <000001c12bcc$d9a5a980$6701a8c0@fpotter5> Message-ID: <3B851313.8040108@zope.com> zope@meadowbase.com wrote: > I installed WebIFS, a Win32 WebDAV client that makes DAV > content look like another drive in the file system. When I pull down a > Page Template object to edit it, I get the final HTML, not the page > template text itself. Most (all?) WebDAV clients don't take dynamic pages into account, and send a simple HTTP GET to load them. This gets you the rendered HTML. The z2.py start script has a "-W " argument that you can use to set up a WebDAV source port. For instance, if you add "-W 9800", Zope will send page source in response to GET requests on port #9800. You should only use WebDAV with a source port. Also, there's an issue to beware of when using a "make WebDAV server look like a mapped drive" products such as WebDrive and WebIFS. Since web page editors think that they are editing a local file, they will often perform operations that work well with a filesystem but screw up an object database. For instance, when Dreamweaver saves changes, it will create a temporary file, rename the original file, rename the temporary file into place, then delete the original file. This destroys all properties, history, and security settings of the page. Cheers, Evan @ Zope From zope@meadowbase.com Thu Aug 23 15:51:21 2001 From: zope@meadowbase.com (zope@meadowbase.com) Date: Thu, 23 Aug 2001 07:51:21 -0700 Subject: [ZPT] Page Templates in WebDAV arrive as rendered HTML In-Reply-To: <3B851313.8040108@zope.com> Message-ID: <000301c12be3$25c4f580$6701a8c0@fpotter5> > The z2.py start script has a "-W " argument that you=20 > can use to=20 > set up a WebDAV source port. For instance, if you add "-W=20 Thanks! That does the trick. > an object database. For instance, when Dreamweaver saves changes, it=20 > will create a temporary file, rename the original file, rename the=20 I'm just working with ordinary text editors, so hopefully that won't be a problem. --- Francis Potter > -----Original Message----- > From: zpt-admin@zope.org [mailto:zpt-admin@zope.org] On=20 > Behalf Of Evan Simpson > Sent: Thursday, August 23, 2001 7:29 AM > To: zope@meadowbase.com > Cc: zpt@zope.org > Subject: Re: [ZPT] Page Templates in WebDAV arrive as rendered HTML >=20 >=20 > zope@meadowbase.com wrote: > > I installed WebIFS, a Win32 WebDAV client that makes DAV > > content look like another drive in the file system. When I=20 > pull down a > > Page Template object to edit it, I get the final HTML, not the page > > template text itself. >=20 > Most (all?) WebDAV clients don't take dynamic pages into account, and=20 > send a simple HTTP GET to load them. This gets you the=20 > rendered HTML.=20 > The z2.py start script has a "-W " argument that you=20 > can use to=20 > set up a WebDAV source port. For instance, if you add "-W=20 > 9800", Zope=20 > will send page source in response to GET requests on port #9800. >=20 > You should only use WebDAV with a source port. >=20 > Also, there's an issue to beware of when using a "make WebDAV server=20 > look like a mapped drive" products such as WebDrive and=20 > WebIFS. Since=20 > web page editors think that they are editing a local file, they will=20 > often perform operations that work well with a filesystem but=20 > screw up=20 > an object database. For instance, when Dreamweaver saves changes, it=20 > will create a temporary file, rename the original file, rename the=20 > temporary file into place, then delete the original file. =20 > This destroys=20 > all properties, history, and security settings of the page. >=20 > Cheers, >=20 > Evan @ Zope >=20 >=20 > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt >=20 From waltonl@franklin.edu Thu Aug 23 18:46:02 2001 From: waltonl@franklin.edu (Lynn Walton) Date: Thu, 23 Aug 2001 12:46:02 -0500 Subject: [ZPT] Page Templates in WebDAV arrive as rendered HTML References: Message-ID: <3B85415A.7D5AF682@franklin.edu> > From: Evan Simpson > Subject: Re: [ZPT] Page Templates in WebDAV arrive as rendered HTML > > Also, there's an issue to beware of when using a "make WebDAV server > look like a mapped drive" products such as WebDrive and WebIFS. Since > web page editors think that they are editing a local file, they will > often perform operations that work well with a filesystem but screw up > an object database. For instance, when Dreamweaver saves changes, it > will create a temporary file, rename the original file, rename the > temporary file into place, then delete the original file. This destroys > all properties, history, and security settings of the page. > > Evan @ Zope > So, does this make dreamweaver worthless using WebDAV or is there some way people are using it with ZPT successfully? Lynn From evan@zope.com Thu Aug 23 19:38:05 2001 From: evan@zope.com (Evan Simpson) Date: Thu, 23 Aug 2001 14:38:05 -0400 Subject: [ZPT] Page Templates in WebDAV arrive as rendered HTML References: <3B85415A.7D5AF682@franklin.edu> Message-ID: <3B854D8D.5040100@zope.com> Lynn Walton wrote: >>Also, there's an issue to beware of when using a "make WebDAV server >>look like a mapped drive" products such as WebDrive and WebIFS. > > So, does this make dreamweaver worthless using WebDAV or is there some way people are using it > with ZPT successfully? The problem isn't with DreamWeaver, but with the combination of DreamWeaver and WebDrive. If you use DreamWeaver's native WebDAV support, checking files in and out of Zope, you'll be fine. Any tool that makes an object database look like a filesystem, as WebDrive and WebIFS do, is deceptively helpful and potential trouble. Zope objects are not files, and Folders are not directories. Cheers, Evan @ Zope From rbickers-dated-999196747.cddf10@logicetc.com Thu Aug 23 19:39:06 2001 From: rbickers-dated-999196747.cddf10@logicetc.com (Ron Bickers) Date: Thu, 23 Aug 2001 14:39:06 -0400 Subject: [ZPT] Page Templates in WebDAV arrive as rendered HTML In-Reply-To: <3B85415A.7D5AF682@franklin.edu> Message-ID: > > an object database. For instance, when Dreamweaver saves changes, it > > will create a temporary file, rename the original file, rename the > > temporary file into place, then delete the original file. This destroys > > all properties, history, and security settings of the page. > > > > Evan @ Zope > > > > So, does this make dreamweaver worthless using WebDAV or is there > some way people are using it > with ZPT successfully? I just ran some tests with DW4 and WebDAV and everything worked just fine. Nothing lost. Evan, are there specific steps that you can reproduce with DW that cause this behavior? _______________________ Ron Bickers Logic Etc, Inc. From evan@zope.com Thu Aug 23 19:56:22 2001 From: evan@zope.com (Evan Simpson) Date: Thu, 23 Aug 2001 14:56:22 -0400 Subject: [ZPT] Page Templates in WebDAV arrive as rendered HTML References: Message-ID: <3B8551D6.7040301@zope.com> Dreamweaver WebDAV + Zope = good GoLive WebDAV + Zope = good Dreamweaver + WebDrive + Zope = bad GoLive + WebDrive + Zope = potential trouble :-) Cheers, Evan @ Zope From richard@bizarsoftware.com.au Fri Aug 24 00:15:07 2001 From: richard@bizarsoftware.com.au (Richard Jones) Date: Fri, 24 Aug 2001 09:15:07 +1000 Subject: [ZPT] Page Templates in WebDAV arrive as rendered HTML In-Reply-To: <3B85415A.7D5AF682@franklin.edu> References: <3B85415A.7D5AF682@franklin.edu> Message-ID: <0108240915070Y.28818@ike> On Friday 24 August 2001 03:46, Lynn Walton wrote: > > From: Evan Simpson > > Subject: Re: [ZPT] Page Templates in WebDAV arrive as rendered HTML > > > > Also, there's an issue to beware of when using a "make WebDAV server > > look like a mapped drive" products such as WebDrive and WebIFS. Since > > web page editors think that they are editing a local file, they will > > often perform operations that work well with a filesystem but screw up > > an object database. For instance, when Dreamweaver saves changes, it > > will create a temporary file, rename the original file, rename the > > temporary file into place, then delete the original file. This destroys > > all properties, history, and security settings of the page. > > > > Evan @ Zope > > So, does this make dreamweaver worthless using WebDAV or is there some way > people are using it with ZPT successfully? That's what we've found. We the builtin FTP client in Dreamweaver. Works a treat. Richard From phil.harris@zope.co.uk Fri Aug 24 14:27:27 2001 From: phil.harris@zope.co.uk (Phil Harris) Date: Fri, 24 Aug 2001 14:27:27 +0100 Subject: [ZPT] Win32 version of ZPT for Zope2.4 Message-ID: <019601c12ca0$96c49660$5c773fc1@ml.uwcm.ac.uk> Hi all, Anyone got the thingy in the subject? tia Phil From evan@zope.com Sat Aug 25 19:48:48 2001 From: evan@zope.com (Evan Simpson) Date: Sat, 25 Aug 2001 14:48:48 -0400 Subject: [ZPT] CVS: Products/PageTemplates - Expressions.py:1.20 Message-ID: <200108251848.f7PImmX12418@cvs.baymountain.com> Update of /cvs-repository/Products/PageTemplates In directory cvs.zope.org:/tmp/cvs-serv12411 Modified Files: Expressions.py Log Message: Hack around __bobo_traverse__ validation problem. === Products/PageTemplates/Expressions.py 1.19 => 1.20 === container = None - if (has(get(object, 'aq_base', object), name) - and get(object, name) is o): + if has(o, 'im_self'): + container = o.im_self + elif (has(get(object, 'aq_base', object), name) + and get(object, name) == o): container = object if not validate(object, container, name, o): raise 'Unauthorized', name From cabrubak@inetic.com Mon Aug 27 21:17:53 2001 From: cabrubak@inetic.com (Clint Brubakken) Date: 27 Aug 2001 15:17:53 -0500 Subject: [ZPT] repeating a table cell conditionally Message-ID: <998943475.24219.91.camel@linux1.local.inetic.com> I'm pretty new to page templates, and have been reading all I could find on it, and bugging philh on #zope on open projects, and I have a question on how to do something: I have a table and a row, and I want to repeat cells over a sequence and if the current item in the sequence it a vaild object print its id in a , if not do nothing. Here is what I had, but it adds an empty pair : Year the best solution I found was : Year which actually doesn't work. Essentially I need define and condition to have a lower precedence then repeat in the tag. The solution in the TAL spceification of surrounding it with another tag can't work as no tag can come between and -- Clint Brubakken Programmer Analyst Inetic Web Development --- Black holes are where God divided by zero. From tol@tanghus.dk Mon Aug 27 21:17:41 2001 From: tol@tanghus.dk (Thomas Olsen) Date: Mon, 27 Aug 2001 22:17:41 +0200 Subject: [ZPT] repeating a table cell conditionally In-Reply-To: <998943475.24219.91.camel@linux1.local.inetic.com> References: <998943475.24219.91.camel@linux1.local.inetic.com> Message-ID: <200108272017.f7RKHfk20624@tanghus.dk> Maybe this will do it (untested): Year On Monday 27 August 2001 22:17, Clint Brubakken wrote: > I'm pretty new to page templates, and have been reading all I could find > on it, and bugging philh on #zope on open projects, and I have a > question on how to do something: > > I have a table and a row, and I want to repeat cells over a sequence > and if the current item in the sequence it a vaild object print its id > in a , if not do nothing. > Here is what I had, but it adds an empty pair : > > > tal:condition="volume" > tal:replace="volume/id">Year > > > the best solution I found was : > tal:replace="python:test(exists(path(string('here/$year'))), > '%s'% path(string('here/$year')).title_or_id(), > '')">Year > > > which actually doesn't work. > > Essentially I need define and condition to have a lower precedence then > repeat in the tag. The solution in the TAL spceification of surrounding > it with another tag can't work as no tag can come between and -- Regards, Thomas Olsen http://www.tanghus.dk From tol@tanghus.dk Mon Aug 27 21:21:35 2001 From: tol@tanghus.dk (Thomas Olsen) Date: Mon, 27 Aug 2001 22:21:35 +0200 Subject: [ZPT] dots in variable names Message-ID: <200108272021.f7RKLZj20637@tanghus.dk> shouldn't this be possible:
-- Regards, Thomas Olsen http://www.tanghus.dk From evan@zope.com Tue Aug 28 02:25:01 2001 From: evan@zope.com (Evan Simpson) Date: Mon, 27 Aug 2001 21:25:01 -0400 Subject: [ZPT] dots in variable names References: <200108272021.f7RKLZj20637@tanghus.dk> Message-ID: <002201c12f60$43e60b00$0100a8c0@evansys> From: "Thomas Olsen" > shouldn't this be possible: > >
Variables are required to be simple identifiers; A letter followed by alphanumerics and _s only. Cheers, Evan @ Zope From evan@zope.com Tue Aug 28 02:37:11 2001 From: evan@zope.com (Evan Simpson) Date: Mon, 27 Aug 2001 21:37:11 -0400 Subject: [ZPT] repeating a table cell conditionally References: <998943475.24219.91.camel@linux1.local.inetic.com> Message-ID: <003801c12f61$f6d6f3e0$0100a8c0@evansys> From: "Clint Brubakken" > > tal:condition="volume" > tal:replace="volume/id">Year You could write an ugly filter/map/lambda, or put the logic in a Script, but unless you're using a tool that complains bitterly about it, I would go ahead and use: Year Cheers, Evan @ Zope From evan@zope.com Tue Aug 28 02:39:10 2001 From: evan@zope.com (Evan Simpson) Date: Mon, 27 Aug 2001 21:39:10 -0400 Subject: [ZPT] repeating a table cell conditionally References: <998943475.24219.91.camel@linux1.local.inetic.com> <200108272017.f7RKHfk20624@tanghus.dk> Message-ID: <004401c12f62$3e966a30$0100a8c0@evansys> From: "Thomas Olsen" > tal:omit-tag="python:1" Just so you know, this is identical to writing tal:omit-tag="", but less efficient. Cheers, Evan @ Zope From tol@tanghus.dk Tue Aug 28 08:24:04 2001 From: tol@tanghus.dk (Thomas Olsen) Date: Tue, 28 Aug 2001 09:24:04 +0200 Subject: [ZPT] repeating a table cell conditionally In-Reply-To: <004401c12f62$3e966a30$0100a8c0@evansys> References: <998943475.24219.91.camel@linux1.local.inetic.com> <200108272017.f7RKHfk20624@tanghus.dk> <004401c12f62$3e966a30$0100a8c0@evansys> Message-ID: <200108280724.f7S7O7J22116@tanghus.dk> Ok - great :-) I wasn't really aware how to use it when the tag should always be omitted. Your TRW (tm) is a bit cleaner too :-) On Tuesday 28 August 2001 03:39, Evan Simpson wrote: > From: "Thomas Olsen" > > > tal:omit-tag="python:1" > > Just so you know, this is identical to writing tal:omit-tag="", but less > efficient. > > Cheers, > > Evan @ Zope -- Regards, Thomas Olsen http://www.tanghus.dk From tol@tanghus.dk Tue Aug 28 08:25:27 2001 From: tol@tanghus.dk (Thomas Olsen) Date: Tue, 28 Aug 2001 09:25:27 +0200 Subject: [ZPT] dots in variable names In-Reply-To: <002201c12f60$43e60b00$0100a8c0@evansys> References: <200108272021.f7RKLZj20637@tanghus.dk> <002201c12f60$43e60b00$0100a8c0@evansys> Message-ID: <200108280725.f7S7PRs22119@tanghus.dk> I can see the reasons for it - just wanted to please the webdesigners... On Tuesday 28 August 2001 03:25, Evan Simpson wrote: > From: "Thomas Olsen" > > > shouldn't this be possible: > > > >
> > Variables are required to be simple identifiers; A letter followed by > alphanumerics and _s only. > > Cheers, > > Evan @ Zope -- Regards, Thomas Olsen http://www.tanghus.dk From dieter@handshake.de Mon Aug 27 20:49:40 2001 From: dieter@handshake.de (Dieter Maurer) Date: Mon, 27 Aug 2001 21:49:40 +0200 (CEST) Subject: [ZPT] [Bug] Unauthorized with "map" and Z SQL Methods Message-ID: <15242.42068.68374.131475@lindm.dm> I would like to let you know, that applying "map" to "Z SQL Method" results in a Tales expression may cause a weird exception with ZPT 1.4 and Zope 2.3.3: Error type: Unauthorized Error value: __len__ Wrapping the "Shared.DC.ZRDB.Results.Results" instance into a "list(...)" is a work around. More info: ZPT tracker item 51. Dieter From mail@peterbe.com Wed Aug 29 09:59:51 2001 From: mail@peterbe.com (Peter Bengtsson) Date: Wed, 29 Aug 2001 10:59:51 +0200 Subject: [ZPT] going crazy with sequence sort Message-ID: <00c801c1306b$7f03e480$1c64a8c0@PBN> (zope 2.4.0) How do I do http://www.zopelabs.com/cookbook/996746739 or from DocumentTemplate import sequence for a in sequence.sort(objects,(('bobobase_modification_time'),),): ...in ZPT? Cheers, Peter From jwm@plain.co.nz Wed Aug 29 14:28:47 2001 From: jwm@plain.co.nz (John Morton) Date: Thu, 30 Aug 2001 01:28:47 +1200 Subject: [ZPT] Is PageTemplates doing xhtml conversion? Should it? Message-ID: <0108300128470G.00404@subterraneans> I've been playing around with HTML tidy[1], using it to test some page=20 templates that are part of a skin for a CMF product I've written. The -as= xml=20 flag is very useful for finding non-xhtml compliance problems in the=20 templates, and various other goodies (you're not suppose to use a span in= side=20 a select, for example so you have to use optgroup, but they mess up the=20 rendering in konqueror from kde 2.1...). Anyway, upon using the date widget template I wrote inside Zope, I kept getting a problem with the javascript I was using. A quick glance at the=20 source showed that the select tags had both onchange and onChange attribu= tes,=20 the first being the source version, and the second being the attribute th= at=20 was supposed to replace the source version. So I spent an hour or so tryi= ng=20 to determine if this was a weird netscape bug before settling on it being= a=20 PageTemplates behaviour. I loaded a test template up and punched in a var= iety=20 of dodgey tags and saved it. Low and behold, all the tags droped to lower= =20 case, but the singletons (
) stayed as is. When I tried again with mac= ro=20 expansion turned off, they stayed capitalized.=20 I consider this a bug, at least in so far as it causes unexpected, 'magic= '=20 behaviour and that runs against one of the main principles of ZTP, as=20 described in the vision statement. Some possible solutions: 1) Turn off the case munging inside the METAL code. Leaving people's htm= l=20 alone won't cause any harm. 2) If TAL statements won't be processed unitl after METAL statements and= the METAL code converts elements and attributes to lower case, then it's=20 reasonable to require tal:attributes statement to only use lower case attribute arguments, and throw an error, or at least a warning, if the a= re=20 supplied something else. 3) Create a munging property that template users can set to 'none', 'transitional' and 'full'. None will leave the template alone, transitio= nal=20 will do the case munging done now, while 'full' will try to convert the = =20 document to xhtml, doing things like complaining about images without alt tags, tables without summaries, spans when you should be using the appropriate grouping tag and so forth. The first is easy, the second might break things that work now and possib= ly=20 break TAL as a stand alone library, and the third is hard work (but the m= ost=20 rewarding I think). In the mean time, avoid using capitalized attributes,= I=20 guess.=20 (But for the record, ZPT is a joy to use. Just being able to feed these=20 things into an html validator and still have them render is the hoopiest= =2E) [1] http://www.w3.org/People/Raggett/tidy/ John =20 From evan@zope.com Wed Aug 29 14:57:37 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 29 Aug 2001 09:57:37 -0400 Subject: [ZPT] going crazy with sequence sort References: <00c801c1306b$7f03e480$1c64a8c0@PBN> Message-ID: <3B8CF4D1.8020406@zope.com> Peter Bengtsson wrote: > How do I do http://www.zopelabs.com/cookbook/996746739 > I've added this to the recipe:

Outer page

:::::::::::::: page.html ::::::::::::::

Inner page

:::::::::::::: render_page.py :::::::::::::: from PageTemplates.PageTemplate import PageTemplate pt = PageTemplate() template_file = open('page.html') pt.write(template_file.read()) template_file.close() standard_page = PageTemplate() template_file = open('standard_page.html') standard_page.write(template_file.read()) template_file.close() print pt(standard_page=standard_page) From evan@zope.com Wed Aug 29 20:38:29 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 29 Aug 2001 15:38:29 -0400 Subject: [ZPT] Can macros be employed in Page Templates outside of Zope? References: <9mja88+h0o5@eGroups.com> Message-ID: <3B8D44B5.8080501@zope.com> Hamish Lawson wrote: > Is it possible to employ macros when using PageTemplates outside of > Zope? Yes, but you need to patch a bug first. This bug, which you've brought to my attention, is that the PageTemplate class needs to have base class "Base". So, in PageTemplates/PageTemplate.py: class PageTemplate(Base): Thanks, Evan @ Zope From dieter@handshake.de Wed Aug 29 20:15:42 2001 From: dieter@handshake.de (Dieter Maurer) Date: Wed, 29 Aug 2001 21:15:42 +0200 (CEST) Subject: [ZPT] Is PageTemplates doing xhtml conversion? Should it? In-Reply-To: <0108300128470G.00404@subterraneans> References: <0108300128470G.00404@subterraneans> Message-ID: <15245.16222.824856.798139@lindm.dm> John Morton writes: > .... > A quick glance at the > source showed that the select tags had both onchange and onChange attributes, > the first being the source version, and the second being the attribute that > was supposed to replace the source version.... > I consider this a bug.... I was hit by this behaviour, too. Like you, I consider it a bug. By definition, HTML tag and attribute names are case insensitive. ZPT should respect this and replace attributes independent of case. > Some possible solutions: > > 1) Turn off the case munging inside the METAL code. Leaving people's html > alone won't cause any harm. I am for this solution. > 2) If TAL statements won't be processed unitl after METAL statements and the > METAL code converts elements and attributes to lower case, then it's > reasonable to require tal:attributes statement to only use lower case > attribute arguments, and throw an error, or at least a warning, if the are > supplied something else. Please no! METAL must not touch attribute and tag names for XML (as XML names are case sensitive). Its best not to touch the names at all. > 3) Create a munging property that template users can set to 'none', > 'transitional' and 'full'. None will leave the template alone, transitional > will do the case munging done now, while 'full' will try to convert the > document to xhtml, doing things like complaining about images without > alt tags, tables without summaries, spans when you should be using the > appropriate grouping tag and so forth. Please no! Let ZPT keep simple. Do not reinvent the wheel (you have tidy, already). Dieter From phil.harris@zope.co.uk Wed Aug 29 22:32:28 2001 From: phil.harris@zope.co.uk (Phil Harris) Date: Wed, 29 Aug 2001 22:32:28 +0100 Subject: [ZPT] Is PageTemplates doing xhtml conversion? Should it? References: <0108300128470G.00404@subterraneans> <15245.16222.824856.798139@lindm.dm> Message-ID: <006a01c130d2$2ca28b80$fab7403e@screaming.net> Since XHTML is an application of XML it should be case-sensitive. At the moment it's just a recommendation that you put *all* tags and attributes lower case, but that may change, I'd say that if you're not writing in XHTML at the moment, then you will be pretty soon. ----- Original Message ----- From: "Dieter Maurer" To: "John Morton" Cc: Sent: Wednesday, August 29, 2001 8:15 PM Subject: Re: [ZPT] Is PageTemplates doing xhtml conversion? Should it? > John Morton writes: > > .... > > A quick glance at the > > source showed that the select tags had both onchange and onChange attributes, > > the first being the source version, and the second being the attribute that > > was supposed to replace the source version.... > > I consider this a bug.... > I was hit by this behaviour, too. > Like you, I consider it a bug. > > By definition, HTML tag and attribute names are case insensitive. > ZPT should respect this and replace attributes independent > of case. > > > Some possible solutions: > > > > 1) Turn off the case munging inside the METAL code. Leaving people's html > > alone won't cause any harm. > I am for this solution. > > > 2) If TAL statements won't be processed unitl after METAL statements and the > > METAL code converts elements and attributes to lower case, then it's > > reasonable to require tal:attributes statement to only use lower case > > attribute arguments, and throw an error, or at least a warning, if the are > > supplied something else. > Please no! > > METAL must not touch attribute and tag names for XML (as XML > names are case sensitive). Its best not to touch the names at all. > > > 3) Create a munging property that template users can set to 'none', > > 'transitional' and 'full'. None will leave the template alone, transitional > > will do the case munging done now, while 'full' will try to convert the > > document to xhtml, doing things like complaining about images without > > alt tags, tables without summaries, spans when you should be using the > > appropriate grouping tag and so forth. > Please no! > > Let ZPT keep simple. > Do not reinvent the wheel (you have tidy, already). > > > > Dieter > > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt From =?ISO-8859-1?B?R2VpciBC5mtob2x0?= Wed Aug 29 22:44:14 2001 From: =?ISO-8859-1?B?R2VpciBC5mtob2x0?= (=?ISO-8859-1?B?R2VpciBC5mtob2x0?=) Date: Wed, 29 Aug 2001 23:44:14 +0200 Subject: [ZPT] Is PageTemplates doing xhtml conversion? Should it? In-Reply-To: <006a01c130d2$2ca28b80$fab7403e@screaming.net> References: <0108300128470G.00404@subterraneans> <15245.16222.824856.798139@lindm.dm> <006a01c130d2$2ca28b80$fab7403e@screaming.net> Message-ID: <164233016.20010829234414@funcom.com> Hello Phil, Wednesday, August 29, 2001, 23:32:28, you wrote: PH> Since XHTML is an application of XML it should be case-sensitive. At the PH> moment it's just a recommendation that you put *all* tags and attributes PH> lower case, but that may change, I'd say that if you're not writing in XHTML PH> at the moment, then you will be pretty soon. Almost correct , but not quite : XML is case sensitive, and generically you can use whatever casing you like , but the DTD and the documents using it have to match. - AFAIK the DTD for XHTML is specified in lowercase , so unless you make your own private version of XHTML, you are stuck in lowercase... :-) -- Geir Bækholt web-developer/zopatista geirh@funcom.com funcom oslo | webdev-team From phil.harris@zope.co.uk Wed Aug 29 22:48:29 2001 From: phil.harris@zope.co.uk (Phil Harris) Date: Wed, 29 Aug 2001 22:48:29 +0100 Subject: [ZPT] Is PageTemplates doing xhtml conversion? Should it? References: <0108300128470G.00404@subterraneans> <15245.16222.824856.798139@lindm.dm> <006a01c130d2$2ca28b80$fab7403e@screaming.net> <164233016.20010829234414@funcom.com> Message-ID: <00a101c130d4$69c06120$fab7403e@screaming.net> That's what I meant to say ;) ----- Original Message ----- From: "Geir B=E6kholt" To: "Phil Harris" Cc: "Dieter Maurer" ; "John Morton" ; Sent: Wednesday, August 29, 2001 10:44 PM Subject: Re: [ZPT] Is PageTemplates doing xhtml conversion? Should it? > Hello Phil, > > Wednesday, August 29, 2001, 23:32:28, you wrote: > > PH> Since XHTML is an application of XML it should be case-sensitive. = At the > PH> moment it's just a recommendation that you put *all* tags and attributes > PH> lower case, but that may change, I'd say that if you're not writing= in XHTML > PH> at the moment, then you will be pretty soon. > > Almost correct , but not quite : > > XML is case sensitive, and generically you can use whatever casing you > like , but the DTD and the documents using it have to match. > - AFAIK the DTD for XHTML is specified in lowercase , so unless you > make your own private version of XHTML, you are stuck in lowercase... > > :-) > > -- > Geir B=E6kholt web-developer/zopatista > geirh@funcom.com funcom oslo | webdev-team > > From jwm@plain.co.nz Thu Aug 30 00:20:47 2001 From: jwm@plain.co.nz (John Morton) Date: Thu, 30 Aug 2001 11:20:47 +1200 Subject: [ZPT] Is PageTemplates doing xhtml conversion? Should it? In-Reply-To: <1503593226.20010829233334@funcom.com> References: <0108300128470G.00404@subterraneans> <1503593226.20010829233334@funcom.com> Message-ID: <0108301120470H.00404@subterraneans> On Thursday 30 August 2001 09:33, Geir B=E6kholt wrote: > Hello John, > > I have some related issues, which i am kind of puzzled by, as the > original spec of ZPT was to go fro XHTML altogether IIRC: > > Is is not currently possible to create what are single attributes in > "old-style-html" (selected, checked etc..) as correct XHTML > (selected=3D"selected") with tal:attributes.. I noticed that. It's rather weird considering all of the browsers I've te= sted=20 seem to deal with fully formed attributes without a problem. Anyone know = of=20 any counter examples? > if it also breaks onchange and its likes , i think we need to find a > way to coerce it into using the XML-parser for XHTML, but still serve > the pages with content-type text/html, to keep it working in most > browsers. It doesn't really break 'onchange' and the like, as attributes are suppos= ed=20 to be in lowercase, and browsers don't seem to be fussy about case for=20 attributes. But if you wrote the attribute as 'onChange' and expect=20 tal:attributes to replace 'onChange' you're in for a suprize.=20 > We have almost completely ditched DTML in favor of Page Templates, but > as long as it is not possible to create proper XHTML with them , i > consider them partially broken. > > hmm.. i actually think XHTML should be the default these days, with a > "pre-html4.01-mode" for those going old-style.... Which I why I like the 'choose your own munging mode' strategy. Anyone kn= ow=20 of an xhtml conversion library for python? John From jwm@plain.co.nz Thu Aug 30 00:33:59 2001 From: jwm@plain.co.nz (John Morton) Date: Thu, 30 Aug 2001 11:33:59 +1200 Subject: [ZPT] Is PageTemplates doing xhtml conversion? Should it? In-Reply-To: <15245.16222.824856.798139@lindm.dm> References: <0108300128470G.00404@subterraneans> <15245.16222.824856.798139@lindm.dm> Message-ID: <0108301133590I.00404@subterraneans> On Thursday 30 August 2001 07:15, Dieter Maurer wrote: > By definition, HTML tag and attribute names are case insensitive. > ZPT should respect this and replace attributes independent > of case. > > 2) If TAL statements won't be processed unitl after METAL statemen= ts > > and the METAL code converts elements and attributes to lower case, = then > > it's reasonable to require tal:attributes statement to only use low= er > > case attribute arguments, and throw an error, or at least a warning= , if > > the are supplied something else. > > Please no! Let me rephrase that :-) If HTML attributes are case insensitive, then=20 tal:attributes should replace attributes in a case insensitive fashion ie= =20 they should replace 'onchange' with 'onChange' if that's what you asked for. Admitedly this is probably unnecessary, and may even be problematic = for=20 XML. > Let ZPT keep simple. > Do not reinvent the wheel (you have tidy, already). Indeed. I'm thinking that writing a python wrapper around tidy so it can = be=20 used as a tool inside zope is a much better idea. John From hamish_lawson@yahoo.co.uk Thu Aug 30 09:41:04 2001 From: hamish_lawson@yahoo.co.uk (=?iso-8859-1?q?Hamish=20Lawson?=) Date: Thu, 30 Aug 2001 09:41:04 +0100 (BST) Subject: [ZPT] Can macros be employed in Page Templates outside of Zope? In-Reply-To: <3B8D44B5.8080501@zope.com> Message-ID: <20010830084104.69783.qmail@web11006.mail.yahoo.com> Evan Simpson wrote: > > Is it possible to employ macros when using PageTemplates outside of > > Zope? > > Yes, but you need to patch a bug first. Thanks for that. Macros now work if the outer page is passed as an option when the inner page is called. I thought I would try again and see whether it was now possible to refer to the outer page from within the inner page via 'container', but without avail. Presumably this is because container is normally a Zope folder (rather than a filesystem folder) and so is only defined in a Zope environment (I'm guessing by ZopePageTemplate). When calling a template outside Zope, is there some kind of object with the necessary behaviour that could be passed as a 'container' option? Hamish Lawson ____________________________________________________________ Do You Yahoo!? Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk or your free @yahoo.ie address at http://mail.yahoo.ie From Geir Bækholt Thu Aug 30 09:44:53 2001 From: Geir Bækholt (Geir Bækholt) Date: Thu, 30 Aug 2001 10:44:53 +0200 Subject: [ZPT] Is PageTemplates doing xhtml conversion? Should it? In-Reply-To: <0108300128470G.00404@subterraneans> References: <0108300128470G.00404@subterraneans> Message-ID: <7376560498.20010830104453@funcom.com> Ooops.. posted this reply to the wrong list.. Posting it to ZPT for the rec= ord.. -------------- Hello John, I have some related issues, which i am kind of puzzled by, as the original spec of ZPT was to go fro XHTML altogether IIRC: Is is not currently possible to create what are single attributes in "old-style-html" (selected, checked etc..) as correct XHTML (selected=3D"selected") with tal:attributes.. if it also breaks onchange and its likes , i think we need to find a way to coerce it into using the XML-parser for XHTML, but still serve the pages with content-type text/html, to keep it working in most browsers. We have almost completely ditched DTML in favor of Page Templates, but as long as it is not possible to create proper XHTML with them , i consider them partially broken. hmm.. i actually think XHTML should be the default these days, with a "pre-html4.01-mode" for those going old-style.... :-) Wednesday, August 29, 2001, 15:28:47, you wrote: JM> I've been playing around with HTML tidy[1], using it to test some page JM> templates that are part of a skin for a CMF product I've written. The -= asxml=20 JM> flag is very useful for finding non-xhtml compliance problems in the=20 JM> templates, and various other goodies (you're not suppose to use a span = inside=20 JM> a select, for example so you have to use optgroup, but they mess up the= =20 JM> rendering in konqueror from kde 2.1...). .... .... .. JM> [1] http://www.w3.org/People/Raggett/tidy/ JM> John --=20 Geir B=E6kholt web-developer/zopatista geirh@funcom.com funcom oslo | webdev-team From phil.harris@zope.co.uk Thu Aug 30 09:58:07 2001 From: phil.harris@zope.co.uk (Phil Harris) Date: Thu, 30 Aug 2001 09:58:07 +0100 Subject: [ZPT] skip_unauthorized? Message-ID: <01b201c13131$f5146e80$5c773fc1@ml.uwcm.ac.uk> All, After reading the docs, and not finding anything, my question is this: How do you create a tal:repeat with the same functionality as a dtml-in with skip_unauthorized? I know I could create a Python Script that emulates this, I'm just wondering if there is anything that automatically gives you this functionality? tia Phil From tol@tanghus.dk Thu Aug 30 10:14:15 2001 From: tol@tanghus.dk (Thomas Olsen) Date: Thu, 30 Aug 2001 11:14:15 +0200 Subject: [ZPT] skip_unauthorized? In-Reply-To: <01b201c13131$f5146e80$5c773fc1@ml.uwcm.ac.uk> References: <01b201c13131$f5146e80$5c773fc1@ml.uwcm.ac.uk> Message-ID: <20010830091415.C7DC97808@tol.iconmedialab.dk> On Thursday 30 August 2001 10:58, Phil Harris wrote: > How do you create a tal:repeat with the same functionality as a dtml-in > with skip_unauthorized? > I know I could create a Python Script that emulates this, I'm just > wondering if there is anything that automatically gives you this > functionality? Re: [ZPT] skip_unauthorized Date: Mon, 13 Aug 2001 15:23:11 -0400 From: Evan Simpson To: Thomas Olsen CC: zpt@zope.org Thomas Olsen wrote: > out how to implement skip_unauthorized as in: >  >  With the just-released ZTUtils 1.1.0, you can do this:
  • Cheers, Evan @ Zope > > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt -- Regards Thomas Olsen From evan@zope.com Thu Aug 30 15:13:31 2001 From: evan@zope.com (Evan Simpson) Date: Thu, 30 Aug 2001 10:13:31 -0400 Subject: [ZPT] Can macros be employed in Page Templates outside of Zope? References: <20010830084104.69783.qmail@web11006.mail.yahoo.com> Message-ID: <3B8E4A0B.1010303@zope.com> Hamish Lawson wrote: > I thought I would try again and see whether it was now possible to > refer to the outer page from within the inner page via 'container', but > without avail. Presumably this is because container is normally a Zope > folder (rather than a filesystem folder) and so is only defined in a > Zope environment (I'm guessing by ZopePageTemplate). When calling a > template outside Zope, is there some kind of object with the necessary > behaviour that could be passed as a 'container' option? You would need to write one, although it could be as simple as: class FSPageTemplateFolder: def __init__(self, basepath): self._basepath = basepath def __getitem__(self, name): fn = os.path.join(self._basepath, name) if os.path.isdir(fn): return FSPageTemplateFolder(fn) txt = open(fn).read() pt = PageTemplate() pt.write(txt) return pt This is horribly inefficient, but it's a start. Cheers, Evan @ Zope From hamish_lawson@yahoo.co.uk Thu Aug 30 17:26:16 2001 From: hamish_lawson@yahoo.co.uk (=?iso-8859-1?q?Hamish=20Lawson?=) Date: Thu, 30 Aug 2001 17:26:16 +0100 (BST) Subject: [ZPT] Can macros be employed in Page Templates outside of Zope? In-Reply-To: <3B8E4A0B.1010303@zope.com> Message-ID: <20010830162616.40960.qmail@web11008.mail.yahoo.com> Evan Simpson wrote: > You would need to write one I wondered I might have to. Thanks for the info. > although it could be as simple as: And further thanks for saving me even that effort! Cheers, Hamish ____________________________________________________________ Do You Yahoo!? Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk or your free @yahoo.ie address at http://mail.yahoo.ie From waltonl@franklin.edu Fri Aug 31 07:34:31 2001 From: waltonl@franklin.edu (Lynn Walton) Date: Fri, 31 Aug 2001 01:34:31 -0500 Subject: [ZPT] Want to build CMF type/object that has ability to handle zpt Message-ID: <3B8F2FF7.8C9C182D@franklin.edu> While I posted my dilemma regarding ways to reuse CONTENT in CMF in places that are too random in their placement to be able to have a skin that handles it for multiple documents, I didn't get a whole lot of feedback yet. I realize it is actually a deep topic and one that is probably an ongoing dilemma since there isn't an easy answer on finding the most real-world practical approach to the separation of presentation, logic and content. I thought this was well expressed earlier this week by Andrew Saywer when he said on "Re-working Breadcrumbs" We talk about this sometimes here at ZC as well. I'm drawn to both sides, I like clean, clear code, but my problem has been that if we pull all the logic out into scripts, there is a level of 'disorderliness' (for lack of a better term) which follows; there is a diminishing point of return trying to follow code when what makes up a single page is actually found in a zpt template, a couple objects which fill slots on the template, and a dozen various python scripts scattered about those pages which make up the various logic required for a page rendering. I don't know what the solution is, but I'm sure it's not the blanket approach or stripping as much logic as possible out into python scripts. I see our skins growing and growing to unmanageable levels possibly. Andrew Nevertheless, I believe what would be best for me is to proceed with trying to make a custom CMF object/type that is CMF enough to take advantage of the cataloging in the same way as more basic CMF objects like CMFDocument, but is based on ZPT (PageTemplate) enough that I can put in some ZPT in the "content". However, being the newbie that I am to CMF and ZPT and Zope (although not python), I would really appreciate all guidance on how to go about this. I know how to make new Products but I suspect there could be alot of gotchas involved with trying to use ZPT as a base, that the ZPT guru's could better predict that me. Has anyone had a need for this kind of thing or think it would be useful? Has anyone already implemented something like it they could share with me? Essentially, php, jsp, dtml, all let you throw in logic in what should be mostly presentation, and while it CAN be abused, it can also be SUPER practical to have this ability and it can sometimes be even cleaner than having the tons of small fragments of logic elsewhere (like Andrew alluded to) just because you can't mix a little in your presentation or content. Hope I'll get some feedback, ideas, practical how to steps, etc. It will be most appreciated. Thanks, Lynn P.S. I hesitated on cross posting as I don't want to annoy those who are on both lists, but I felt like it applied to both lists and there might be some people on only one or the other who could have input or have the same dilemma, and I wanted to catch all I could. : ) From mail@peterbe.com Fri Aug 31 08:19:11 2001 From: mail@peterbe.com (Peter Bengtsson) Date: Fri, 31 Aug 2001 09:19:11 +0200 Subject: [ZPT] skip_unauthorized? References: <01b201c13131$f5146e80$5c773fc1@ml.uwcm.ac.uk> <20010830091415.C7DC97808@tol.iconmedialab.dk> Message-ID: <006b01c131ee$adafc680$1c64a8c0@PBN> ok http://www.zope.org/Members/peterbe/DTML2ZPT/examples/example17/view > On Thursday 30 August 2001 10:58, Phil Harris wrote: > > How do you create a tal:repeat with the same functionality as a dtml-in > > with skip_unauthorized? > > I know I could create a Python Script that emulates this, I'm just > > wondering if there is anything that automatically gives you this > > functionality? > > Re: [ZPT] skip_unauthorized > Date: Mon, 13 Aug 2001 15:23:11 -0400 > From: Evan Simpson > To: Thomas Olsen > CC: zpt@zope.org > > Thomas Olsen wrote: > > out how to implement skip_unauthorized as in: > > > > > > > With the just-released ZTUtils 1.1.0, you can do this: > >
      >
    • > > Cheers, > > Evan @ Zope > > > > > _______________________________________________ > > ZPT mailing list > > ZPT@zope.org > > http://lists.zope.org/mailman/listinfo/zpt > > -- > Regards > Thomas Olsen > > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt From phil.harris@zope.co.uk Fri Aug 31 10:35:47 2001 From: phil.harris@zope.co.uk (Phil Harris) Date: Fri, 31 Aug 2001 10:35:47 +0100 Subject: [ZPT] functional methods. Message-ID: <032401c13200$62543880$5c773fc1@ml.uwcm.ac.uk> All, Since one of the goals of the ZPT project is to faciliate the separation of presentational and functional layers, I have a small question. What is the recommended way of calling a method that has no return value, and has no impact on the presentation of the page in question? For example, page1.html is a form that lists objects with a check box to mark for some action. Page 2.html then takes those selected and for example deletes them. Assuming that when successful there is no return value (other than the default Python return of None). How would this be called to ensure that it has no side-effects in the Page Template itself. Am I making myself clear? Not sure, but I hope you'll get my train of thought. The only way I can see of doing it is something like, This should leave no trace in the output, but the actions should be taken. Am I right/ Thanks for listening to my drivel. Phil From evan@zope.com Fri Aug 31 14:35:37 2001 From: evan@zope.com (Evan Simpson) Date: Fri, 31 Aug 2001 09:35:37 -0400 Subject: [ZPT] functional methods. References: <032401c13200$62543880$5c773fc1@ml.uwcm.ac.uk> Message-ID: <3B8F92A9.7040101@zope.com> Phil Harris wrote: > What is the recommended way of calling a method that has no return value, > and has no impact on the presentation of the page in question? Offhand, tal:define="ignored python:here.call_me(foo=1)" seems fine. > Page 2.html then takes those selected and for example deletes them. I don't use this pattern. The target of my forms is always a script. The script performs validity/sanity checking on the input, then either returns a template asking for corrections or performs the request action and redirects to the "next" page. Cheers, Evan @ Zope