From dorneles at x3ng.com.br Wed Dec 3 22:52:01 2003 From: dorneles at x3ng.com.br (=?ISO-8859-1?Q?Dorneles_Trem=E9a?=) Date: Wed Dec 3 23:00:25 2003 Subject: [ZPT] Re: i18n in javascript In-Reply-To: <2790.194.224.156.181.1067599081.squirrel@webmail.amenworld.com> References: <2790.194.224.156.181.1067599081.squirrel@webmail.amenworld.com> Message-ID: Hi Santi, > I have a question about the use of i18n in ZPT. Is there an easy way to > translate, for instance, an "alert" message in javascript using TAL an > ZPTInternationalizationSupport ? what about something like: alert( 'Your alert message' ); I know, I know, it's ugly as hell... but seems to work! ;-) Regards, -- Dorneles Trem?a Caxias do Sul - RS - Brasil +55 54 9114 9312 - UIN: 2413568 X3ng Web Technology -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/IT d- s:->: a24 C+++ UBL++++$ P--- L++ E-- W+++ N++ o? K? w+ O M+ V-- PS+ PE- Y-- PGP++ t+ 5 X++ R+ tv+ b(++) DI+ D++ G+>+++ e++>++++ h---- r+++ y+++** ------END GEEK CODE BLOCK------ From jmuniz at amazingbutterflies.com Tue Dec 9 04:49:24 2003 From: jmuniz at amazingbutterflies.com (Jose Muniz) Date: Tue Dec 9 05:00:14 2003 Subject: [ZPT] Newbie Question Message-ID: <008e01c3be39$bab84e40$6501a8c0@HP751N> I am very new to Zope and have a few questions for the list. My partlially redesigned website can be viewed here: http://horn.digimark.net:8080/Butterflies.com/products/010_artwork I need to create a page view for my product subdirectories that have 2 columns. 1st column would contain the small image as is currently being displayed along with a 2nd column which would contain a description of it's contents. So in the case of Artwork the subdirectories would look like this: Image Exotic butterflies encased in elegant acrylic displays Image Framed Tropical butterflies from the Peruvian Rainforest The items within the subdirectory would look the same as above. This would give the pages some balance and not so one-sided. The ideal solution would be to have the page list 20 items/subdirectories split between two colums with text below each item, but this might be asking for too much right now. Any help or suggestions would be greatly appreciated, Thanks in advance, Jose Muniz Amazing Butterflies 954.575.9047 800.808.6276 Amazing Butterflies & Butterflies.com Where the Magic is Just a Flutter Away www.amazingbutterflies..com www.butterflies.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.zope.org/pipermail/zpt/attachments/20031209/f05541fc/attachment.html From ahiggs at brookes.ac.uk Thu Dec 11 06:22:06 2003 From: ahiggs at brookes.ac.uk (Antony Higgs) Date: Thu Dec 11 06:23:36 2003 Subject: [ZPT] Email attachments Message-ID: <3FD8535E.F9709BDD@brookes.ac.uk> Hi I am trying to find out how to send an email with a text file attachment from a Python Script. I can find information on how to do this using DTML but not for a Python Script. Can anyone point me to an example of how to do this? Many thanks Antony From dieter at handshake.de Thu Dec 11 13:34:53 2003 From: dieter at handshake.de (Dieter Maurer) Date: Thu Dec 11 13:51:23 2003 Subject: [ZPT] Email attachments In-Reply-To: <3FD8535E.F9709BDD@brookes.ac.uk> References: <3FD8535E.F9709BDD@brookes.ac.uk> Message-ID: <16344.47309.685967.77726@gargle.gargle.HOWL> Antony Higgs wrote at 2003-12-11 11:22 +0000: >I am trying to find out how to send an email with a text file attachment >from a Python Script. I can find information on how to do this using >DTML but not for a Python Script. Two options: * do it in DTML (the easiest) * use Python's "email" package (part of version 2.2 and above but will work with Python 2.1.3, too) to generate the finished email message text and then use "MailHost.send" to send it. You will need to allow import of "email" and use of its classes for Python Scripts (--> "README.txt" in "Products/PythonScripts") -- Dieter From santi at zetadb.com Mon Dec 15 11:06:00 2003 From: santi at zetadb.com (Santi Camps) Date: Mon Dec 15 11:01:39 2003 Subject: [ZPT] Unicode error in PageTemplates/XML Message-ID: <1071504360.1609.14.camel@a700> Hi all, I've a problem using Zope Page Templates to generate XML content with 8bits-strings. Here there is a minimalist example of what happens: give_me_content (Python Script): return 'ma?' test_html (PageTemplate): test_xml (PageTemplate): test2_xml (PageTemplate): ma? standard_error_message: test_html works fine. No problems here. test_xml causes an error "UnicodeError: ASCII decoding error: ordinal not in range(128)". My surprise is that test2_xml works fine, so it seems to be a problem of TALES. I've tried to encode the result using UTF-8, but doesn't works. It seems that only 7bit strings are allowed. I've also tried to debug PageTemplate.py code, but I'm not able to find where the problem is. Perhaps this is a problem of standard StringIO module, but then, why it works in HTML? Anybody knows something about this? I'm really interested into generate XML using TALES, but I need to be able to generate LATIN encodings. Thanks in advance -- Santi Camps http://zetadb.sourceforge.net From dieter at handshake.de Mon Dec 15 14:01:34 2003 From: dieter at handshake.de (Dieter Maurer) Date: Mon Dec 15 14:04:40 2003 Subject: [ZPT] Unicode error in PageTemplates/XML In-Reply-To: <1071504360.1609.14.camel@a700> References: <1071504360.1609.14.camel@a700> Message-ID: <16350.1294.215372.47558@gargle.gargle.HOWL> Santi Camps wrote at 2003-12-15 17:06 +0100: >I've a problem using Zope Page Templates to generate XML content with >8bits-strings. Here there is a minimalist example of what happens: > >give_me_content (Python Script): >return 'ma?' > >test_html (PageTemplate): > > > > >test_xml (PageTemplate): > > > > > >test2_xml (PageTemplate): > > > ma? > >.... >test_html works fine. No problems here. >test_xml causes an error "UnicodeError: ASCII decoding error: ordinal >not in range(128)". My surprise is that test2_xml works fine, so it >seems to be a problem of TALES. I am surprised, too. The error means, that the page template sees Unicode somewhere (I do not see where). It then tries to convert everything to unicode. Unless you set Python's default encoding (with "sys.setdefaultencoding" in "site_customize.py"), this will only work for ASCII strings. I would set the default encoding (frowned about by many Python gods). When you want to be more in line with best practices: ensure you work throughout with Unicode and set the correct "Content-Type" (the ZPublisher will then encode the Unicode result correctly). -- Dieter From jeremy.ryan at dsl.pipex.com Mon Dec 15 17:44:54 2003 From: jeremy.ryan at dsl.pipex.com (Jeremy Ryan) Date: Mon Dec 15 17:44:59 2003 Subject: [ZPT] object located in in DTML but not ZPT Message-ID: <005201c3c35d$0fbd60b0$0500a8c0@VAIO> Hi, I'm fairly new to Zope and am trying to learn to use ZPT rather than DTML. I'm using a "Sequences" Product as a primary key generator. I have created an instance of this called "pkGenerator" in the same folder as my page template. If I want to get the next sequence value I can call a DTML method (called "sequencePuller") containing simply this: which works when called from the following line in a form on my template: This seems like an awful hack to me, and I'd like to do it in entirely in TAL/TALES. I want to do something like: but that doesn't work. I get a compilation error: TAL.TALDefs.TALError: Invalid variable name "pkGenerator.getNextValue()" in expression 'pkGenerator.getNextValue()'... Does anyone know if/how I can do this? Jeremy From ianb at colorstudy.com Mon Dec 15 17:47:39 2003 From: ianb at colorstudy.com (Ian Bicking) Date: Mon Dec 15 17:48:06 2003 Subject: [ZPT] object located in in DTML but not ZPT In-Reply-To: <005201c3c35d$0fbd60b0$0500a8c0@VAIO> References: <005201c3c35d$0fbd60b0$0500a8c0@VAIO> Message-ID: On Dec 15, 2003, at 4:44 PM, Jeremy Ryan wrote: > Hi, I'm fairly new to Zope and am trying to learn to use ZPT rather > than > DTML. > > I'm using a "Sequences" Product as a primary key generator. I have > created > an instance of this called "pkGenerator" in the same folder as my page > template. If I want to get the next sequence value I can call a DTML > method > (called "sequencePuller") containing simply this: > > > > which works when called from the following line in a form on my > template: > > > > This seems like an awful hack to me, and I'd like to do it in entirely > in > TAL/TALES. I want to do something like: > > > try: Or: -- Ian Bicking | ianb@colorstudy.com | http://blog.ianbicking.org From stuart.b at commonground.com.au Mon Dec 15 21:23:28 2003 From: stuart.b at commonground.com.au (Stuart Bishop) Date: Mon Dec 15 21:24:22 2003 Subject: [ZPT] Unicode error in PageTemplates/XML In-Reply-To: <1071504360.1609.14.camel@a700> References: <1071504360.1609.14.camel@a700> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 16/12/2003, at 3:06 AM, Santi Camps wrote: > give_me_content (Python Script): > return 'ma?' You should use a Unicode string here: return u'ma\N{LATIN SMALL LETTER O WITH ACUTE}' Otherwise, I'm not sure what character set that string will actually end up in (in a default Zope, probably ISO-8859-1). Your xml would then look like: The tal:b bit sets the content type header with an explicit charset, which Zope uses to encode the result. Zope does not (yet) pick up the 'encoding=' element of the XML header. > not in range(128)". My surprise is that test2_xml works fine, so it > seems to be a problem of TALES. I've tried to encode the result using > UTF-8, but doesn't works. It seems that only 7bit strings are allowed. > I've also tried to debug PageTemplate.py code, but I'm not able to find > where the problem is. Perhaps this is a problem of standard StringIO > module, but then, why it works in HTML? You get those error messages if you mix Unicode strings with encoded strings. On the page template's edit screen, if you set the content-type of the page template to text/xml stricter XML validation kicks in, which might be triggering it. As Page Templates is a fully Unicode aware product, this could be considered a feature (and your test_html working a bug). > Anybody knows something about this? I'm really interested into > generate > XML using TALES, but I need to be able to generate LATIN encodings. Use Unicode strings instead of latin encoded strings. If your data source is latin encoded, you might need to do "unicode(data,'iso-8859-15')" to convert your data to a Unicode. - -- Stuart Bishop http://www.stuartbishop.net/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (Darwin) iD8DBQE/3myuAfqZj7rGN0oRAkdVAJwMTf6qL9kM/FDPRasS5yJGayQFPQCfUnIa M10vsWvKNuSeebXw/W8LOio= =Lu8X -----END PGP SIGNATURE----- From santi at zetadb.com Tue Dec 16 05:43:21 2003 From: santi at zetadb.com (santi@zetadb.com) Date: Tue Dec 16 05:43:05 2003 Subject: [ZPT] Unicode error in PageTemplates/XML In-Reply-To: References: <1071504360.1609.14.camel@a700> Message-ID: <1075.194.224.156.181.1071571401.squirrel@webmail.amenworld.com> > Your xml would then look like: > > > > > > > > > > The tal:b bit sets the content type header with an explicit charset, > which Zope uses to encode the result. Zope does not (yet) pick > up the 'encoding=' element of the XML header. Thanks. I will not send the resultant xml to the user (it is part of an OpenOffice document), but this is great to know. > Use Unicode strings instead of latin encoded strings. If your data > source > is latin encoded, you might need to do "unicode(data,'iso-8859-15')" to > convert your data to a Unicode. It works fine !! Now it seems obvious: all the page template is unicoded before parse its xml, so use of encoded data crash. Thanks very much for your help. Santi Camps http://zetadb.sourceforge.net From tsnell at enervation.com Tue Dec 16 07:39:48 2003 From: tsnell at enervation.com (Tom Snell) Date: Tue Dec 16 07:38:46 2003 Subject: [ZPT] objectValues( ??) Message-ID: <3FDEFD14.7060809@enervation.com> Sagt mir bitte wie ich das in den Klammern richtig schreibe:

