From robert@redcor.ch Wed May 1 03:47:41 2002 From: robert@redcor.ch (Robert Rottermann) Date: Wed, 1 May 2002 04:47:41 +0200 Subject: [ZPT] how can I avoid path to grow huge ?? References: <001101c1f056$4c1b0f20$0a01a8c0@stravinsky> <15566.63207.291231.596181@linux.local> Message-ID: <000801c1f0ba$90158fc0$30c5a2d9@karin> Thanks dieter, As you can see, I am using only relative paths. Garten-Dekoration each use of the link adds a /scripts to the path. changing it to (adding tall:attributes): Garten-Dekoration works but seems convoluted and I fail to understand why it is neccessary. Robert ----- Original Message ----- From: "Dieter Maurer" To: "Robert Rottermann" Cc: Sent: Tuesday, April 30, 2002 9:56 PM Subject: Re: [ZPT] how can I avoid path to grow huge ?? > Robert Rottermann writes: > > I have a script which creates a dynamic links according to the folder > > content. > > This script is called from a page template with > > > > this works fine. Unfortunatelly with each click on a such a link the url > > gets longer. (scripts/xxx is added to it) > If your "xxx" contains simple relative links (without any "/"), > then this should not happen. > > Depending on your site structure, you may be able to use > "absolute_url". It should flatten out your URLs. > > > Dieter > > > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt > From zope@toenjes.com Wed May 1 18:23:26 2002 From: zope@toenjes.com (Trevor Toenjes) Date: Wed, 1 May 2002 13:23:26 -0400 Subject: [ZPT] FW: [Zope] zope page templates and image tags. tal:attributes: Message-ID: Russell, I have forwarded your email to the ZPT list where you are more likely to get ZPT help. -Trevor -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Russell Uman Sent: Wednesday, May 01, 2002 1:15 PM To: zope@zope.org Subject: [Zope] zope page templates and image tags. tal:attributes: hi. i'm trying to call an image and set the attributes of the image tag dynamically.

