How Do I "Structure" This?
Hi; I have the following PT code: <a tal:attributes="href python:here.a_script(str(x))"> and I want to "structure" it, kind of like this: <a tal:attributes="structure href python:here.a_script(str(x))"> How do I do that? TIA, Tony ________________________________________________________________________ AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com.
--On 15. August 2007 10:17:56 -0400 tonylabarbara@aol.com wrote:
Hi; I have the following PT code: <a tal:attributes="href python:here.a_script(str(x))"> and I want to "structure" it, kind of like this: <a tal:attributes="structure href python:here.a_script(str(x))"> How do I do that?
As documented, 'structure' only works with tal:content|replace. -aj
Bummer. Well, I'm trying to call a script that will render content to the Web, like this: <a tal:attributes="href python:here.a_script(str(x))"> which calls a script that does this: return "<html><body>" + x + "</body></html>" but of course it delivers this to the browser: <html><body>x</body></html> Any way to work around this problem? TIA, Tony -----Original Message----- From: Andreas Jung <lists@zopyx.com> To: tonylabarbara@aol.com; zope@zope.org Sent: Wed, 15 Aug 2007 10:20 am Subject: Re: [Zope] How Do I "Structure" This? ? --On 15. August 2007 10:17:56 -0400 tonylabarbara@aol.com wrote:? ?
Hi;? I have the following PT code:? <a tal:attributes="href python:here.a_script(str(x))">? and I want to "structure" it, kind of like this:? <a tal:attributes="structure href python:here.a_script(str(x))">? How do I do that?? ? As documented, 'structure' only works with tal:content|replace.? ? -aj?
________________________________________________________________________ AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com.
Why would you put HTML inside an HREF? Sounds to me like you want <html tal:replace="structure python: here.a_script(str(x))" /> or something like that. ________________________________ From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of tonylabarbara@aol.com Sent: August 15, 2007 10:45 To: lists@zopyx.com; zope@zope.org Subject: Re: [Zope] How Do I "Structure" This? Bummer. Well, I'm trying to call a script that will render content to the Web, like this: <a tal:attributes="href python:here.a_script(str(x))"> which calls a script that does this: return "<html><body>" + x + "</body></html>" but of course it delivers this to the browser: <html><body>x</body></html> Any way to work around this problem? TIA, Tony -----Original Message----- From: Andreas Jung <lists@zopyx.com> To: tonylabarbara@aol.com; zope@zope.org Sent: Wed, 15 Aug 2007 10:20 am Subject: Re: [Zope] How Do I "Structure" This? --On 15. August 2007 10:17:56 -0400 tonylabarbara@aol.com wrote:
Hi; I have the following PT code: <a tal:attributes="href python:here.a_script(str(x))"> and I want to "structure" it, kind of like this: <a tal:attributes="structure href python:here.a_script(str(x))"> How do I do that?
As documented, 'structure' only works with tal:content|replace. -aj ________________________________ AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com <http://www.aol.com?ncid=AOLAOF00020000000437> .
Well, I'm trying to do the following: 1) generate a list of variables using tal:define 2) pass those variables to a script, that will then make a few edits and render everything as an HTML page. I'm doing this as a work-around to the problem I posted earlier, that nobody apparently could solve, called "Form-Through-Script", where I was trying to call a script using a form action but couldn't pass the page as a variable. Well, I can pass variables and reconstruct the page, but then I have the problem of missing "structure". Conversely, it could pass those variables to a page that would then render, but how to pass them and render the page? There has GOT to be a way to work around this! TIA, Tony -----Original Message----- From: Doyon, Jean-Francois <jdoyon@NRCan.gc.ca> To: tonylabarbara@aol.com; lists@zopyx.com; zope@zope.org Sent: Wed, 15 Aug 2007 10:50 am Subject: RE: [Zope] How Do I "Structure" This? Why would you put HTML inside an HREF? ? Sounds to me like you want <html tal:replace="structure python: here.a_script(str(x))" /> or something like that. From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of tonylabarbara@aol.com Sent: August 15, 2007 10:45 To: lists@zopyx.com; zope@zope.org Subject: Re: [Zope] How Do I "Structure" This? Bummer. Well, I'm trying to call a script that will render content to the Web, like this: <a tal:attributes="href python:here.a_script(str(x))"> which calls a script that does this: return "<html><body>" + x + "</body></html>" but of course it delivers this to the browser: <html><body>x</body></html> Any way to work around this problem? TIA, Tony -----Original Message----- From: Andreas Jung <lists@zopyx.com> To: tonylabarbara@aol.com; zope@zope.org Sent: Wed, 15 Aug 2007 10:20 am Subject: Re: [Zope] How Do I "Structure" This? --On 15. August 2007 10:17:56 -0400 tonylabarbara@aol.com wrote:? ?
Hi;? I have the following PT code:? <a tal:attributes="href python:here.a_script(str(x))">? and I want to "structure" it, kind of like this:? <a tal:attributes="structure href python:here.a_script(str(x))">? How do I do that?? ? As documented, 'structure' only works with tal:content|replace.? ? -aj?
AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com. ________________________________________________________________________ AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com.
Ah Tony, looks like the penny is yet to drop... tonylabarbara@aol.com wrote:
Bummer. Well, I'm trying to call a script that will render content to the Web, like this: <a tal:attributes="href python:here.a_script(str(x))">
My guess is that what you're _really_ trying to do here is: <a href="" tal:attributes="href string:${here/a_script/absolute_url}?avar=${x}"/> ...but next you'll be wondering how to url quote x. I feel we're fighting a loosing battle here... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
--On 15. August 2007 16:05:13 +0100 Chris Withers <chris@simplistix.co.uk> wrote:
Ah Tony,
looks like the penny is yet to drop...
tonylabarbara@aol.com wrote:
Bummer. Well, I'm trying to call a script that will render content to the Web, like this: <a tal:attributes="href python:here.a_script(str(x))">
My guess is that what you're _really_ trying to do here is:
<a href="" tal:attributes="href string:${here/a_script/absolute_url}?avar=${x}"/>
...but next you'll be wondering how to url quote x.
By using the well-know url_quote() or url_quote_plus() methods. -aj
Andreas Jung wrote:
<a href="" tal:attributes="href string:${here/a_script/absolute_url}?avar=${x}"/>
...but next you'll be wondering how to url quote x.
By using the well-know url_quote() or url_quote_plus() methods.
...and in a page template? ;-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
I tried this: <a tal:attributes="href string:${here/a_script}?doc=${x}"> but got this error: Error Type: TypeError Error Value: a_script() takes exactly 1 argument (0 given) Next, I rewrote the script to put in a try statement for the variable, to test that, but before I even got to test I looked at the rendered code from the above line and it gave me this: <a href="<html><body>nope</body></html>?doc=0"> So it doesn't look like the "string:${..." workaround worked :( And I don't think I need to URLquote. TIA, Tony -----Original Message----- From: Chris Withers <chris@simplistix.co.uk> To: tonylabarbara@aol.com Cc: lists@zopyx.com; zope@zope.org Sent: Wed, 15 Aug 2007 11:05 am Subject: Re: [Zope] How Do I "Structure" This? Ah Tony,? ? looks like the penny is yet to drop...? ? tonylabarbara@aol.com wrote:?
Bummer. Well, I'm trying to call a script that will render content to the Web, like this:? <a tal:attributes="href python:here.a_script(str(x))">? ? My guess is that what you're _really_ trying to do here is:? ? <a href=""? ?tal:attributes="href string:${here/a_script/absolute_url}?avar=${x}"/>? ? ...but next you'll be wondering how to url quote x.? ? I feel we're fighting a loosing battle here...? ? Chris? ? -- Simplistix - Content Management, Zope & Python Consulting? ? - http://www.simplistix.co.uk?
________________________________________________________________________ AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com.
In my opinion the correct sentence will be: <a tal:attributes="href python: here.a_script(x)" /> But they are trying to say you that structure don't do anything here because an anchor expect or a URL or a javascript You are trying to put an html code into an anchor but this don't work on HTML or xHTML If you want to execute the scritp when the user clicks on the anchor you need to use something like: <a tal:attributes="href <the url of the script>" /> -> <a tal:attributes="href string:${here.a_script/absolute_url}?doc=${x}" /> and when the user clicks the anchor the script will be executed can you find a reference help about HTML o xHTML with an anchor like this: <a href="<html><body>your page here</body></html>" /> no, isn't it? then structure don't do nothing here... 2007/8/15, tonylabarbara@aol.com <tonylabarbara@aol.com>:
I tried this: <a tal:attributes="href string:${here/a_script}?doc=${x}"> but got this error: *Error Type: TypeError Error Value: a_script() takes exactly 1 argument (0 given)* Next, I rewrote the script to put in a try statement for the variable, to test that, but before I even got to test I looked at the rendered code from the above line and it gave me this: <a href="<html><body>nope</body></html>?doc=0"> So it doesn't look like the "string:${..." workaround worked :( And I don't think I need to URLquote. TIA, Tony
-----Original Message----- From: Chris Withers <chris@simplistix.co.uk> To: tonylabarbara@aol.com Cc: lists@zopyx.com; zope@zope.org Sent: Wed, 15 Aug 2007 11:05 am Subject: Re: [Zope] How Do I "Structure" This?
Ah Tony,
looks like the penny is yet to drop...
tonylabarbara@aol.com wrote:
Bummer. Well, I'm trying to call a script that will render content to the Web, like this: <a tal:attributes="href python:here.a_script(str(x))">
My guess is that what you're _really_ trying to do here is:
<a href="" tal:attributes="href string:${here/a_script/absolute_url}?avar=${x}"/>
...but next you'll be wondering how to url quote x.
I feel we're fighting a loosing battle here...
Chris
-- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ------------------------------ AOL now offers free email to everyone. Find out more about what's free from AOL at *AOL.com* <http://www.aol.com?ncid=AOLAOF00020000000437>.
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Mis Cosas http://blogs.sistes.net/Garito
tonylabarbara@aol.com wrote:
I tried this: <a tal:attributes="href string:${here/a_script}?doc=${x}"> but got this error: Error Type: TypeError Error Value: a_script() takes exactly 1 argument (0 given)
Yeah, as you discovered later, leaving bits of things people suggest off is stupid ;-)
So it doesn't look like the "string:${..." workaround worked :(
It's not a workaround. There's nothing to workaround.
And I don't think I need to URLquote.
Oh? And what happens when x contains non-url-safe characters like spaces, slashes, colons, etc? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Oops...forgot the "absolute_url" part <:-) Works fine now. Thanks! Tony -----Original Message----- From: Chris Withers <chris@simplistix.co.uk> To: tonylabarbara@aol.com Cc: lists@zopyx.com; zope@zope.org Sent: Wed, 15 Aug 2007 11:05 am Subject: Re: [Zope] How Do I "Structure" This? Ah Tony,? ? looks like the penny is yet to drop...? ? tonylabarbara@aol.com wrote:?
Bummer. Well, I'm trying to call a script that will render content to the Web, like this:? <a tal:attributes="href python:here.a_script(str(x))">? ? My guess is that what you're _really_ trying to do here is:? ? <a href=""? ?tal:attributes="href string:${here/a_script/absolute_url}?avar=${x}"/>? ? ...but next you'll be wondering how to url quote x.? ? I feel we're fighting a loosing battle here...? ? Chris? ? -- Simplistix - Content Management, Zope & Python Consulting? ? - http://www.simplistix.co.uk?
________________________________________________________________________ AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com.
participants (5)
-
Andreas Jung -
Chris Withers -
Doyon, Jean-Francois -
Garito -
tonylabarbara@aol.com