From watchlala at hotmail.com Sun Apr 9 20:16:23 2006 From: watchlala at hotmail.com (Robert Sirois) Date: Sun Apr 9 20:16:28 2006 Subject: [ZPT] Getting TAL to use multiple return info Message-ID: An HTML attachment was scrubbed... URL: http://mail.zope.org/pipermail/zpt/attachments/20060409/f8e2e821/attachment.htm From tino at wildenhain.de Mon Apr 10 01:40:48 2006 From: tino at wildenhain.de (Tino Wildenhain) Date: Mon Apr 10 01:40:51 2006 Subject: [ZPT] Getting TAL to use multiple return info In-Reply-To: References: Message-ID: <4439EFE0.4030201@wildenhain.de> Robert Sirois wrote: > Hey, how do I get multiple variables from a script to use on a ZPT? > > ie. Script: > > a = 'yo' > > b = ' wuzzup' > > c = [] > > c.append(a) > > c.append(b) > > return c > > I can get a list to print out on the page, but how could I use each one > separately? Well, let me point out in fact you return only one variable :-) (And btw, you can construct lists much easier - no need for a, b and append() :-) To have easy access to a lot of names throughout your ZPT, the usual pattern is to call your ZPT from controller python script. Like this: a='yo' b='wuzzup' return context.yourZPT(a=a,b=b) and in your ZPT you access the values simply by: options/a and options/b this can be extended by using arbitrary nested dictionaries (and lists for loops) a=dict(name='peter',age=25) return context.yourZPT(a=a) # left hand 'a' is the name you use # inside ZPT of course and inside ZPT: options/a/name options/a/age Regards Tino Wildenhain From tino at wildenhain.de Tue Apr 11 02:11:26 2006 From: tino at wildenhain.de (Tino Wildenhain) Date: Tue Apr 11 02:11:32 2006 Subject: [ZPT] Getting TAL to use multiple return info In-Reply-To: References: Message-ID: <443B488E.3090501@wildenhain.de> Robert Sirois wrote: > I think I might. > > btw, I have been trying that code you gave me... and it doesn't work :( > > Now, I'm kinda retarded :p, so I bet I am missing something stupidly simple: > > I am using a python script called 'script' > > and a ZPT called 'test' > > script: > > ===== > > a = 'yo' > > b = 'wuzzup' > > return context.test(a=a,b=b) > > ===== > > test: > > ===== > > some interesting default text > > ===== > > What happens is that testing 'test' will raise an error where it doesn't > know what 'a' is, and if I test 'script' it shows the content that I > have on the 'test' ZPT, including the script and TAL. Why are you confused? The script _calls_ the ZPT and passes on the values. So you call the script every time - never the ZPT directly. The ZPT does not know about the (controller-) script so it cant work the other way round. Regards Tino From gyromagnetic at gmail.com Wed Apr 19 10:39:37 2006 From: gyromagnetic at gmail.com (gf) Date: Wed Apr 19 10:39:39 2006 Subject: [ZPT] creating a definition list with tal Message-ID: Hi, I am having difficulties constructing a definition list using tal. I have searched for relevant information, but have not found anything useful. I have a python script 'get_subfolder_info' that returns a list of dictionaries containing subfolder information [{url1,summary1,alias1}, {url2,summary2,alias2}, ...] I would like to create something like the following:
alias1
summary1
alias2
summary2
...
Below I have listed a couple of the variations of code that I have tried. I'd appreciate any help or advice you can give. Regards, gyro === The following creates repeated definition lists: ---
the term
the definition
--- If I include a 'span' to repeat only the dt and dd tagged elements, the list is not formatted properly (the 'span' messes up the 'dd' formatting).
the term
the definition
From lists at zopyx.com Wed Apr 19 10:44:01 2006 From: lists at zopyx.com (Andreas Jung) Date: Wed Apr 19 10:44:13 2006 Subject: [ZPT] creating a definition list with tal In-Reply-To: References: Message-ID: --On 19. April 2006 08:39:37 -0600 gf wrote: > {url2,summary2,alias2}, ...] > > I would like to create something like the following: >
>
alias1
>
summary1
>
alias2
>
summary2
> ... >
> > Below I have listed a couple of the variations of code that I have tried. > > I'd appreciate any help or advice you can give. > > Regards, > gyro > > === > > The following creates repeated definition lists: > > --- > >
tal:repeat="finfo folder_info"> >
tal:content="finfo/alias">the term
>
the definition
>
> Move the ral:repeat *inside* the DT tag. > --- > > If I include a 'span' to repeat only the dt and dd tagged elements, > the list is not formatted properly (the 'span' messes up the 'dd' > formatting). In this case tal:omit-tag is your friend...as documented. -aj -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 186 bytes Desc: not available Url : http://mail.zope.org/pipermail/zpt/attachments/20060419/aa90f87a/attachment.bin From gyromagnetic at gmail.com Wed Apr 19 11:05:42 2006 From: gyromagnetic at gmail.com (gf) Date: Wed Apr 19 11:05:42 2006 Subject: [ZPT] creating a definition list with tal In-Reply-To: References: Message-ID: On 4/19/06, Andreas Jung wrote: > > > --On 19. April 2006 08:39:37 -0600 gf wrote: > > > {url2,summary2,alias2}, ...] > > > > I would like to create something like the following: > >
> >
alias1
> >
summary1
> >
alias2
> >
summary2
> > ... > >
> > > > Below I have listed a couple of the variations of code that I have tried. > > > > I'd appreciate any help or advice you can give. > > > > Regards, > > gyro > > > > === > > > > The following creates repeated definition lists: > > > > --- > > > >
> tal:repeat="finfo folder_info"> > >
> tal:content="finfo/alias">the term
> >
the definition
> >
> > > > Move the ral:repeat *inside* the DT tag. > > > --- > > > > If I include a 'span' to repeat only the dt and dd tagged elements, > > the list is not formatted properly (the 'span' messes up the 'dd' > > formatting). > > In this case tal:omit-tag is your friend...as documented. > > -aj > > Thank you, Andreas! That was a great help. Best Regards, gyro From tseaver at palladion.com Wed Apr 19 16:01:37 2006 From: tseaver at palladion.com (Tres Seaver) Date: Wed Apr 19 16:01:30 2006 Subject: [ZPT] Re: creating a definition list with tal In-Reply-To: References: Message-ID: <44469721.3050508@palladion.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 gf wrote: > On 4/19/06, Andreas Jung wrote: > >> >>--On 19. April 2006 08:39:37 -0600 gf wrote: >> >> >>> {url2,summary2,alias2}, ...] >>> >>>I would like to create something like the following: >>>
>>>
alias1
>>>
summary1
>>>
alias2
>>>
summary2
>>>... >>>
>>> >>>Below I have listed a couple of the variations of code that I have tried. >>> >>>I'd appreciate any help or advice you can give. >>> >>>Regards, >>>gyro >>> >>>=== >>> >>>The following creates repeated definition lists: >>> >>>--- >>> >>>
>>tal:repeat="finfo folder_info"> >>>
>> tal:content="finfo/alias">the term
>>>
the definition
>>>
>>> >>Move the ral:repeat *inside* the DT tag. >> >> >>>--- >>> >>>If I include a 'span' to repeat only the dt and dd tagged elements, >>>the list is not formatted properly (the 'span' messes up the 'dd' >>>formatting). >> >>In this case tal:omit-tag is your friend...as documented. Another common practice is to introduce an element in the 'tal' namespace to group the repeated elements; such tags are automatically omitted when rendered. E.g.:
THE_TERM
This technique has the advantage of not confusing tools which think they know what the correct content model for '' is (of course, they need to be willing to ignore elements from unknown namespaces). Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFERpch+gerLs4ltQ4RAp4yAJ4sQbJ1XI80t2ti7IcpoJudpKcM3QCdGBct bEjpsNATepGe3SHVmcAW25Y= =jTi4 -----END PGP SIGNATURE----- From tseaver at palladion.com Wed Apr 19 16:01:37 2006 From: tseaver at palladion.com (Tres Seaver) Date: Wed Apr 19 16:02:46 2006 Subject: [ZPT] Re: creating a definition list with tal In-Reply-To: References: Message-ID: <44469721.3050508@palladion.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 gf wrote: > On 4/19/06, Andreas Jung wrote: > >> >>--On 19. April 2006 08:39:37 -0600 gf wrote: >> >> >>> {url2,summary2,alias2}, ...] >>> >>>I would like to create something like the following: >>>
>>>
alias1
>>>
summary1
>>>
alias2
>>>
summary2
>>>... >>>
>>> >>>Below I have listed a couple of the variations of code that I have tried. >>> >>>I'd appreciate any help or advice you can give. >>> >>>Regards, >>>gyro >>> >>>=== >>> >>>The following creates repeated definition lists: >>> >>>--- >>> >>>
>>tal:repeat="finfo folder_info"> >>>
>> tal:content="finfo/alias">the term
>>>
the definition
>>>
>>> >>Move the ral:repeat *inside* the DT tag. >> >> >>>--- >>> >>>If I include a 'span' to repeat only the dt and dd tagged elements, >>>the list is not formatted properly (the 'span' messes up the 'dd' >>>formatting). >> >>In this case tal:omit-tag is your friend...as documented. Another common practice is to introduce an element in the 'tal' namespace to group the repeated elements; such tags are automatically omitted when rendered. E.g.:
THE_TERM
This technique has the advantage of not confusing tools which think they know what the correct content model for '' is (of course, they need to be willing to ignore elements from unknown namespaces). Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFERpch+gerLs4ltQ4RAp4yAJ4sQbJ1XI80t2ti7IcpoJudpKcM3QCdGBct bEjpsNATepGe3SHVmcAW25Y= =jTi4 -----END PGP SIGNATURE----- From gyromagnetic at gmail.com Wed Apr 19 16:41:55 2006 From: gyromagnetic at gmail.com (gf) Date: Wed Apr 19 16:41:56 2006 Subject: [ZPT] Re: creating a definition list with tal In-Reply-To: <44469721.3050508@palladion.com> References: <44469721.3050508@palladion.com> Message-ID: On 4/19/06, Tres Seaver wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > gf wrote: > > On 4/19/06, Andreas Jung wrote: > > > >> > >>--On 19. April 2006 08:39:37 -0600 gf wrote: > >> > >> > >>> {url2,summary2,alias2}, ...] > >>> > >>>I would like to create something like the following: > >>>
> >>>
alias1
> >>>
summary1
> >>>
alias2
> >>>
summary2
> >>>... > >>>
> >>> > >>>Below I have listed a couple of the variations of code that I have tried. > >>> > >>>I'd appreciate any help or advice you can give. > >>> > >>>Regards, > >>>gyro > >>> > >>>=== > >>> > >>>The following creates repeated definition lists: > >>> > >>>--- > >>> > >>>
>>>tal:repeat="finfo folder_info"> > >>>
>>> tal:content="finfo/alias">the term
> >>>
the definition
> >>>
> >>> > >>Move the ral:repeat *inside* the DT tag. > >> > >> > >>>--- > >>> > >>>If I include a 'span' to repeat only the dt and dd tagged elements, > >>>the list is not formatted properly (the 'span' messes up the 'dd' > >>>formatting). > >> > >>In this case tal:omit-tag is your friend...as documented. > > Another common practice is to introduce an element in the 'tal' > namespace to group the repeated elements; such tags are automatically > omitted when rendered. E.g.: > >
> >
tal:content="finfo/alias">THE_TERM
>
> >
> > This technique has the advantage of not confusing tools which think they > know what the correct content model for '' is (of course, they > need to be willing to ignore elements from unknown namespaces). > > > Tres. > - -- > Hi Tres, Thanks for the great idea! I'm a zpt and zope newbie, so please forgive my ignorance. Does what you recommended mean that if I have no need for a 'real' tag, I can create and use a 'tal'-based tag like you did in your example? Does the element 'loop' have any special meaning? It seems as if using 'div's and 'span's just to hold tal directives is not a great idea (even if they can be 'omit-tag'ged away), or am I missing something? Although I am reading as much as I can about zpt, I seem to be missing a lot of important stuff. Cheers, gyro From tseaver at palladion.com Wed Apr 19 16:52:32 2006 From: tseaver at palladion.com (Tres Seaver) Date: Wed Apr 19 16:52:24 2006 Subject: [ZPT] Re: creating a definition list with tal In-Reply-To: References: <44469721.3050508@palladion.com> Message-ID: <4446A310.4020600@palladion.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 gf wrote: > On 4/19/06, Tres Seaver wrote: >>Another common practice is to introduce an element in the 'tal' >>namespace to group the repeated elements; such tags are automatically >>omitted when rendered. E.g.: >> >>
>> >>
> tal:content="finfo/alias">THE_TERM
>>
>> >>
> I'm a zpt and zope newbie, so please forgive my ignorance. Does what > you recommended mean that if I have no need for a 'real' tag, I can > create and use a 'tal'-based tag like you did in your example? Does > the element 'loop' have any special meaning? Nope, it merely indicates the purpose. > It seems as if using 'div's and 'span's just to hold tal directives is > not a great idea (even if they can be 'omit-tag'ged away), or am I > missing something? I generally avoid 'omit-tag', mostly because "real" HTML elemets which are present in the template but not the output can cause CSS to render differently. It is more a matter of taste than anything else. Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFERqMQ+gerLs4ltQ4RAj/fAKCDo5yjA2LQo8/mbHjuuE/QuydC5wCgzjp6 OgwgCEqEkdGZY9XRmv6sllA= =lZM7 -----END PGP SIGNATURE----- From tseaver at palladion.com Wed Apr 19 16:52:32 2006 From: tseaver at palladion.com (Tres Seaver) Date: Wed Apr 19 16:52:56 2006 Subject: [ZPT] Re: creating a definition list with tal In-Reply-To: References: <44469721.3050508@palladion.com> Message-ID: <4446A310.4020600@palladion.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 gf wrote: > On 4/19/06, Tres Seaver wrote: >>Another common practice is to introduce an element in the 'tal' >>namespace to group the repeated elements; such tags are automatically >>omitted when rendered. E.g.: >> >>
>> >>
> tal:content="finfo/alias">THE_TERM
>>
>> >>
> I'm a zpt and zope newbie, so please forgive my ignorance. Does what > you recommended mean that if I have no need for a 'real' tag, I can > create and use a 'tal'-based tag like you did in your example? Does > the element 'loop' have any special meaning? Nope, it merely indicates the purpose. > It seems as if using 'div's and 'span's just to hold tal directives is > not a great idea (even if they can be 'omit-tag'ged away), or am I > missing something? I generally avoid 'omit-tag', mostly because "real" HTML elemets which are present in the template but not the output can cause CSS to render differently. It is more a matter of taste than anything else. Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFERqMQ+gerLs4ltQ4RAj/fAKCDo5yjA2LQo8/mbHjuuE/QuydC5wCgzjp6 OgwgCEqEkdGZY9XRmv6sllA= =lZM7 -----END PGP SIGNATURE----- From mihamina.rakotomandimby at etu.univ-orleans.fr Thu Apr 27 14:18:44 2006 From: mihamina.rakotomandimby at etu.univ-orleans.fr (Rakotomandimby Mihamina) Date: Thu Apr 27 14:15:45 2006 Subject: [ZPT] javascript and ZPT Message-ID: <1146161924.2736.66.camel@localhost.localdomain> Hi, Have you got some links that talk about good pratices about mixing zpt and javascript? Javascript seems (according to my reads) usefull for ajaxification, and I would like to learn to use it in Zope and ZPTs. -- A powerfull GroupWare, CMS, CRM, ECM: CPS (Open Source & GPL). Opengroupware, SPIP, Plone, PhpBB, JetSpeed... are good: CPS is better. http://www.cps-project.org for downloads & documentation. From contact_tonico at yahoo.de Fri Apr 28 06:39:51 2006 From: contact_tonico at yahoo.de (Tonico Strasser) Date: Fri Apr 28 06:40:20 2006 Subject: [ZPT] Re: javascript and ZPT In-Reply-To: <1146161924.2736.66.camel@localhost.localdomain> References: <1146161924.2736.66.camel@localhost.localdomain> Message-ID: <4451F0F7.4090809@yahoo.de> Rakotomandimby Mihamina schrieb: > Hi, > Have you got some links that talk about good pratices about mixing zpt > and javascript? Just insert a script element somewhere in your HTML page :) Do you have special use cases? > Javascript seems (according to my reads) usefull for ajaxification, and > I would like to learn to use it in Zope and ZPTs. If you use Python Scripts or DTML for dynamic JavaScripts don't forget to set the Content-Type response header to 'text/javascript'. I think PageTemplates are not useful for dynamic JavaScripts because JavaScript is not a XML language. Here a few articles regarding best practices: Ajax Mistakes XMLHttpRequest Usability Guidelines Fixing the back button that AJAX broke Using JavaScript for good, not evil Unobtrusive Javascript (scroll down) AJAX and Accessibility HTH, Tonico