in each case i get an error: Error Type: AttributeError Error Value: Context instance has no attribute 'getCompilerError' so instead i am building my images like this: this seems kind of painful to me. can someone explain the error i am receiving and give me a clue about how to do this the right way in zope? should i give up on page templates and use dtml instead? pointers to useful documentation would be greatly appreciated. i've read the zope book up and down but clearly i need more fine manuals to read... thanks! _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) From casey@zope.com Wed May 1 18:47:39 2002 From: casey@zope.com (Casey Duncan) Date: Wed, 1 May 2002 13:47:39 -0400 Subject: [ZPT] FW: [Zope] zope page templates and image tags. tal:attributes: In-Reply-To: References: Message-ID: <200205011347.39430.casey@zope.com> How about: Insert whatever attributes of the image you want to set as arguments to t= he=20 tag method. hth, Casey On Wednesday 01 May 2002 01:23 pm, Trevor Toenjes allegedly wrote: > Russell, > I have forwarded your email to the ZPT list where you are more likely t= o get > ZPT help. > -Trevor >=20 >=20 > -----Original Message----- > From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of > Russell Uman > Sent: Wednesday, May 01, 2002 1:15 PM > To: zope@zope.org > Subject: [Zope] zope page templates and image tags. tal:attributes: >=20 >=20 >=20 > hi. >=20 > i'm trying to call an image and set the attributes of the image tag > dynamically. >=20 > tal:attributes=3D"border string:1">
> tal:attributes=3D"border string:1">
>=20 > in each case i get an error: >=20 > Error Type: AttributeError > Error Value: Context instance has no attribute 'getCompilerError' >=20 > so instead i am building my images like this: >=20 > string:1"> >=20 > this seems kind of painful to me. can someone explain the error i am > receiving and give me a clue about how to do this the right way > in zope? should i give up on page templates and use dtml instead? point= ers > to useful documentation would be greatly appreciated. > i've read the zope book up and down but clearly i need more fine manual= s to > read... >=20 > thanks! >=20 >=20 >=20 > _______________________________________________ > Zope maillist - Zope@zope.org > http://lists.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope-dev ) >=20 >=20 >=20 > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt >=20 From zope@toenjes.com Wed May 1 18:53:43 2002 From: zope@toenjes.com (Trevor Toenjes) Date: Wed, 1 May 2002 13:53:43 -0400 Subject: [ZPT] FW: [Zope] zope page templates and image tags. tal:attributes: In-Reply-To: <200205011347.39430.casey@zope.com> Message-ID: > How about: > > What does that look like if you usethe standard extension. like image.gif or image.jpg? > Insert whatever attributes of the image you want to set as > arguments to the > tag method. > > hth, > > Casey > > On Wednesday 01 May 2002 01:23 pm, Trevor Toenjes allegedly wrote: > > Russell, > > I have forwarded your email to the ZPT list where you are more > likely to get > > ZPT help. > > -Trevor > > > > > > -----Original Message----- > > From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of > > Russell Uman > > Sent: Wednesday, May 01, 2002 1:15 PM > > To: zope@zope.org > > Subject: [Zope] zope page templates and image tags. tal:attributes: > > > > > > > > hi. > > > > i'm trying to call an image and set the attributes of the image tag > > dynamically. > > > > > tal:attributes="border string:1">
> > > tal:attributes="border string:1">
> > > > in each case i get an error: > > > > Error Type: AttributeError > > Error Value: Context instance has no attribute 'getCompilerError' > > > > so instead i am building my images like this: > > > > > > > > this seems kind of painful to me. can someone explain the error i am > > receiving and give me a clue about how to do this the right way > > in zope? should i give up on page templates and use dtml > instead? pointers > > to useful documentation would be greatly appreciated. > > i've read the zope book up and down but clearly i need more > fine manuals to > > read... > > > > thanks! > > > > > > > > _______________________________________________ > > Zope maillist - Zope@zope.org > > http://lists.zope.org/mailman/listinfo/zope > > ** No cross posts or HTML encoding! ** > > (Related lists - > > http://lists.zope.org/mailman/listinfo/zope-announce > > http://lists.zope.org/mailman/listinfo/zope-dev ) > > > > > > > > _______________________________________________ > > ZPT mailing list > > ZPT@zope.org > > http://lists.zope.org/mailman/listinfo/zpt > > > > > > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt From casey@zope.com Wed May 1 19:08:21 2002 From: casey@zope.com (Casey Duncan) Date: Wed, 1 May 2002 14:08:21 -0400 Subject: [ZPT] FW: [Zope] zope page templates and image tags. tal:attributes: In-Reply-To: References: Message-ID: <200205011408.21030.casey@zope.com> On Wednesday 01 May 2002 01:53 pm, Trevor Toenjes allegedly wrote: > > How about: > > > > >=20 > What does that look like if you usethe standard extension. like image.= gif > or image.jpg? Then it would be=20 where "images" is the folderish doohickie containing your image objects. hth, -Casey From russ@viz.com Wed May 1 19:39:46 2002 From: russ@viz.com (Russell Uman) Date: Wed, 1 May 2002 11:39:46 -0700 Subject: [ZPT] FW: [Zope] zope page templates and image tags. tal:attributes: References: <200205011408.21030.casey@zope.com> Message-ID: <010901c1f13f$91723820$d101a8c0@viz.com> using structure if you want the actual tag. with multiple attributes comma separated, using "css_class" for the class attribute instead of the reserved word 'class'. now i will read the API appendix of the zope book before asking anymore ?s. thank you so much for your help! From dieter@handshake.de Wed May 1 20:56:14 2002 From: dieter@handshake.de (Dieter Maurer) Date: Wed, 1 May 2002 21:56:14 +0200 Subject: [ZPT] Parameter to PageTemplateFile In-Reply-To: <20020430210443.A97695@freehand.ru> References: <20020430210443.A97695@freehand.ru> Message-ID: <15568.18526.910296.591166@linux.local> Gennady Kovalev writes: > How can i put any parameters from my python class to > PageTemplateFile? > > I would like to > > my_manage = PageTemplateFile ('www/template',globals(),__name__='myname') I fear this is not provided (feature request?) > And i want test='test' parameter put to my page template and use it > It seems that your template lives inside the class (as opposed to a constructor form). In this case, you can put the attribute in the class (as a workaround, as it surely has side effects). Use a naming convention to avoid name clashes with normal Zope content... Dieter From dieter@handshake.de Wed May 1 20:15:07 2002 From: dieter@handshake.de (Dieter Maurer) Date: Wed, 1 May 2002 21:15:07 +0200 Subject: [ZPT] how can I avoid path to grow huge ?? In-Reply-To: <000801c1f0ba$90158fc0$30c5a2d9@karin> References: <001101c1f056$4c1b0f20$0a01a8c0@stravinsky> <15566.63207.291231.596181@linux.local> <000801c1f0ba$90158fc0$30c5a2d9@karin> Message-ID: <15568.16059.744234.393761@linux.local> Robert Rottermann writes: > Thanks dieter, > As you can see, I am using only relative paths. > tal:content="structure python:here.scripts.worte('selection', > 'gd')"> I said "simple relative" and explained "without containing '/'". Your path is relative but not simple: there is this "/" between "scripts" and "showGardenPage"... > changing it to (adding tall:attributes): > tal:attributes="href python:'%s/showGardenPage?roomnr=gd' % > here.scripts.absolute_url()" > tal:content="structure python:here.scripts.worte('selection', > 'gd')"> > Garten-Dekoration > > works but seems convoluted and I fail to understand why it is neccessary. When you would read the "Web Publishing" section of you might understand: When you use any relative reference, the browser adds the documents base reference. The base reference is either explicitly specified in the document with a "base" tag in the HTML "head" element or derived by the browser from the document URL (by stripping from right to the last '/'). This gives your the following options: * live with the path lengthening * avoid "/" in relative references * set the base tag appropriately (not easy) * use absolute URLs Dieter From robert@redcor.ch Thu May 2 06:20:07 2002 From: robert@redcor.ch (Robert Rottermann) Date: Thu, 2 May 2002 07:20:07 +0200 Subject: [ZPT] how can I avoid path to grow huge ?? References: <001101c1f056$4c1b0f20$0a01a8c0@stravinsky><15566.63207.291231.596181@linux.local><000801c1f0ba$90158fc0$30c5a2d9@karin> <15568.16059.744234.393761@linux.local> Message-ID: <001601c1f199$061c1ac0$30c5a2d9@karin> Thanks Dieter, I mean Thank you! This is really helping me to understand the mechanics at work. Robert ----- Original Message ----- From: "Dieter Maurer" To: "Robert Rottermann" Cc: Sent: Wednesday, May 01, 2002 9:15 PM Subject: Re: [ZPT] how can I avoid path to grow huge ?? > Robert Rottermann writes: > > Thanks dieter, > > As you can see, I am using only relative paths. > > > tal:content="structure python:here.scripts.worte('selection', > > 'gd')"> > I said "simple relative" and explained "without containing '/'". > > Your path is relative but not simple: there is this "/" between > "scripts" and "showGardenPage"... > > > changing it to (adding tall:attributes): > > > tal:attributes="href python:'%s/showGardenPage?roomnr=gd' % > > here.scripts.absolute_url()" > > tal:content="structure python:here.scripts.worte('selection', > > 'gd')"> > > Garten-Dekoration > > > > works but seems convoluted and I fail to understand why it is neccessary. > When you would read the "Web Publishing" section of > > > > you might understand: > > When you use any relative reference, the browser adds the > documents base reference. > > The base reference is either explicitly specified in the document > with a "base" tag in the HTML "head" element or derived > by the browser from the document URL (by stripping from right > to the last '/'). > > This gives your the following options: > > * live with the path lengthening > > * avoid "/" in relative references > > * set the base tag appropriately (not easy) > > * use absolute URLs > > > Dieter > > > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt > From robert@redcor.ch Thu May 2 06:48:28 2002 From: robert@redcor.ch (Robert Rottermann) Date: Thu, 2 May 2002 07:48:28 +0200 Subject: [ZPT] How to accomplish the following using ZPT and Python. References: <000001c1f078$96a17530$6400a8c0@alec> Message-ID: <002701c1f19c$fbf871c0$30c5a2d9@karin> I hope I understand your question! Do it as follows: you have three things. 1. a script called feeder returning data. It takes a parameter "which" selecting what data to return return [{'name':'Robert', 'title':'man in the moon'}.....] 2. a template calle slave.html
3. a script called homuch that says how often return 5 4. the "main" template
you end with a table of 5 tables Robert ----- Original Message ----- From: "Alec Munro" To: Sent: Tuesday, April 30, 2002 8:55 PM Subject: [ZPT] How to accomplish the following using ZPT and Python. > Hi all, > I'm a newbie, so if necessary, point out the obvious. > I've got an index page that is going to display three lists of different > types of items. > What I want is to be able to put a call in that template to a python > script, with a variable number of arguments, in the event that I want to > display less than the three lists. > I want to have another template that contains the formatting for the > list, and I want my python script to call this template once for each > argument it receives. The template would then pass that argument on to a > ZSQL method that would retrieve the appropriate information from the > database. > > Tell me what I can't do out of these, followed by what I can do, but > would complexify it to much to be worth it. > Thanks for your time, I know this a pretty generic problem, but I really > appreciate any help. > Alec Munro > > > > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt > From chris@hddesign.com Thu May 2 22:35:33 2002 From: chris@hddesign.com (Chris Meyers) Date: Thu, 2 May 2002 16:35:33 -0500 Subject: [ZPT] page-break-after and zpt Message-ID: <20020502163533.A3713@hddesign.com> Has anyone gotten the page-break-after or page-break-before css tags working with ZPT specifically in tal:repeat statements. The breaks show up in IE6 but with a huge amount of white space on the top of the first page and less on each subsequent page. In Netscape/Mozilla (NS6 & Moz RC1) on Windows or Linux the breaks either don't show up at all or if they do, they cut off everything after the first page. I have tried putting the page-break style in line and in my CSS file, but neither seems to work. I had originally thought that page-break wasn't supported in Mozilla, but it works fine in a non-zpt non-zope environment. Anyone have any thoughts? Thanks for any suggestions, Chris Meyers From chris@hddesign.com Fri May 3 16:19:55 2002 From: chris@hddesign.com (Chris Meyers) Date: Fri, 3 May 2002 10:19:55 -0500 Subject: [ZPT] page-break-after and zpt In-Reply-To: <20020502163533.A3713@hddesign.com>; from chris@hddesign.com on Thu, May 02, 2002 at 04:35:33PM -0500 References: <20020502163533.A3713@hddesign.com> Message-ID: <20020503101955.A2498@hddesign.com> On Thu, May 02, 2002 at 04:35:33PM -0500, Chris Meyers wrote: > Has anyone gotten the page-break-after or page-break-before css tags working with ZPT specifically in tal:repeat statements. The breaks show up in IE6 but with a huge amount of white space on the top of the first page and less on each subsequent page. In Netscape/Mozilla (NS6 & Moz RC1) on Windows or Linux the breaks either don't show up at all or if they do, they cut off everything after the first page. I have tried putting the page-break style in line and in my CSS file, but neither seems to work. > > I had originally thought that page-break wasn't supported in Mozilla, but it works fine in a non-zpt non-zope environment. Anyone have any thoughts? > > Thanks for any suggestions, > Chris Meyers > Ok I found out that this was a screw-up on my logic rather than anything to do with zpt. I was trying to put a page break at the end of a table, but that table was contained inside a set up by my macro. You can't break inside of a table cell apparently. Chris > > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt -- Chris Meyers 7941 Tree Lane Suite 200 Madison WI 53717 From gspeer@linkline.com Fri May 3 17:39:24 2002 From: gspeer@linkline.com (Gary Speer) Date: Fri, 3 May 2002 09:39:24 -0700 Subject: [ZPT] How to accomplish attribute update from file content Message-ID: <022601c1f2c1$15dd0220$0602a8c0@linkline.com> This is a multi-part message in MIME format. ------=_NextPart_000_0223_01C1F286.69442E60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sorry this is in ZPT, I realize its not specifically template related, = but a template with script calls would be the preferred result. =20 I'm mildly experienced at Zope, yet haven't found the 'simple' way to = execute the following. I been going in circles on this and all help = would be appreciated. Rather than correct the approaches I have been = trying, I think it best to get some fresh perspectives. Objective: User FTPs a batch of files into an empty zope folder along = with a text document called contents.txt. contents.txt has one line per uploaded file in CSV or similar parseable = layout that begins with the file name. After the upload, the user triggers a posting process (a 'process the = upload' form buttom with Action=3DDo_It(). The executed Do_it object reads the text file and loops once per line, = for each line, it parses it into a file name and several attributes. =20 The object then writes the uploaded file content to a target folder as a = zope object having these attributes. I am stuck at looping on and parsing the content of the contents.txt = file to get and pass the attributes to the add object method. = Suggestions, syntax, or pointers to how-tos all gratefully accepted. Thank you! Gary ------=_NextPart_000_0223_01C1F286.69442E60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Sorry this is in ZPT, I = realize its=20 not specifically template related, but a template with script calls = would be the=20 preferred result. 
I'm mildly = experienced at Zope,=20 yet haven't found the 'simple' way to execute the following.  I = been going=20 in circles on this and all help would be appreciated.  Rather than = correct=20 the approaches I have been trying, I think it best to get some fresh=20 perspectives.
 
Objective:  User = FTPs a batch of=20 files into an empty zope folder along with a text document called=20 contents.txt.
contents.txt has one = line per=20 uploaded file in CSV or similar parseable layout that begins with the = file=20 name.
After the upload, the = user triggers a=20 posting process (a 'process the upload' form buttom with=20 Action=3DDo_It().
The executed Do_it = object reads the=20 text file and loops once per line, for each line, it parses it = into a file=20 name and several attributes. 
The object then writes = the uploaded=20 file content to a target folder as a zope object having these=20 attributes.
 
I am stuck = at looping=20 on and parsing the content of the contents.txt file to get and = pass=20 the attributes to the add object method.  Suggestions, syntax, or = pointers=20 to how-tos all gratefully accepted.
Thank you!
Gary
------=_NextPart_000_0223_01C1F286.69442E60-- From cfox@crystalcherry.com Sun May 5 23:39:18 2002 From: cfox@crystalcherry.com (Colin Fox) Date: 05 May 2002 15:39:18 -0700 Subject: [ZPT] Passing objects Message-ID: <1020638358.2293.34.camel@elgrande> --=-DLNUfidurP8KpCdq6Kgx Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, everyone. I had a large, complicated ZPT that I'm trying to split up. It has logical sections, so I'm just taking each section out and making it a zpt and including it with Here's the problem - In the master ZPT, I have executed a ZSQL query, and I now have the query object. The code that I've split out is referencing the query object (as in:

user

But now that I've split them out, the item object is no longer visible to the sub-ZPTs. How can I pass this in to my sub templates? Or how can the sub-templates get objects out of the parent's variable space? --=20 Colin Fox cfox@crystalcherry.com CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F --=-DLNUfidurP8KpCdq6Kgx Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQA81bSWo+tuo7yXVy8RAh4zAJ9RM/rgs+wxs0OpNxnLjWmsg5IpcQCg6M9p wWaOgOoeFMojntJfQG8NVRs= =5rgn -----END PGP SIGNATURE----- --=-DLNUfidurP8KpCdq6Kgx-- From Tom Deprez" Hi, Why do I get a non-closing tag parsing error on: Thanks, Tom. From gotcha@swing.be Mon May 6 14:34:47 2002 From: gotcha@swing.be (Godefroid Chapelle) Date: Mon, 06 May 2002 15:34:47 +0200 Subject: [ZPT] Parsing error In-Reply-To: <027901c1f501$94fa5250$1e71a8c0@u10136> Message-ID: <5.1.0.14.2.20020506153404.00ae6800@pop.swing.be> At 15:26 6/05/2002, Tom Deprez wrote: >Hi, > >Why do I get a non-closing tag parsing error on: > > HTML forbids tags inside a script tag... ZPT HTMLParser also... >Thanks, >Tom. > > > > >_______________________________________________ >ZPT mailing list >ZPT@zope.org >http://lists.zope.org/mailman/listinfo/zpt -- Godefroid Chapelle BubbleNet sprl rue Victor Horta, 18 / 202 1348 Louvain-la-Neuve Belgium Tel + 32 (10) 459901 Mob + 32 (477) 363942 TVA 467 093 008 RC Niv 49849 From gotcha@swing.be Mon May 6 14:36:33 2002 From: gotcha@swing.be (Godefroid Chapelle) Date: Mon, 06 May 2002 15:36:33 +0200 Subject: [ZPT] Parsing error In-Reply-To: <027901c1f501$94fa5250$1e71a8c0@u10136> Message-ID: <5.1.0.14.2.20020506153508.00ae6bf0@pop.swing.be> At 15:26 6/05/2002, you wrote: >Hi, > >Why do I get a non-closing tag parsing error on: > > You should try (not tested but should work) >Thanks, >Tom. > > > > >_______________________________________________ >ZPT mailing list >ZPT@zope.org >http://lists.zope.org/mailman/listinfo/zpt -- Godefroid Chapelle BubbleNet sprl rue Victor Horta, 18 / 202 1348 Louvain-la-Neuve Belgium Tel + 32 (10) 459901 Mob + 32 (477) 363942 TVA 467 093 008 RC Niv 49849 From evan@4-am.com Mon May 6 16:27:55 2002 From: evan@4-am.com (Evan Simpson) Date: Mon, 06 May 2002 10:27:55 -0500 Subject: [ZPT] Passing objects References: <1020638358.2293.34.camel@elgrande> Message-ID: <3CD6A0FB.7060206@4-am.com> Colin Fox wrote: > I had a large, complicated ZPT that I'm trying to split up. It has > logical sections, so I'm just taking each section out and making it a > zpt and including it with This is exactly what METAL is for. Most discussion of it centers on the more difficult slot-oriented page macros, but breaking out bits is quite easy. Instead of the tal:replace, you would write:
...and wrap the sub-template in a
. Now the subtemplate will be treated as part of the main template during rendering, and all variables will be shared. Cheers, Evan @ 4-am From cfox@crystalcherry.com Mon May 6 17:48:11 2002 From: cfox@crystalcherry.com (Colin Fox) Date: 06 May 2002 09:48:11 -0700 Subject: [ZPT] Passing objects In-Reply-To: <3CD6A0FB.7060206@4-am.com> References: <1020638358.2293.34.camel@elgrande> <3CD6A0FB.7060206@4-am.com> Message-ID: <1020703691.15555.37.camel@elgrande> --=-FStYEenBjRoKeQFO1ddY Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2002-05-06 at 08:27, Evan Simpson wrote: > Colin Fox wrote: > > I had a large, complicated ZPT that I'm trying to split up. It has > > logical sections, so I'm just taking each section out and making it a > > zpt and including it with > here/subtempl"> >=20 > This is exactly what METAL is for. Most discussion of it centers on the=20 > more difficult slot-oriented page macros, but breaking out bits is quite=20 > easy. Instead of the tal:replace, you would write: >=20 >
>=20 > ...and wrap the sub-template in a
. Now= =20 > the subtemplate will be treated as part of the main template during=20 > rendering, and all variables will be shared. Thanks - that worked perfectly! I didn't realize that there was this kind of difference between sub-templates and metal macros. --=20 Colin Fox cfox@crystalcherry.com CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F --=-FStYEenBjRoKeQFO1ddY Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQA81rPLo+tuo7yXVy8RAk1CAJ4jOygKOORng2sAt5MHvGUITuq06gCcDzwA zgAXXyMKcFIVrCGRXBA2rzc= =Kzic -----END PGP SIGNATURE----- --=-FStYEenBjRoKeQFO1ddY-- From Boriesv.demBussche Mon May 6 17:49:30 2002 From: Boriesv.demBussche (Boriesv.demBussche) Date: Mon, 6 May 2002 18:49:30 +0200 Subject: [ZPT] ZPT, CMF, batches and accessing ZClass properties Message-ID: <3BF4BD55-6111-11D6-ADFE-003065BBE1BA@fafalter.de> Hi, it took me some time to figure it out and since I didn't notice a hint in documentation this might save some time: I used a batch like the one described in chapter "Advanced Page Templates" of the Zope Book. The source was not a SQL query, but a list of ZClasses which inherited from PortalContent and DefaultDublinCoreImpl. When I tried to access attributes of that ZClass I could access the metadata, but not any of the attributes I had put into the ZClass by myself. The solution is to put the attributes, which shall be accessible via the batch into the portal catalog. hope that helps Bories From blalor+dated+1021217540.33f531@ithacabands.org Tue May 7 16:32:18 2002 From: blalor+dated+1021217540.33f531@ithacabands.org (Brian Lalor) Date: Tue, 7 May 2002 08:32:18 -0700 (MST) Subject: [ZPT] how to access the owner of an object? Message-ID: Hey all. Sorry if this has been covered before, but I did some searching yesterday and didn't come up with anything. I'm *very* green with Zope, but like I handle most new things, I'm learning by diving in head first. I'm trying to put together something of a weblog on my Zope site. Each entry is a File object. I'm using a series of page templates to display each news entry, and I'd like to be able to say who posted the item; I intend to have each File object owned by the user who made the entry. How do I, either via Python or within the template, access the owner of the object? I don't see it as a property anywhere in the object hierarchy of the File object. Thanks, B -- Brian Lalor blalor@ithacabands.org From chrisw@nipltd.com Thu May 9 08:55:45 2002 From: chrisw@nipltd.com (Chris Withers) Date: Thu, 09 May 2002 08:55:45 +0100 Subject: [ZPT] Order of attribute execution Feature Request References: <20020508160011.2585.58622.Mailman@mail.python.org> <20020508195121.GN31103@universal-fasteners.com> Message-ID: <3CDA2B81.8105FC16@nipltd.com> Jim Penny wrote: > > 2) that is introduces some additional, fairly baroque magic in the > "order of execution of element type" definitions. I would have > preferred that they be evaulated/performed in textual order. I'd second that... where do we stick feature requests like this? cheers, Chris From dieter@handshake.de Thu May 9 19:50:12 2002 From: dieter@handshake.de (Dieter Maurer) Date: Thu, 9 May 2002 20:50:12 +0200 Subject: [ZPT] Order of attribute execution Feature Request In-Reply-To: <3CDA2B81.8105FC16@nipltd.com> References: <20020508160011.2585.58622.Mailman@mail.python.org> <20020508195121.GN31103@universal-fasteners.com> <3CDA2B81.8105FC16@nipltd.com> Message-ID: <15578.50404.799793.490371@linux.local> Chris Withers writes: > Jim Penny wrote: > > 2) that is introduces some additional, fairly baroque magic in the > > "order of execution of element type" definitions. I would have > > preferred that they be evaulated/performed in textual order. > > I'd second that... where do we stick feature requests like this? I think the order is irrelevant because the DOM considers attributes unordered. Not good to implement things against the standard model. Furthermore, changing this facet in the implementation will break lots of exiting templates. Where do we condemn feature requests like this? Dieter From klm@zope.com Thu May 9 21:07:14 2002 From: klm@zope.com (Ken Manheimer) Date: Thu, 9 May 2002 16:07:14 -0400 (EDT) Subject: [ZPT] Order of attribute execution Feature Request In-Reply-To: <15578.50404.799793.490371@linux.local> Message-ID: On Thu, 9 May 2002, Dieter Maurer wrote: > Chris Withers writes: > > Jim Penny wrote: > > > 2) that is introduces some additional, fairly baroque magic in the > > > "order of execution of element type" definitions. I would have > > > preferred that they be evaulated/performed in textual order. This is a case where i'd say "baroque" is intemperate. The documention ( http://dev.zope.org/Wikis/DevSite/Projects/ZPT/TAL%20Specification%201.4 ) not only specifically declares the order of operations operations, but it goes on to describe the rationale behind them! Now, if you _disagree_ with the choices, and can cite cases which substantiate your reasoning, then great, file a collector issue! But calling it baroque implies that it's overelaborate and/or obscure to the informed user - neither of which seems, to me at least, to be the case. > > I'd second that... where do we stick feature requests like this? I would assume it's the Zope collector. I suppose you could add comments in the ZPT wiki, as well. If you see a glaring error, and feel it warrants stirring up a lot of attention, then post something to zope coders - but you've both been pretty vague about your complaints, i don't have the impression you are chafing from some particular error. > I think the order is irrelevant because the DOM considers > attributes unordered. Not good to implement things against the standard > model. Attributes are unordered in the traversal, but of course the processing of the resulting structure (the semantics) is up to the application! And the documentation is very clear about how the application behaves - with good motivation. > Furthermore, changing this facet in the implementation will break > lots of exiting templates. > > Where do we condemn feature requests like this? :-) I imagine whoever is responsible for PageTemplates will float a proposal for changes if they're convinced any are necessary. -- Ken klm@zope.com From gotcha@swing.be Fri May 10 09:36:00 2002 From: gotcha@swing.be (Godefroid Chapelle) Date: Fri, 10 May 2002 10:36:00 +0200 Subject: [ZPT] Re: Zope-Dev digest, Vol 1 #1682 - 11 msgs In-Reply-To: <20020510041301.27208.73860.Mailman@mail.python.org> Message-ID: <5.1.0.14.2.20020510103209.00b05850@pop.swing.be> At 06:13 10/05/2002, zope-dev-request@zope.org wrote: >'else' is tricky within the block oriented structure of anything XML-ish, >because of the concept of 'well-formedness'. The 'if' statement would have >to be singly wrapped, and the else block wrapped separately, looking at >least somewhat awkward any way you go about it. The best I can come up with >in my mind is this, in order to have the 'else' pick up on the condition >expressed in its surrounding container. But, yuck: > > > true stuff > > false stuff > > > > >A good page template way is something like this: > > > truth > > > false > > >The 'not' TALES namespace is valuable. The downside is that you evaluate >the expression twice. A good way to work within this is something that I >did earlier today, outside of this conversation, where I evaluate an >expression earlier and assign it to a variable: > >
tal:define="editItems python:here.getMenuItem(...)"> > >

Edit Menu Items

>
tal:condition="editItems"> > > ... (form and table elements, and a loop over editItems > contained in here if there were results) ... > >
> >
tal:condition="not:editItems"> > No menu items available >
> >
> > >This is something I did a lot in DTML too, setting a search result to either >a global variable, or inside of a large namescape It is maybe not clear that the above is really usable and allowed. I do not know how and where to stress that the tal: marked tags are underdocumented what a pity. I have already tried : http://www.zope.org/Documentation/ZopeBook/AdvZPT.stx#3-44 Sorry that I am not able to explain it better... -- Godefroid Chapelle BubbleNet sprl rue Victor Horta, 18 / 202 1348 Louvain-la-Neuve Belgium Tel + 32 (10) 459901 Mob + 32 (477) 363942 TVA 467 093 008 RC Niv 49849 From evan@4-am.com Fri May 10 18:39:32 2002 From: evan@4-am.com (Evan Simpson) Date: Fri, 10 May 2002 12:39:32 -0500 Subject: [ZPT] Stylesheet Language Message-ID: <3CDC05D4.3040204@4-am.com> Thanks to Casey Duncan, I'm now thinking hard about an extension to ZPT that I'm tentatively calling Template Style Sheet Language (pronounced "Tassle"). Much like CSS, this would allow you to write the equivalent of TAL statements out-of-line, and apply them based on tag selectors. Stylesheet sytax is much more forgiving than attribute syntax, so some of the more awkward aspects of TAL could be abandoned. For instance, we can use "=" instead of "define", and we can have multiple instances of the same kind of statement applied in whatever order we specify. String expressions could simply be quoted strings, and explicit expression types could become pseudo-functions such as "python()". A major advantage would be the ability to attach generic code to tags based on pattern matching. This also eliminates the need to add new tags in order to control scope and order of operations. Here's a complex example with made-up syntax:
  • Record
Name: Password: Sex:
The interaction between TAL and TSSL could be controlled by having all TSSL statements for a tag execute before TAL on the tag, but providing a "@tal;" statement, so that the following:

...would produce:

1 2 3

...since the order of execution would be: 1) x = "1"; 2) y = "2"; 3) tal:define="z string:$x $y" 4) y = "$z 3"; 5) [z] = z; 6) content: y; For documents, such as XML with a DTD, in which an inline > >
    >
  • Record
  • >