ich kriege "Error Value: sequence index must be integer" Ich will einfach die Datein und Bilder auflisten, nicht die Verzeichnisse. Hier ist es komplett:

Return to parent

Danke, Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.zope.org/pipermail/zpt/attachments/20031216/bca6097e/attachment.html From andreas at andreas-jung.com Tue Dec 16 07:41:10 2003 From: andreas at andreas-jung.com (Andreas Jung) Date: Tue Dec 16 07:41:18 2003 Subject: [ZPT] objectValues( ??) In-Reply-To: <3FDEFD14.7060809@enervation.com> References: <3FDEFD14.7060809@enervation.com> Message-ID: <2147483647.1071582070@[10.11.11.50]> Please post in English. Thanks, -aj --On Dienstag, 16. Dezember 2003 13:39 Uhr +0100 Tom Snell wrote: > Sagt mir bitte wie ich das in den Klammern richtig schreibe: >

> ich kriege "Error Value: sequence index must be integer" > > Ich will einfach die Datein und Bilder auflisten, nicht die Verzeichnisse. > Hier ist es komplett: >

> Return to parent

> > >
>

> > Danke, > Tom > From robbenhaar at espresto.com Tue Dec 16 07:44:14 2003 From: robbenhaar at espresto.com (Clemens Robbenhaar) Date: Tue Dec 16 07:44:19 2003 Subject: [ZPT] objectValues( ??) In-Reply-To: <3FDEFD14.7060809@enervation.com> References: <3FDEFD14.7060809@enervation.com> Message-ID: <16350.65054.503858.860212@galsan.espresto.com> Hi Tom, ... seems someone fooled You with some different "Reply-To" header, or did You post this intentionally to the zpt-list? Anyway, the right syntax of: >