> >
> > Name: > Password: > > Sex: >
> > The interaction between TAL and TSSL could be controlled by having all > TSSL statements for a tag execute before TAL on the tag, but providing a > "@tal;" statement, so that the following: > > > >

> > ...would produce: > >

1 2 3

> > ...since the order of execution would be: > > 1) x = "1"; > 2) y = "2"; > 3) tal:define="z string:$x $y" > 4) y = "$z 3"; > 5) [z] = z; > 6) content: y; > > For documents, such as XML with a DTD, in which an inline I really like your ideas above. After a couple of reads it was pretty eas= y to=20 grok based on exisitng TAL idioms. =20 [snip html] > The interaction between TAL and TSSL could be controlled by having all=20 > TSSL statements for a tag execute before TAL on the tag, but providing = a=20 > "@tal;" statement, so that the following: >=20 > interesting. > For documents, such as XML with a DTD, in which an inline > > I really like your ideas above. After a couple of reads it was pretty > easy to grok based on exisitng TAL idioms. > > [snip html] > >> The interaction between TAL and TSSL could be controlled by having all >> TSSL statements for a tag execute before TAL on the tag, but providing a >> "@tal;" statement, so that the following: >> >> > > interesting. > >> For documents, such as XML with a DTD, in which an inline I like the concept. It could make a lot of things simpler. But... really, to me, not knowing CSS nor Perl extensively, the syntax used in the example above looks like CSS, Python, and Perl smashed together in a train wreck. ;-) Imagine mixing in some generated HTML, JavaScript, comments, and Python code blocks. It would be very unwieldy. Maybe we can discuss the requirements first? It sounds like what we want is server-side, stylesheet-like tag processing. That's what XSLT is good for, though a lot of us believe XSLT is too complicated to fit the same uses ZPT has. OTOH, perhaps your example is a lot like CSS. In that case, CSS has come to resemble Perl. :-) Shane From chrisw@nipltd.com Tue May 14 10:33:48 2002 From: chrisw@nipltd.com (Chris Withers) Date: Tue, 14 May 2002 05:33:48 -0400 Subject: [ZPT] CVS: Zope/lib/python/TAL/tests - test_xmlparser.py:1.4.32.1 utils.py:1.4.32.1 Message-ID: <200205140933.g4E9Xm715620@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests In directory cvs.zope.org:/tmp/cvs-serv15607 Modified Files: Tag: Zope-2_5-branch test_xmlparser.py utils.py Log Message: Merge fix for dodgy test to 2.5 branch. === Zope/lib/python/TAL/tests/test_xmlparser.py 1.4 => 1.4.32.1 === else: parser.parseString(source) - self.assert_(parser.get_events() == events, parser.get_events()) + if utils.oldexpat: + while events[0][0] in ('decl', 'doctype'): + del events[0] + self.assertEquals(parser.get_events(), events) def _run_check_extra(self, source, events): self._run_check(source, events, EventCollectorExtra) === Zope/lib/python/TAL/tests/utils.py 1.4 => 1.4.32.1 === # Set skipxml to true if an XML parser could not be found. +pyexpat = None skipxml = 0 try: import pyexpat @@ -22,7 +23,22 @@ import xml.parsers.pyexpat except ImportError: skipxml = 1 + else: + pyexpat = xml.parsers.pyexpat +# Set oldexpat if the StartDoctypeDeclHandler and XmlDeclHandler are +# not supported. The tests need to know whether the events reported +# by those handlers should be expected, but need to make sure the +# right thing is returned if they are. +oldexpat = 0 +if pyexpat is not None: + p = pyexpat.ParserCreate() + # Can't use hasattr() since pyexpat supports the handler + # attributes in a broken way. + try: + p.StartDoctypeDeclHandler = None + except AttributeError: + oldexpat = 1 def run_suite(suite, outf=None, errf=None): if outf is None: From matt@zope.com Tue May 14 16:22:50 2002 From: matt@zope.com (Matthew T. Kromer) Date: Tue, 14 May 2002 11:22:50 -0400 Subject: [ZPT] CVS: Zope/lib/python/TAL/tests - test_htmltalparser.py:1.25.32.3 Message-ID: <200205141522.g4EFMoU13180@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests In directory cvs.zope.org:/tmp/cvs-serv12835 Modified Files: Tag: Zope-2_5-branch test_htmltalparser.py Log Message: update test for cdata mode to include two end tags === Zope/lib/python/TAL/tests/test_htmltalparser.py 1.25.32.2 => 1.25.32.3 === def check_cdata_mode(self): - """This routine should NOT detect an error with an end tag not + """This routine should NOT detect an error with an end tag not matching the start """ + s = """""" output = [ rawtext(s), ] From matt@zope.com Tue May 14 16:24:10 2002 From: matt@zope.com (Matthew T. Kromer) Date: Tue, 14 May 2002 11:24:10 -0400 Subject: [ZPT] CVS: Releases/Zope/lib/python/TAL/tests - test_htmltalparser.py:1.28 Message-ID: <200205141524.g4EFOAu13393@cvs.baymountain.com> Update of /cvs-repository/Releases/Zope/lib/python/TAL/tests In directory cvs.zope.org:/tmp/cvs-serv13305 Modified Files: test_htmltalparser.py Log Message: Add double end tag to test cdata ignore === Releases/Zope/lib/python/TAL/tests/test_htmltalparser.py 1.27 => 1.28 === def check_cdata_mode(self): - """This routine should NOT detect an error with an end tag not + """This routine should NOT detect an error with an end tag not matching the start """ + s = """""" output = [ rawtext(s), ] From fdrake@acm.org Tue May 14 16:33:23 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Tue, 14 May 2002 11:33:23 -0400 Subject: [ZPT] CVS: Zope/lib/python/TAL - HTMLParser.py:1.21.30.2 Message-ID: <200205141533.g4EFXN115992@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL In directory cvs.zope.org:/tmp/cvs-serv15981/lib/python/TAL Modified Files: Tag: Zope-2_5-branch HTMLParser.py Log Message: Simplify code to allow multiple "false" end tags in CDATA content. === Zope/lib/python/TAL/HTMLParser.py 1.21.30.1 => 1.21.30.2 === elif endtagopen.match(rawdata, i): # = 0: - self.clear_cdata_mode() elif _contains_at(rawdata, "expr mapping to a # name-->(compiled_expr, translate) mapping for key, value in repldict.items(): - if key == 'src': - print >>sys.__stderr__, "src = %r" % value + #if key == 'src': + # print >>sys.__stderr__, "src = %r" % value repldict[key] = self.compileExpression(value), key in i18nattrs for key in i18nattrs: if key not in repldict: From fdrake@acm.org Wed May 22 20:48:39 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Wed, 22 May 2002 15:48:39 -0400 Subject: [ZPT] CVS: Zope3/lib/python/Zope/TAL - TALGenerator.py:1.52.16.3.4.5 Message-ID: <200205221948.g4MJmd704400@cvs.baymountain.com> Update of /cvs-repository/Zope3/lib/python/Zope/TAL In directory cvs.zope.org:/tmp/cvs-serv4389/lib/python/Zope/TAL Modified Files: Tag: fdrake-tal-i18n-branch TALGenerator.py Log Message: Remove some debugging prints that were commented out. Update a comment. Add back a line that was accidentally removed during the initial attempt to add I18N support -- this now passes the existing unit tests. === Zope3/lib/python/Zope/TAL/TALGenerator.py 1.52.16.3.4.4 => 1.52.16.3.4.5 === def replaceAttrs(self, attrlist, repldict): # Each entry in attrlist starts like (name, value). - # Result is (name, value, action, expr) if there is a + # Result is (name, value, action, expr, xlat) if there is a # tal:attributes entry for that attribute. Additional attrs # defined only by tal:attributes are added here. # @@ -542,7 +542,6 @@ if attrsubst or i18nattrs: if attrsubst: repldict = parseAttributeReplacements(attrsubst) - #print >>sys.__stderr__, "emitStartElement", name, `repldict` else: repldict = {} if i18nattrs: @@ -552,8 +551,6 @@ # Convert repldict's name-->expr mapping to a # name-->(compiled_expr, translate) mapping for key, value in repldict.items(): - #if key == 'src': - # print >>sys.__stderr__, "src = %r" % value repldict[key] = self.compileExpression(value), key in i18nattrs for key in i18nattrs: if key not in repldict: @@ -562,6 +559,7 @@ repldict = {} if replace: todo["repldict"] = repldict + repldict = {} self.emitStartTag(name, self.replaceAttrs(attrlist, repldict), isend) if optTag: self.pushProgram() From chrisw@nipltd.com Thu May 23 12:53:37 2002 From: chrisw@nipltd.com (Chris Withers) Date: Thu, 23 May 2002 12:53:37 +0100 Subject: [ZPT] Re: [Zope] returning an HTML comment from ZPT References: <20020522213130.GA7312@dman.ddts.net> Message-ID: <3CECD841.C556C521@nipltd.com> dman wrote: > > 1) ZPT doesn't expand TAL statements inside an HTML comment If that's true, that strikes me as incorrect... cheers, Chris From fdrake@acm.org Thu May 23 14:17:56 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Thu, 23 May 2002 09:17:56 -0400 Subject: [ZPT] Re: [Zope] returning an HTML comment from ZPT In-Reply-To: <3CECD841.C556C521@nipltd.com> References: <20020522213130.GA7312@dman.ddts.net> <3CECD841.C556C521@nipltd.com> Message-ID: <15596.60420.900317.882778@grendel.zope.com> dman wrote: > 1) ZPT doesn't expand TAL statements inside an HTML comment Chris Withers writes: > If that's true, that strikes me as incorrect... Chris, What makes you think that? Why would something *inside* a comment get expanded? I'd be very surprised myself. Is it simply that DTML does it differently, or do you think there's a functional problem with not expanding commented-out TAL/METAL constructs? Should it not be possible to include comments about TAL constructs (with examples) in page templates? -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From chrisw@nipltd.com Thu May 23 15:01:18 2002 From: chrisw@nipltd.com (Chris Withers) Date: Thu, 23 May 2002 15:01:18 +0100 Subject: [ZPT] Re: [Zope] returning an HTML comment from ZPT References: <20020522213130.GA7312@dman.ddts.net> <3CECD841.C556C521@nipltd.com> <15596.60420.900317.882778@grendel.zope.com> Message-ID: <3CECF62E.829ABD32@nipltd.com> Hi Fred :-) "Fred L. Drake, Jr." wrote: > > What makes you think that? Why would something *inside* a comment get > expanded? I'd be very surprised myself. Well, comments are sent to browsers, so are their contents. For me, that makes them fair game for interpolation. Who knows? Maybe you want some debugging: ...which you don't want to be visible for users? > Is it simply that DTML does it differently, or do you think there's a > functional problem with not expanding commented-out TAL/METAL > constructs? Should it not be possible to include comments about TAL > constructs (with examples) in page templates? Well, there's two things that I guess are getting mixed here? HTML comments - which I think should be expanded TAL/METAL comments - which shouldn't be expanded. I usually do the latter as: This code stinks, I should fix it some time ;-) cheers, Chris From jim@zope.com Thu May 23 19:01:23 2002 From: jim@zope.com (Jim Fulton) Date: Thu, 23 May 2002 14:01:23 -0400 Subject: [ZPT] CVS: Zope3/lib/python/Zope/TAL - TALInterpreter.py:1.63.10.7 Message-ID: <200205231801.g4NI1NI28932@cvs.baymountain.com> Update of /cvs-repository/Zope3/lib/python/Zope/TAL In directory cvs.zope.org:/tmp/cvs-serv26429/lib/python/Zope/TAL Modified Files: Tag: Zope-3x-branch TALInterpreter.py Log Message: This all started with wanting to be able to use url;view in a ZPT path. :) That lead me to: - Massive traversal refactoring. Namespace handling is now centralized in Zope.App.Traversing. - ZPT refactoring, including some renaming that touches pretty much everything. :) - The application specific ZPT support was moved into Zope.App.PageTemplate. - To get page template files (for use in views): from Zope.App.PageTemplate import ViewPageTemplateFile - Fixed up security so that ZPT expressions only have access to safe builtins and so that modules namespace does imports safely. - Got ZPTPage working! - renaming url to absolute_url and got absolute_url to work in paths. - Cleaned up the (as yet unused) RestrictedInterpreter module in Zope.Security. In particular, changed to use a separate RestrictedBuiltins module. === Zope3/lib/python/Zope/TAL/TALInterpreter.py 1.63.10.6 => 1.63.10.7 === self.program = program self.macros = macros - self.engine = engine + self.engine = engine # Execution engine (aka context) self.Default = engine.getDefault() self.stream = stream or sys.stdout self._stream_write = self.stream.write @@ -446,6 +446,16 @@ else: self.insertXMLStructure(text, repldict) bytecode_handlers["insertStructure"] = do_insertStructure + + +# XXX There is a bug in the dance between TALInterpreter and TALES. +# TALInterpreter expects contexts to also be engines. When someone +# inserts structure, the structure can, apparently have TAL, because +# the TAL compiler is used. If there was TAL, it would try to use the +# engine, which is a context, to compile expressions found. The TALES +# context is not a compiler. Is this a YAGNI? + + def insertHTMLStructure(self, text, repldict): from HTMLTALParser import HTMLTALParser From fdrake@acm.org Thu May 23 22:47:04 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Thu, 23 May 2002 17:47:04 -0400 Subject: [ZPT] why is default false? Message-ID: <15597.25432.285248.121317@grendel.zope.com> Does anyone remember why default is a false value? It should be possible to conditionally set an attribute using something like: ... I'm sure there was a specific reason for it to be false, but I sure don't remember what, and can't find it in the old project Wiki. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From dman@dman.ddts.net Thu May 23 23:03:39 2002 From: dman@dman.ddts.net (dman) Date: Thu, 23 May 2002 17:03:39 -0500 Subject: [ZPT] Re: [Zope] returning an HTML comment from ZPT In-Reply-To: <3CECF62E.829ABD32@nipltd.com> References: <20020522213130.GA7312@dman.ddts.net> <3CECD841.C556C521@nipltd.com> <15596.60420.900317.882778@grendel.zope.com> <3CECF62E.829ABD32@nipltd.com> Message-ID: <20020523220339.GA17117@dman.ddts.net> --uAKRQypu60I7Lcqm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 23, 2002 at 03:01:18PM +0100, Chris Withers wrote: | Hi Fred :-) |=20 | "Fred L. Drake, Jr." wrote: | >=20 | > What makes you think that? Why would something *inside* a comment get | > expanded? I'd be very surprised myself. I wasn't terribly surprised by this, but I agree with Chris wrt to how it should behave. | Well, comments are sent to browsers, so are their contents. For me, | that makes them fair game for interpolation. |=20 | Who knows? Maybe you want some debugging: |=20 | |=20 | ...which you don't want to be visible for users? This is precisely what I was trying to do :-). | > Is it simply that DTML does it differently, or do you think there's a | > functional problem with not expanding commented-out TAL/METAL | > constructs? Should it not be possible to include comments about TAL | > constructs (with examples) in page templates? |=20 | Well, there's two things that I guess are getting mixed here? |=20 | HTML comments - which I think should be expanded |=20 | TAL/METAL comments - which shouldn't be expanded. |=20 | I usually do the latter as: |=20 | | This code stinks, I should fix it some time ;-) | I didn't know about the "tal:comment" tag. =20 -D --=20 After you install Microsoft Windows XP, you have the option to create user accounts. If you create user accounts, by default, they will have an account type of administrator with no password. -- bugtraq =20 GnuPG key : http://dman.ddts.net/~dman/public_key.gpg --uAKRQypu60I7Lcqm Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjztZzsACgkQO8l8XBKTpRTZxQCeKqzIiK3/K0iBvwG7Lh3K2qUY KFgAn2b53vmHgUShXTcNA42s/saErirt =Umm/ -----END PGP SIGNATURE----- --uAKRQypu60I7Lcqm-- From fdrake@acm.org Thu May 23 22:58:06 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Thu, 23 May 2002 17:58:06 -0400 Subject: [ZPT] Re: [Zope] returning an HTML comment from ZPT In-Reply-To: <20020523220339.GA17117@dman.ddts.net> References: <20020522213130.GA7312@dman.ddts.net> <3CECD841.C556C521@nipltd.com> <15596.60420.900317.882778@grendel.zope.com> <3CECF62E.829ABD32@nipltd.com> <20020523220339.GA17117@dman.ddts.net> Message-ID: <15597.26094.126533.620538@grendel.zope.com> dman writes: > | > | This code stinks, I should fix it some time ;-) > | > > I didn't know about the "tal:comment" tag. Read the example carefully -- there isn't a tal:comment element defined by TAL; he's relying on the behavior of condition="", and probably made a typo and meant tal:condition="". -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From barry@wooz.org Thu May 23 22:58:46 2002 From: barry@wooz.org (Barry A. Warsaw) Date: Thu, 23 May 2002 17:58:46 -0400 Subject: [ZPT] Re: why is default false? References: <15597.25432.285248.121317@grendel.zope.com> Message-ID: <15597.26134.447518.337706@anthem.wooz.org> I'll point out that I was playing around with the Zope Book's section on ZPT and I tried to write this: -------------------- snip snip -------------------- ...
blah
-------------------- snip snip -------------------- This fails to DWIM because the Python expression in the tal:attributes always evaluates to nothing. /That's/ because default is false. :( So I ended up with the following: -------------------- snip snip --------------------
blah
-------------------- snip snip -------------------- which works, but which I don't like . Changing Default to a true value (in lib/python/TAL/DummyEngine.py and Products/PageTemplates/TALES.py) sees to do what I want, and doesn't cause failures in the test suite. -Barry From evan@4-am.com Thu May 23 23:58:58 2002 From: evan@4-am.com (Evan Simpson) Date: Thu, 23 May 2002 17:58:58 -0500 Subject: [ZPT] Re: [Zope] returning an HTML comment from ZPT References: <20020522213130.GA7312@dman.ddts.net> <3CECD841.C556C521@nipltd.com> <15596.60420.900317.882778@grendel.zope.com> <3CECF62E.829ABD32@nipltd.com> <20020523220339.GA17117@dman.ddts.net> <15597.26094.126533.620538@grendel.zope.com> Message-ID: <3CED7432.9020901@4-am.com> Fred L. Drake, Jr. wrote: > dman writes: > > | > > | This code stinks, I should fix it some time ;-) > > | > > > > I didn't know about the "tal:comment" tag. > > Read the example carefully -- there isn't a tal:comment element > defined by TAL; he's relying on the behavior of condition="", and > probably made a typo and meant tal:condition="". True, the condition="" does the work, but it's fine as written. He's taking advantage of the fact that TAL will treat attributes of any tag in the 'tal' namespace as implicitly belonging to the namespace. If your favorite tools tolerate it, you can therefore write stuff like: ...(much text omitted)...