is most probably:

Cheers, Clemens From lynch at gould.mannlib.cornell.edu Wed Dec 17 14:38:11 2003 From: lynch at gould.mannlib.cornell.edu (Tim Lynch) Date: Wed Dec 17 14:38:15 2003 Subject: [ZPT] define-slot nested inside fill-slot Message-ID: <200312171938.OAA26680@gould.mannlib.cornell.edu> In Plone's main_template there are the following lines: Can someone explain the purpose of the define-slot statement inside the fill-slot? Is it to serve as some sort of default definition? The "real" define-slot for css_slot is in header.pt as expected, so what's the purpose of this one? As I understand ZPT, even if css_slot weren't defined in header.pt, no error would be thrown even if the above trick define-slot weren't used. -- tim lynch tlynch@nal.usda.gov From evan at 4-am.com Thu Dec 18 11:53:08 2003 From: evan at 4-am.com (Evan Simpson) Date: Thu Dec 18 11:53:17 2003 Subject: [ZPT] Re: define-slot nested inside fill-slot In-Reply-To: <200312171938.OAA26680@gould.mannlib.cornell.edu> References: <200312171938.OAA26680@gould.mannlib.cornell.edu> Message-ID: <3FE1DB74.4040401@4-am.com> Tim Lynch wrote: > Can someone explain the purpose of the define-slot statement > inside the fill-slot? When you use a macro, every slot in the macro is filled either with explicit fill-slot statements or with the default slot contents from the definition. Therefore, if you are "refining" a macro by using it in another macro definition, and you want to pass the slot through (allowing it to be filled by users of the new macro), you need to re-define the slot. Unfortunately, the current TAL code can't handle re-defining a slot on the same element that fills it. Cheers, Evan @ 4-am From Claire.Sherrington at nzx.com Thu Dec 18 12:00:30 2003 From: Claire.Sherrington at nzx.com (Claire Sherrington) Date: Thu Dec 18 12:00:54 2003 Subject: [ZPT] Re: ZPT Digest, Vol 9, Issue 7 (On leave : 19th Dec to 5th Jan) Message-ID: Claire Sherrington is on leave until 5th Jan , if your query is web site related please contact Alice Talbot (alice.talbot@nzx.com , 496 2878) for content issues or Richard Merryweather (richard.merryweather@nzx.com , 495 2815) for techincal issues Many thanks, Claire From Joe.Nguyen at coair.com Thu Dec 18 17:23:06 2003 From: Joe.Nguyen at coair.com (Nguyen, Joe) Date: Thu Dec 18 17:23:18 2003 Subject: [ZPT] calling external methods with parameters from a python script Message-ID: <28A471EF3151244187A887958F39415D0A050A19@nhqjexc02.nam.coair.com> Hi, I've been trying to work on this with no luck. It would be great if someone can direct me to a good resource. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.zope.org/pipermail/zpt/attachments/20031218/0573ecea/attachment.html From lists at elvix.com Fri Dec 19 05:01:59 2003 From: lists at elvix.com (Geir Bækholt · Plone Solutions) Date: Fri Dec 19 04:58:45 2003 Subject: [ZPT] calling external methods with parameters from a python script In-Reply-To: <28A471EF3151244187A887958F39415D0A050A19@nhqjexc02.nam.coair.com> References: <28A471EF3151244187A887958F39415D0A050A19@nhqjexc02.nam.coair.com> Message-ID: <1976900752.20031219110159@plonesolutions.com> On Thu, 18 Dec 2003 16:23:06 -0600 GMT Nguyen, Joe asked the ZPT mailinglist about the following: > I've been trying to work on this with no luck. It would be great if > someone can direct me to a good resource. there is some implicit magic for 'self' with external methods. To make sure all is explicit, pass in 'context' as the first argument: I believe this should work (untested): context.yourExternalMethod(context, arg1, arg2) I believe there is more on the subject here : http://zope.org/Documentation/Books/ZopeBook/2_6Edition/ScriptingZope.stx :) note: This is really a question for the Zope mailinglist, not the ZPT one. -- __________________________________________________________________ Geir B?kholt ? Interaction Architect ? Plone Solutions Development ? Training ? Support ? http://www.plonesolutions.com __________________________________________________________________ From phil at xfr.co.uk Fri Dec 19 08:16:50 2003 From: phil at xfr.co.uk (Philip Kilner) Date: Fri Dec 19 08:17:06 2003 Subject: [ZPT] Globals from calling script Message-ID: <3FE2FA42.5010306@xfr.co.uk> Hi List, I have a script which is calling a ZPT containing a form. The form submits to ".", which I understand to mean "me", and formulator checks it. If there are no errors, the script calls another ZPT. If there are errors, the script puts them in a dictionary and re-calls the first ZPT. My problem is that I can't figure out how to display my dictionary in the ZPT - whatever I try, I get either a "key error" or a "global not defined". The ZPT does not seem to have access to the same name space as the script, and if I use tal:define global I seem to be wiping out my dictionary. I'd naively though that by calling the ZPT from the script I had a single "environment". The alternate strategy I have tried is to call the script as the ZPT loads, but if I do this I can't figure out how to exit the form and return to the top-level script. Can anyone give a clue? FWIW, at this point I would rather be able to access Formulators errors directly from the ZPT, and would rather have my logic in the /calling/ script than a /called/ script - is this possible? -- Regards, PhilK Email: phil@xfr.co.uk / Voicemail & Facsimile: 07092 070518 "the symbols of the divine show up in our world initially at the trash stratum." Philip K Dick From dieter at handshake.de Fri Dec 19 17:50:21 2003 From: dieter at handshake.de (Dieter Maurer) Date: Fri Dec 19 18:00:40 2003 Subject: [ZPT] object located in in DTML but not ZPT In-Reply-To: <005201c3c35d$0fbd60b0$0500a8c0@VAIO> References: <005201c3c35d$0fbd60b0$0500a8c0@VAIO> Message-ID: <16355.32941.166812.34040@gargle.gargle.HOWL> Jeremy Ryan wrote at 2003-12-15 22:44 -0000: > ... > > >This seems like an awful hack to me, and I'd like to do it in entirely in >TAL/TALES. I want to do something like: > > > >but that doesn't work. You want to learn about the "python" TALES expression type (--> Zope Book). Short: '...tal:attributes="value python: pkGenerator.getNextValue()"...' will work. -- Dieter From dieter at handshake.de Sat Dec 20 07:30:49 2003 From: dieter at handshake.de (Dieter Maurer) Date: Sat Dec 20 07:52:48 2003 Subject: [ZPT] Globals from calling script In-Reply-To: <3FE2FA42.5010306@xfr.co.uk> References: <3FE2FA42.5010306@xfr.co.uk> Message-ID: <16356.16633.678453.136999@gargle.gargle.HOWL> Philip Kilner wrote at 2003-12-19 13:16 +0000: >I have a script which is calling a ZPT containing a form. The form >submits to ".", which I understand to mean "me" This is wrong. "." means the parent. "" means the same document but this is handled wrong by many browsers in some circumstances. Thus, do not rely on it. > ... >If there are no errors, the script calls another ZPT. If there are >errors, the script puts them in a dictionary and re-calls the first ZPT. > >My problem is that I can't figure out how to display my dictionary in >the ZPT - whatever I try, I get either a "key error" or a "global not >defined". > >The ZPT does not seem to have access to the same name space as the >script, This is indeed the case (and very wide spread in programming). >and if I use tal:define global I seem to be wiping out my >dictionary. I'd naively though that by calling the ZPT from the script I >had a single "environment". Such a techique is called dynamic binding and is highly error prone. Most (compiled) programming languages use static bindung: You can determine which variables are visible by looking (statically) at the code. It is not relevant how the function was called. Python is such a language. You must pass your dictionally as argument to your ZPT. Inside the ZPT, you can access it via the predefined "options" variable. Read the Zope Book, for details... -- Dieter From jmuniz at amazingbutterflies.com Sun Dec 21 07:16:37 2003 From: jmuniz at amazingbutterflies.com (Jose Muniz) Date: Sun Dec 21 07:18:39 2003 Subject: [ZPT] Design Help Message-ID: <000001c3c7bc$48f23dc0$6501a8c0@HP751N> > I'm new to Zope and am looking for some suggestions to the following > design problem. > > I currently have a single column listing with items within a > category/sub-category. > http://abf.zeta.zettai.net/Butterflies.com/products/010_artwork/framed > _prints/5x7_framed_prints > > But instead of listing them in a long single column; I'd like to have > a two column > listing with the items alternating from one column to the next until > all items for the > category have been read. > > Here's the current code that I have running today. It has two columns, > but the 2nd column is just > to add more text to the right of the images so that the pages don't > look so empty. > >

> > > > > > > > > >

> BORDER="0">
> > tal:define="increment repeat/item/number; pagename item/title" > tal:attributes="href item/absolute_url" > style="text-decoration:none"> > artwork title
>
    tal:replace="item/title_text">artwork title
>
> > > > > > >
>

> > > Thanks in advance > > Jose Muniz > 954.575.9047 > 800.808.6276 > > Amazing Butterflies & Butterflies.com > Where the Magic is Just a Flutter Away > www.amazingbutterflies.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.zope.org/pipermail/zpt/attachments/20031221/ebfbe5b2/attachment.html