Widget #42 is called Foo ...and the made-up tag name acts as a sort of mini-comment. It can certainly help at the end of a set of nested blocks to see "" instead of "

". Also, the open and close "tal:setup" tags above don't appear in the rendered page, only the text between. Cheers, Evan @ 4-am From darius@obsidian.com.au Fri May 24 05:09:49 2002 From: darius@obsidian.com.au (Kevin Littlejohn) Date: 24 May 2002 14:09:49 +1000 Subject: [ZPT] Query on tracebacks Message-ID: <1022213389.4556.76.camel@reverie> Heya, We're building a site in TAL atm (it's a billing system for ISPs, we sell it with (theoretically) instructions on how to modify the pages for branding etc...) Anyway, I'm trying to make a standard_error_message page, to catch anything unexpected so we can present a friendly message and mail the error to the developers. But I can't see where the error traceback objects are in the namespace... If we do this in dtml, we get error_tb and similar variables to play with. But I'm starting to think they may be "magic variables" - not actually in the namespace when standard_error_message is called, as such, thus not available to a TAL equivalent. Is that true? Is there any way to make a TAL standard_error_message page? Or am I going to have to switch to dtml? I don't really want to do that, because we're using macros for page layout, and dtml won't play nicely with that... KevinL -- Internet techie Obsidian Consulting Group Phone: +613 9653 9364 Fax: +613 9354 2681 http://www.obsidian.com.au/ darius@obsidian.com.au From chrisw@nipltd.com Fri May 24 09:52:16 2002 From: chrisw@nipltd.com (Chris Withers) Date: Fri, 24 May 2002 09:52:16 +0100 Subject: [ZPT] Re: [Zope] returning an HTML comment from ZPT References: <20020522213130.GA7312@dman.ddts.net> <3CECD841.C556C521@nipltd.com> <15596.60420.900317.882778@grendel.zope.com> <3CECF62E.829ABD32@nipltd.com> <20020523220339.GA17117@dman.ddts.net> Message-ID: <3CEDFF40.1BCC6E45@nipltd.com> dman wrote: > > | I usually do the latter as: > | > | > | This code stinks, I should fix it some time ;-) > | > > I didn't know about the "tal:comment" tag. We really meed to document this better. There isn't a tal:comment tag as such, just everything in the tal or metal namespaces is omitted from the output stream. It also means you don't have to put tal: in front of every attribute name. The above could also have been written as:
This code stinks, I should fix it some time ;-)
or This code stinks, I should fix it some time ;-) cheers, Chris From chrisw@nipltd.com Fri May 24 09:53:32 2002 From: chrisw@nipltd.com (Chris Withers) Date: Fri, 24 May 2002 09:53:32 +0100 Subject: [ZPT] Re: [Zope] returning an HTML comment from ZPT References: <20020522213130.GA7312@dman.ddts.net> <3CECD841.C556C521@nipltd.com> <15596.60420.900317.882778@grendel.zope.com> <3CECF62E.829ABD32@nipltd.com> <20020523220339.GA17117@dman.ddts.net> <15597.26094.126533.620538@grendel.zope.com> Message-ID: <3CEDFF8C.EE380FD8@nipltd.com> "Fred L. Drake, Jr." wrote: > > Read the example carefully -- there isn't a tal:comment element > defined by TAL; he's relying on the behavior of condition="", and > probably made a typo and meant tal:condition="". No, I didn't, check the parser you wrote ;-) see my other post... *grinz* Chris From fg@nuxeo.com Fri May 24 15:10:16 2002 From: fg@nuxeo.com (Florent Guillaume) Date: Fri, 24 May 2002 14:10:16 +0000 (UTC) Subject: [ZPT] why is default false? References: <15597.25432.285248.121317@grendel.zope.com> Message-ID: Agreed, I too am for that change if it doesn't break anything. And for exactly the reason you mention :-) Florent Fred L. Drake, Jr. wrote: > > Does anyone remember why default is a false value? It should be > possible to conditionally set an attribute using something like: > > > tal:attributes="class python: expr and default or nothing"> > ... > > > > I'm sure there was a specific reason for it to be false, but I sure > don't remember what, and can't find it in the old project Wiki. > > > -Fred -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com From casey@zope.com Fri May 24 15:33:42 2002 From: casey@zope.com (Casey Duncan) Date: Fri, 24 May 2002 10:33:42 -0400 Subject: [ZPT] why is default false? In-Reply-To: References: <15597.25432.285248.121317@grendel.zope.com> Message-ID: <200205241033.42769.casey@zope.com> Would it be insane for default to act just like the sample content string= =20 would? IOW, default would be false if the sample tag content was empty, and true= =20 otherwise. -Casey On Friday 24 May 2002 10:10 am, Florent Guillaume wrote: > Agreed, I too am for that change if it doesn't break anything. > And for exactly the reason you mention :-) >=20 > Florent >=20 > Fred L. Drake, Jr. wrote: > >=20 > > Does anyone remember why default is a false value? It should be > > possible to conditionally set an attribute using something like: > >=20 > > > > > tal:attributes=3D"class python: expr and default or nothing"> > > ... > > > > > >=20 > > I'm sure there was a specific reason for it to be false, but I sure > > don't remember what, and can't find it in the old project Wiki. > >=20 > >=20 > > -Fred > --=20 > Florent Guillaume, Nuxeo (Paris, France) > +33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com >=20 >=20 > _______________________________________________ > ZPT mailing list > ZPT@zope.org > http://lists.zope.org/mailman/listinfo/zpt >=20 From fg@nuxeo.com Fri May 24 15:33:14 2002 From: fg@nuxeo.com (Florent Guillaume) Date: Fri, 24 May 2002 14:33:14 +0000 (UTC) Subject: [ZPT] why is default false? References: <15597.25432.285248.121317@grendel.zope.com> <200205241033.42769.casey@zope.com> Message-ID: Not insane, but do you have a real use case ? Otherwise I'd say YAGNI. In my experience having default be always true would have been enough. Florent Casey Duncan wrote: > Would it be insane for default to act just like the sample content string > would? > > IOW, default would be false if the sample tag content was empty, and true > otherwise. > > -Casey > > On Friday 24 May 2002 10:10 am, Florent Guillaume wrote: > > Agreed, I too am for that change if it doesn't break anything. > > And for exactly the reason you mention :-) > > > > Florent > > > > Fred L. Drake, Jr. wrote: > > > > > > Does anyone remember why default is a false value? It should be > > > possible to conditionally set an attribute using something like: > > > > > > > > > > > tal:attributes="class python: expr and default or nothing"> > > > ... > > > > > > > > > > > > I'm sure there was a specific reason for it to be false, but I sure > > > don't remember what, and can't find it in the old project Wiki. -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com From fdrake@acm.org Fri May 24 15:52:18 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 24 May 2002 10:52:18 -0400 Subject: [ZPT] why is default false? In-Reply-To: References: <15597.25432.285248.121317@grendel.zope.com> <200205241033.42769.casey@zope.com> Message-ID: <15598.21410.127189.772482@grendel.zope.com> Florent Guillaume writes: > Not insane, but do you have a real use case ? Otherwise I'd say YAGNI. > In my experience having default be always true would have been enough. No, no! It *is* insane; behavior would be much less predictable due to the the new dependence between page logic and default values that are otherwise inaccessible! -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From fdrake@acm.org Fri May 24 15:41:41 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 24 May 2002 10:41:41 -0400 Subject: [ZPT] why is default false? In-Reply-To: <200205241033.42769.casey@zope.com> References: <15597.25432.285248.121317@grendel.zope.com> <200205241033.42769.casey@zope.com> Message-ID: <15598.20773.406213.387469@grendel.zope.com> Casey Duncan writes: > Would it be insane for default to act just like the sample content string > would? Yes. The truth value of an expression like "a and default or nothing" should *not* be sensitive to the value of the default. It might be defined and '', or it might not be defined. Then we're back to the original problem, depending on the default. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From fg@nuxeo.com Fri May 24 16:06:55 2002 From: fg@nuxeo.com (Florent Guillaume) Date: Fri, 24 May 2002 15:06:55 +0000 (UTC) Subject: [ZPT] why is default false? References: <15597.25432.285248.121317@grendel.zope.com> <200205241033.42769.casey@zope.com> <15598.21410.127189.772482@grendel.zope.com> Message-ID: Fred L. Drake, Jr. wrote: > Florent Guillaume writes: > > Not insane, but do you have a real use case ? Otherwise I'd say YAGNI. > > In my experience having default be always true would have been enough. > > No, no! It *is* insane; behavior would be much less predictable due > to the the new dependence between page logic and default values that > are otherwise inaccessible! Ok ok, it is insane ;-) Florent -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com From evan@4-am.com Fri May 24 16:07:26 2002 From: evan@4-am.com (Evan Simpson) Date: Fri, 24 May 2002 10:07:26 -0500 Subject: [ZPT] Query on tracebacks References: <1022213389.4556.76.camel@reverie> Message-ID: <3CEE572E.8060108@4-am.com> Kevin Littlejohn wrote: > If we do this in dtml, we get error_tb and similar variables to play > with. But I'm starting to think they may be "magic variables" - not > actually in the namespace when standard_error_message is called, as > such, thus not available to a TAL equivalent. Is that true? They are in the 'options' namespace, since they are passed as keyword arguments. For example:

The Message

You must be using a recent 2.5.x Zope in order to use anything but DTML as a standard_error_message, however. Cheers, Evan @ 4-am From fdrake@acm.org Fri May 24 16:43:59 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 24 May 2002 11:43:59 -0400 Subject: [ZPT] CVS: Zope/lib/python/Products/PageTemplates - TALES.py:1.30 Message-ID: <200205241543.g4OFhxh29578@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/Products/PageTemplates In directory cvs.zope.org:/tmp/cvs-serv29557/Products/PageTemplates Modified Files: TALES.py Log Message: Make the Python value for "default" evaluate as true in a Boolean context. === Zope/lib/python/Products/PageTemplates/TALES.py 1.29 => 1.30 === class Default: '''Retain Default''' - def __nonzero__(self): - return 0 Default = Default() _marker = [] From fdrake@acm.org Fri May 24 16:43:59 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 24 May 2002 11:43:59 -0400 Subject: [ZPT] CVS: Zope/lib/python/TAL - DummyEngine.py:1.31 Message-ID: <200205241543.g4OFhxS29576@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL In directory cvs.zope.org:/tmp/cvs-serv29557/TAL Modified Files: DummyEngine.py Log Message: Make the Python value for "default" evaluate as true in a Boolean context. === Zope/lib/python/TAL/DummyEngine.py 1.30 => 1.31 === from TALDefs import NAME_RE, TALESError, ErrorInfo -Default = [] +class Default: + pass +Default = Default() name_match = re.compile(r"(?s)(%s):(.*)\Z" % NAME_RE).match From fdrake@acm.org Fri May 24 16:46:09 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 24 May 2002 11:46:09 -0400 Subject: [ZPT] CVS: Zope3/lib/python/Zope/TAL - DummyEngine.py:1.28.14.3.4.1 Message-ID: <200205241546.g4OFk9L30678@cvs.baymountain.com> Update of /cvs-repository/Zope3/lib/python/Zope/TAL In directory cvs.zope.org:/tmp/cvs-serv30667/TAL Modified Files: Tag: fdrake-tal-i18n-branch DummyEngine.py Log Message: Make the Python value for "default" evaluate as true in a Boolean context. === Zope3/lib/python/Zope/TAL/DummyEngine.py 1.28.14.3 => 1.28.14.3.4.1 === from TALDefs import NAME_RE, TALESError, ErrorInfo -Default = [] +Default = object() name_match = re.compile(r"(?s)(%s):(.*)\Z" % NAME_RE).match From fdrake@acm.org Fri May 24 16:50:55 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 24 May 2002 11:50:55 -0400 Subject: [ZPT] CVS: Zope3/lib/python/Zope/TAL - DummyEngine.py:1.28.14.6 Message-ID: <200205241550.g4OFot131866@cvs.baymountain.com> Update of /cvs-repository/Zope3/lib/python/Zope/TAL In directory cvs.zope.org:/tmp/cvs-serv31855/lib/python/Zope/TAL Modified Files: Tag: Zope-3x-branch DummyEngine.py Log Message: Make the Python value for "default" evaluate as true in a Boolean context. === Zope3/lib/python/Zope/TAL/DummyEngine.py 1.28.14.5 => 1.28.14.6 === from TALDefs import NAME_RE, TALESError, ErrorInfo -Default = [] +Default = object() name_match = re.compile(r"(?s)(%s):(.*)\Z" % NAME_RE).match From fdrake@acm.org Fri May 24 16:55:10 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 24 May 2002 11:55:10 -0400 Subject: [ZPT] Re: why is default false? In-Reply-To: <15597.26134.447518.337706@anthem.wooz.org> References: <15597.25432.285248.121317@grendel.zope.com> <15597.26134.447518.337706@anthem.wooz.org> Message-ID: <15598.25182.652500.336282@grendel.zope.com> Barry A. Warsaw writes: > Changing Default to a true value (in lib/python/TAL/DummyEngine.py > and Products/PageTemplates/TALES.py) sees to do what I want, and > doesn't cause failures in the test suite. These changes have now been checked in for both the Zope 2 trunk and Zope 3. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From barry@wooz.org Fri May 24 16:59:05 2002 From: barry@wooz.org (Barry A. Warsaw) Date: Fri, 24 May 2002 11:59:05 -0400 Subject: [ZPT] Re: why is default false? References: <15597.25432.285248.121317@grendel.zope.com> <15597.26134.447518.337706@anthem.wooz.org> <15598.25182.652500.336282@grendel.zope.com> Message-ID: <15598.25417.755297.431934@anthem.wooz.org> >>>>> "Fred" == Fred L Drake, Jr writes: >> Changing Default to a true value (in >> lib/python/TAL/DummyEngine.py and >> Products/PageTemplates/TALES.py) sees to do what I want, and >> doesn't cause failures in the test suite. Fred> These changes have now been checked in for both the Zope 2 Fred> trunk and Zope 3. Cool! Thanks Fred. -Barry From fdrake@acm.org Fri May 24 17:26:53 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 24 May 2002 12:26:53 -0400 Subject: [ZPT] Re: [Zope] returning an HTML comment from ZPT In-Reply-To: <3CEDFF8C.EE380FD8@nipltd.com> References: <20020522213130.GA7312@dman.ddts.net> <3CECD841.C556C521@nipltd.com> <15596.60420.900317.882778@grendel.zope.com> <3CECF62E.829ABD32@nipltd.com> <20020523220339.GA17117@dman.ddts.net> <15597.26094.126533.620538@grendel.zope.com> <3CEDFF8C.EE380FD8@nipltd.com> Message-ID: <15598.27085.880796.89940@grendel.zope.com> Chris Withers writes: > No, I didn't, check the parser you wrote ;-) Gosh, Chris, that was just *ages* ago! Can't we ignore all code more than a month old? ;-) -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From mlilly@inkwellmedia.net Mon May 27 22:39:09 2002 From: mlilly@inkwellmedia.net (Mark A. Lilly) Date: Mon, 27 May 2002 14:39:09 -0700 Subject: [ZPT] how to eliminate redundancy in forms?? Message-ID: <009101c205c6$ef0ec020$0201a8c0@lala> Hi, I have an HTML form for adding tasks. I want to use the same form for editing existing tasks. I am attempting to avoid having two INPUT elements --one for adding and one for editing. So i have this code: The task variable is populated by returning the 0'th instance from a ZCatalog Collection based on task_id. If it is an Add (hence there is no task to find in the Catalog), i return from the getTask() script an empty list. The tal:condition checks to see if task/task_name exists. If it doesn't, i want to set the value of the input to the words 'Add Task'. Problem is, this doesn't work. The task.task_name inside the python test function fails on the Add, because there is no task instance with a field called task_name --i get an "AttributeError on task_name". It works when there is a task returned. Question: how do i set this up? I want only one which is reused for adding/editing. Otherwise, i have to duplicate tons of code. Suggestions? Thanks, mark From matt@zigg.com Wed May 29 20:45:54 2002 From: matt@zigg.com (Matt Behrens) Date: Wed, 29 May 2002 15:45:54 -0400 Subject: [ZPT] CVS: Zope/lib/python/TAL - DummyEngine.py:1.30.18.1 Message-ID: <200205291945.g4TJjse19492@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL In directory cvs.zope.org:/tmp/cvs-serv18366/lib/python/TAL Modified Files: Tag: zigg_unix-install-control-config-branch DummyEngine.py Log Message: Merge in HEAD (except setup.py... gotta chat about that one) :-) === Zope/lib/python/TAL/DummyEngine.py 1.30 => 1.30.18.1 === from TALDefs import NAME_RE, TALESError, ErrorInfo -Default = [] +class Default: + pass +Default = Default() name_match = re.compile(r"(?s)(%s):(.*)\Z" % NAME_RE).match From matt@zigg.com Wed May 29 20:45:52 2002 From: matt@zigg.com (Matt Behrens) Date: Wed, 29 May 2002 15:45:52 -0400 Subject: [ZPT] CVS: Zope/lib/python/Products/PageTemplates - TALES.py:1.29.18.1 ZopePageTemplate.py:1.38.10.1 Message-ID: <200205291945.g4TJjqi19466@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/Products/PageTemplates In directory cvs.zope.org:/tmp/cvs-serv18366/lib/python/Products/PageTemplates Modified Files: Tag: zigg_unix-install-control-config-branch TALES.py ZopePageTemplate.py Log Message: Merge in HEAD (except setup.py... gotta chat about that one) :-) === Zope/lib/python/Products/PageTemplates/TALES.py 1.29 => 1.29.18.1 === class Default: '''Retain Default''' - def __nonzero__(self): - return 0 Default = Default() _marker = [] === Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py 1.38 => 1.38.10.1 === dtpref_cols='50', dtpref_rows='20'): """Change editing preferences.""" + # The