use path function on a python script
Hi! How can I import the TALES funcion path on a python script? I would like to use the path function on a python script. The same path function I can use on page templates Imagine this TALES expression: python: path("a/concrete/path") Can I use it on a python script? Thanks! -- Mis Cosas http://blogs.sistes.net/Garito Zope Smart Manager http://blogs.sistes.net/Garito/670
Am 08.10.2008 4:46 Uhr, Garito schrieb:
Hi! How can I import the TALES funcion path on a python script?
I would like to use the path function on a python script. The same path function I can use on page templates
Imagine this TALES expression: python: path("a/concrete/path")
Can I use it on a python script?
Why can't you use acquisition or traversal? -aj
Perhaps is better if I explain you what I'm trying to do Imagine a Plone site (I know there are a plone list but this is a generic question, sorry if not) I configure it in the way if you put a parameter ?print the plone point renders as when you push the print button at the bottom of the point For example: plone_site_url/front-page?print renders the plone front page with the print.css sytle Now I want to get the rendered code of this point as string to pass it to PDFNode.renderAsPdf (it expect a string with the HTML and the name of the generated pdf) Did you know how can I get the html code of an url with get parameters? 2008/10/8 Andreas Jung <lists@zopyx.com>
Am 08.10.2008 4:46 Uhr, Garito schrieb:
Hi! How can I import the TALES funcion path on a python script?
I would like to use the path function on a python script. The same path function I can use on page templates
Imagine this TALES expression: python: path("a/concrete/path")
Can I use it on a python script?
Why can't you use acquisition or traversal?
-aj
-- Mis Cosas http://blogs.sistes.net/Garito Zope Smart Manager http://blogs.sistes.net/Garito/670
Garito wrote:
Perhaps is better if I explain you what I'm trying to do
Imagine a Plone site (I know there are a plone list but this is a generic question, sorry if not)
I configure it in the way if you put a parameter ?print the plone point renders as when you push the print button at the bottom of the point
For example: plone_site_url/front-page?print renders the plone front page with the print.css sytle
Now I want to get the rendered code of this point as string to pass it to PDFNode.renderAsPdf (it expect a string with the HTML and the name of the generated pdf)
Did you know how can I get the html code of an url with get parameters?
just context['front-page'](print=True) ? or something? (Am I the only one which does not see value in a print button because there is CSS to make this happen without server interaction? ) Regards Tino
2008/10/8 Tino Wildenhain <tino@wildenhain.de>
Garito wrote:
Perhaps is better if I explain you what I'm trying to do
Imagine a Plone site (I know there are a plone list but this is a generic question, sorry if not)
I configure it in the way if you put a parameter ?print the plone point renders as when you push the print button at the bottom of the point
For example: plone_site_url/front-page?print renders the plone front page with the print.css sytle
Now I want to get the rendered code of this point as string to pass it to PDFNode.renderAsPdf (it expect a string with the HTML and the name of the generated pdf)
Did you know how can I get the html code of an url with get parameters?
just context['front-page'](print=True) ?
Perhaps but this puts print on options/args/print or options/print in the page_template scope, isn't it? In my way to solve this I use request/form/print because plone_css use tal expressions and request is passed to it
or something? (Am I the only one which does not see value in a print button because there is CSS to make this happen without server interaction? )
Yes, this work as you think but if you need the same view (the print view) in the server side you need to change portal_css
Regards Tino
-- Mis Cosas http://blogs.sistes.net/Garito Zope Smart Manager http://blogs.sistes.net/Garito/670
Am 08.10.2008 7:17 Uhr, Garito schrieb:
2008/10/8 Tino Wildenhain <tino@wildenhain.de <mailto:tino@wildenhain.de>>
Garito wrote:
Perhaps is better if I explain you what I'm trying to do
Imagine a Plone site (I know there are a plone list but this is a generic question, sorry if not)
I configure it in the way if you put a parameter ?print the plone point renders as when you push the print button at the bottom of the point
For example: plone_site_url/front-page?print renders the plone front page with the print.css sytle
Now I want to get the rendered code of this point as string to pass it to PDFNode.renderAsPdf (it expect a string with the HTML and the name of the generated pdf)
Did you know how can I get the html code of an url with get parameters?
just context['front-page'](print=True) ?
Perhaps but this puts print on options/args/print or options/print in the page_template scope, isn't it?
In my way to solve this I use request/form/print because plone_css use tal expressions and request is passed to it
Then fix your code in a way to accept parameters either from request or options. The '|' operator is your friend in TALES. -aj -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: info@zopyx.com - Phone +49 - 7071 - 793376 Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535 Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK ------------------------------------------------------------------------ E-Publishing, Python, Zope & Plone development, Consulting
Sorry Andreas but I can't modify portal_css 2008/10/8 Andreas Jung <lists@zopyx.com>
Am 08.10.2008 7:17 Uhr, Garito schrieb:
2008/10/8 Tino Wildenhain <tino@wildenhain.de <mailto:tino@wildenhain.de
Garito wrote:
Perhaps is better if I explain you what I'm trying to do
Imagine a Plone site (I know there are a plone list but this is a generic question, sorry if not)
I configure it in the way if you put a parameter ?print the plone point renders as when you push the print button at the bottom of the point
For example: plone_site_url/front-page?print renders the plone front page with the print.css sytle
Now I want to get the rendered code of this point as string to pass it to PDFNode.renderAsPdf (it expect a string with the HTML and the name of the generated pdf)
Did you know how can I get the html code of an url with get parameters?
just context['front-page'](print=True) ?
Perhaps but this puts print on options/args/print or options/print in the page_template scope, isn't it?
In my way to solve this I use request/form/print because plone_css use tal expressions and request is passed to it
Then fix your code in a way to accept parameters either from request or options. The '|' operator is your friend in TALES.
-aj
-- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: info@zopyx.com - Phone +49 - 7071 - 793376 Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535 Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK ------------------------------------------------------------------------ E-Publishing, Python, Zope & Plone development, Consulting
-- Mis Cosas http://blogs.sistes.net/Garito Zope Smart Manager http://blogs.sistes.net/Garito/670
Everything can be possible but I like non-intrusive solutions and modify the portal_css will be a heavy-intrusive way I'm thinking about it but if someone has an *as non-intrusive as possible* solution will be very appreciate Thanks! 2008/10/8 Andreas Jung <lists@zopyx.com>
Am 08.10.2008 7:36 Uhr, Garito schrieb:
Sorry Andreas but I can't modify portal_css
Everything can be modified.
-aj
-- Mis Cosas http://blogs.sistes.net/Garito Zope Smart Manager http://blogs.sistes.net/Garito/670
Garito wrote:
2008/10/8 Tino Wildenhain <tino@wildenhain.de <mailto:tino@wildenhain.de>>
Garito wrote:
Perhaps is better if I explain you what I'm trying to do
Imagine a Plone site (I know there are a plone list but this is a generic question, sorry if not)
I configure it in the way if you put a parameter ?print the plone point renders as when you push the print button at the bottom of the point
For example: plone_site_url/front-page?print renders the plone front page with the print.css sytle
Now I want to get the rendered code of this point as string to pass it to PDFNode.renderAsPdf (it expect a string with the HTML and the name of the generated pdf)
Did you know how can I get the html code of an url with get parameters?
just context['front-page'](print=True) ?
Perhaps but this puts print on options/args/print or options/print in the page_template scope, isn't it?
In my way to solve this I use request/form/print because plone_css use tal expressions and request is passed to it
This would be very ugly. However in this case just set context.REQUEST or context.REQUEST.form accordingly HTH Tino
I'm agree with you, Tino. Plone has a lot of ugly features (as KSS, for instance) Perhaps someone has a better solution for this issue I only want to generate a PDF with the print view of a plone point Plone2PDF will be ok but only works with Plone 2.5 or less 2008/10/8 Tino Wildenhain <tino@wildenhain.de>
Garito wrote:
2008/10/8 Tino Wildenhain <tino@wildenhain.de <mailto:tino@wildenhain.de
Garito wrote:
Perhaps is better if I explain you what I'm trying to do
Imagine a Plone site (I know there are a plone list but this is a generic question, sorry if not)
I configure it in the way if you put a parameter ?print the plone point renders as when you push the print button at the bottom of the point
For example: plone_site_url/front-page?print renders the plone front page with the print.css sytle
Now I want to get the rendered code of this point as string to pass it to PDFNode.renderAsPdf (it expect a string with the HTML and the name of the generated pdf)
Did you know how can I get the html code of an url with get parameters?
just context['front-page'](print=True) ?
Perhaps but this puts print on options/args/print or options/print in the page_template scope, isn't it?
In my way to solve this I use request/form/print because plone_css use tal expressions and request is passed to it
This would be very ugly. However in this case just set context.REQUEST or context.REQUEST.form accordingly
HTH Tino
-- Mis Cosas http://blogs.sistes.net/Garito Zope Smart Manager http://blogs.sistes.net/Garito/670
Garito wrote at 2008-10-8 14:22 +0200:
I'm agree with you, Tino. Plone has a lot of ugly features (as KSS, for instance)
Why is KSS ugly? Reading the documentation, I found it quite attractive.... -- Dieter
On 11.10.2008 2:21 Uhr, Dieter Maurer wrote:
Garito wrote at 2008-10-8 14:22 +0200:
I'm agree with you, Tino. Plone has a lot of ugly features (as KSS, for instance)
Why is KSS ugly? Reading the documentation, I found it quite attractive....
You know, there is this difference between theory and practise :-) -aj
Andreas Jung wrote at 2008-10-11 06:05 -0400:
On 11.10.2008 2:21 Uhr, Dieter Maurer wrote:
Garito wrote at 2008-10-8 14:22 +0200:
I'm agree with you, Tino. Plone has a lot of ugly features (as KSS, for instance)
Why is KSS ugly? Reading the documentation, I found it quite attractive....
You know, there is this difference between theory and practise :-)
I know the theory about this and would be interested in the concrete practise concerning KSS. Or more precisely: what makes KSS ugly in practise? -- Dieter
On 12.10.2008 1:40 Uhr, Dieter Maurer wrote:
Andreas Jung wrote at 2008-10-11 06:05 -0400:
On 11.10.2008 2:21 Uhr, Dieter Maurer wrote:
Garito wrote at 2008-10-8 14:22 +0200:
I'm agree with you, Tino. Plone has a lot of ugly features (as KSS, for instance) Why is KSS ugly? Reading the documentation, I found it quite attractive.... You know, there is this difference between theory and practise :-)
I know the theory about this and would be interested in the concrete practise concerning KSS.
Or more precisely: what makes KSS ugly in practise?
The KSS approach is too weak if you work on really complex "web 2.0-ish" apps. Especially you end up with adding further JS functionality using jquery (included with Plone) and likely some over JS framework for doing the UI (like Dojo or ExtJS). Andreas
In my country, Spain, there are a very high difference between the price it cost a tomato when you buy it to the farmer that if you buy it on the store. Why? Because of the intermediaries In my opinion KSS is an intermediary who raises the work that the computer needs to do to retrieve a response and more if we put the non intrusive javascript techniques on the table Sorry but I love minimalism and KSS is anything but minimalism 2008/10/11 Dieter Maurer <dieter@handshake.de>
Garito wrote at 2008-10-8 14:22 +0200:
I'm agree with you, Tino. Plone has a lot of ugly features (as KSS, for instance)
Why is KSS ugly? Reading the documentation, I found it quite attractive....
-- Dieter
-- Mis Cosas http://blogs.sistes.net/Garito Zope Smart Manager http://blogs.sistes.net/Garito/670
On 11.10.2008 10:37 Uhr, Garito wrote:
In my country, Spain, there are a very high difference between the price it cost a tomato when you buy it to the farmer that if you buy it on the store. Why? Because of the intermediaries
In my opinion KSS is an intermediary who raises the work that the computer needs to do to retrieve a response and more if we put the non intrusive javascript techniques on the table
Sorry but I love minimalism and KSS is anything but minimalism
I think the issue with loving or hating KSS is basically a matter of personal preferences and personal programming style. -aj
Garito wrote at 2008-10-11 16:37 +0200:
In my country, Spain, there are a very high difference between the price it cost a tomato when you buy it to the farmer that if you buy it on the store. Why? Because of the intermediaries
Sure. But sometimes intermediaries are helpful. I, e.g., would be unable to buy spanish tomatoes (or strawberries) in Germany without intermediaries.
In my opinion KSS is an intermediary who raises the work that the computer needs to do to retrieve a response and more if we put the non intrusive javascript techniques on the table
Sorry but I love minimalism and KSS is anything but minimalism
Sure, intermediaries have a price -- but often, they also add value. KSS, e.g., allows you to update individual portlets or menues without reloading the complete page. This may reduce the work computers must do. This can be done with other (JS-based) techniques as well. However in addition, KSS handles the case with/without JS in a transparent way. As my colleagues intensively fight (and put much work into it) with our requirment "must work with and without JS", I find this quite attractive. -- Dieter
2008/10/12 Dieter Maurer <dieter@handshake.de>
Garito wrote at 2008-10-11 16:37 +0200:
In my country, Spain, there are a very high difference between the price it cost a tomato when you buy it to the farmer that if you buy it on the store. Why? Because of the intermediaries
Sure. But sometimes intermediaries are helpful.
Not in this case
I, e.g., would be unable to buy spanish tomatoes (or strawberries) in Germany without intermediaries.
This is internet, we don't need any kind of intermediary to achieve our needs. You could choose more than one technique to do the job, not only KSS
In my opinion KSS is an intermediary who raises the work that the computer needs to do to retrieve a response and more if we put the non intrusive javascript techniques on the table
Sorry but I love minimalism and KSS is anything but minimalism
Sure, intermediaries have a price -- but often, they also add value.
Not in this case: you could do the same without KSS
KSS, e.g., allows you to update individual portlets or menues without reloading the complete page. This may reduce the work computers must do. This can be done with other (JS-based) techniques as well. However in addition, KSS handles the case with/without JS in a transparent way. As my colleagues intensively fight (and put much work into it) with our requirment "must work with and without JS", I find this quite attractive.
I'm doing this since the begining with gmail. do gmail use kss? no. There are a lot of people doing non-untrosive javascript without KSS This is the real case: the computer needs to do 2 passes to achieve the real result. Without KSS you create the non AJAX page and if the client has javascript make the transformation. With KSS there are another pass to do the same Not to much minimalism, isn't it?
-- Dieter
-- Mis Cosas http://blogs.sistes.net/Garito Zope Smart Manager http://blogs.sistes.net/Garito/670
Garito wrote at 2008-10-12 17:00 +0200:
... This is internet, we don't need any kind of intermediary to achieve our needs.
Really? Yo *do* need intermediaries -- lots of them: browser, network, routers, DNS, .... You may not need KSS -- but it may help you for some tasks. If it does not help you, no need to use it.
You could choose more than one technique to do the job, not only KSS Sure.
One of the major KSS use cases has been minimal differences between support for JS and for non-JS situations. Non-KSS solutions tend to have some problems with this use case (at least my colleages spend months to support this -- with non-KSS).
.... This is the real case: the computer needs to do 2 passes to achieve the real result. Without KSS you create the non AJAX page and if the client has javascript make the transformation. With KSS there are another pass to do the same
Not to much minimalism, isn't it?
Looks like your understanding of KSS differs considerably from mine: In my understanding of KSS: almost nothing is different from the non AJAX case for the initial request: the page is fetched and rendered. For KSS, in addition, the KSS library is fetched (if not already loaded) and the KS style sheet activated (some JS handler defined). The differences only come when the user interacts with the page. With KSS, the user actions are intercepted by the KSS JS handlers and interpreted. They may result in server requests which return a series of KSS commands which are executed. In the non AJAX case, the complete page is reloaded -- with often is more work for both server and browser. Thus, indeed, the non Ajax modul is simpler than the KSS model -- but not necessarily less expensive. -- Dieter
Dieter Maurer a écrit :
Garito wrote at 2008-10-8 14:22 +0200:
I'm agree with you, Tino. Plone has a lot of ugly features (as KSS, for instance)
Why is KSS ugly? Reading the documentation, I found it quite attractive....
That is what KSS opponents atr thinking: http://svn.plone.org/svn/collective/collective.kss.fucker/trunk/README.txt -- Encolpe Degoute INGENIWEB (TM) - S.A.S 50000 Euros - RC B 438 725 632 Bureaux de la Colline 1 rue Royal 92210 Saint Cloud web : www.ingeniweb.com - « les Services Web Ingénieux » Tel : 01.78.15.24.08 / Fax : 01 47 57 39 14
Encolpe Degoute wrote:
Dieter Maurer a écrit :
Garito wrote at 2008-10-8 14:22 +0200:
I'm agree with you, Tino. Plone has a lot of ugly features (as KSS, for instance) Why is KSS ugly? Reading the documentation, I found it quite attractive....
That is what KSS opponents atr thinking: http://svn.plone.org/svn/collective/collective.kss.fucker/trunk/README.txt
This document provides as little substance as much as it manages to insult the authors of KSS.
Philipp von Weitershausen a écrit :
Encolpe Degoute wrote:
Dieter Maurer a écrit :
Garito wrote at 2008-10-8 14:22 +0200:
I'm agree with you, Tino. Plone has a lot of ugly features (as KSS, for instance) Why is KSS ugly? Reading the documentation, I found it quite attractive.... That is what KSS opponents atr thinking: http://svn.plone.org/svn/collective/collective.kss.fucker/trunk/README.txt
This document provides as little substance as much as it manages to insult the authors of KSS.
I'm not the author of this document and if I'm agree that there's some work to do on KSS I'm not agree with the manner it is done. It seems that the first goal was to rewrite KSS using JQuery that is already loaded in much framework. -- Encolpe Degoute INGENIWEB (TM) - S.A.S 50000 Euros - RC B 438 725 632 Bureaux de la Colline 1 rue Royal 92210 Saint Cloud web : www.ingeniweb.com - « les Services Web Ingénieux » Tel : 01.78.15.24.08 / Fax : 01 47 57 39 14
On Mon, Oct 13, 2008 at 2:24 PM, Encolpe Degoute <encolpe.degoute@ingeniweb.com> wrote:
That is what KSS opponents atr thinking: http://svn.plone.org/svn/collective/collective.kss.fucker/trunk/README.txt
I think that these "KSS opponents" (sic) may want to choose a more elegant name... -- Damien Baty
On Mon, Oct 13, 2008 at 8:37 AM, Damien Baty <damien.baty@gmail.com> wrote:
On Mon, Oct 13, 2008 at 2:24 PM, Encolpe Degoute <encolpe.degoute@ingeniweb.com> wrote:
That is what KSS opponents atr thinking: http://svn.plone.org/svn/collective/collective.kss.fucker/trunk/README.txt
I think that these "KSS opponents" (sic) may want to choose a more elegant name...
I would like to mention that Christophe talks and acts on his own right there, he submitted this package on his own self and Ingeniweb is not part of this action. I just had a breakfast with Godefroid this morning where we talked about our uses cases at ingeniweb and things we could do together. I have asked Christophe to remove the "ingeniweb" name from this package, and to remove the "kss" name as well, because this is not only insulting the KSS guys, this is also insulting the Ingeniweb guys that works with KSS everyday.
-- Damien Baty _______________________________________________ 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 )
-- Tarek Ziadé | Association AfPy | www.afpy.org Blog FR | http://programmation-python.org Blog EN | http://tarekziade.wordpress.com/
Garito wrote at 2008-10-8 10:46 +0200:
How can I import the TALES funcion path on a python script?
You cannot -- while it looks like a normal function, it not really is one. "path" gets a string but interprets this string with knowledge about the template's namespace. This shows you that some magic must be in the background that provides the template namespace to whatever implements "path". This magic is unavailable in a "Script Python". In fact, the "path" handling is prepared in "Products.PageTemplates.PythonExpr.PythonExpr._bind_used_names" by the following code: for vname in self._f_varnames: val = vars.get(vname, _marker) if val is _marker: has = val = getType(vname) if has: val = ExprTypeProxy(vname, val, econtext) names[vname] = val The last two lines bind "path" to "ExprTypeProxy('path', val, econtext)". This is what comes nearest to "the TALES function path". As you can see, it is not a simple function but one provided with lots of context information (behind the scenes). The "econtext" contains the template's namespace. -- Dieter
Did you imagine another way to do what I need to do? 2008/10/11 Dieter Maurer <dieter@handshake.de>
Garito wrote at 2008-10-8 10:46 +0200:
How can I import the TALES funcion path on a python script?
You cannot -- while it looks like a normal function, it not really is one.
"path" gets a string but interprets this string with knowledge about the template's namespace. This shows you that some magic must be in the background that provides the template namespace to whatever implements "path". This magic is unavailable in a "Script Python".
In fact, the "path" handling is prepared in "Products.PageTemplates.PythonExpr.PythonExpr._bind_used_names" by the following code:
for vname in self._f_varnames: val = vars.get(vname, _marker) if val is _marker: has = val = getType(vname) if has: val = ExprTypeProxy(vname, val, econtext) names[vname] = val
The last two lines bind "path" to "ExprTypeProxy('path', val, econtext)". This is what comes nearest to "the TALES function path". As you can see, it is not a simple function but one provided with lots of context information (behind the scenes). The "econtext" contains the template's namespace.
-- Dieter
-- Mis Cosas http://blogs.sistes.net/Garito Zope Smart Manager http://blogs.sistes.net/Garito/670
Garito wrote at 2008-10-11 16:39 +0200:
Did you imagine another way to do what I need to do?
I have not followed intensively "what you need to do". Thus, what follows may not be adequate. When I remember right, then a PageTemplate's namespace is passed on to a "Script (Python)" when this script binds "namespace". Thus, this way you get access to the variables defined in the template. A simple path "var/s1/.../sn" is roughly requivalent to x = var.restricedTraverse("s1/.../sn") if callable(x): x = x() # "callable" may not be available in "Script (Python)" If the path contains "?var", these must be resolved beforehand. More complex paths "p1 | p2 | ... pn" are roughly equivalent to exc = None for p in (p1, p2, ... pn): try: return path1(p, ...) except <some standard exceptions>: exc = sys.exc_info() if exc is not None: raise exc[0], exc[1], exc[2] The most difficult part are for paths where "pn" is not a path expression but an arbitrary one. In this case, the concrete TALES implementation will be required for an interpretation. Along this outline, a function "path(path_expr, variable_binding)" can be defined which roughly behaves like "path(path_expr)" in a PageTemplate with the current variable binding expressed as "variable_binding". For simple cases, this function could be implemented in untrusted code. Complex cases will require access to the TALES implementation and therefore probably trusted code. -- Dieter
This is like KSS question: why we resolve a question with the first way we find? not the better one? Is the human being. But as Steve Jobs said some time ago: only excelence people don't stop in the first way to resolve a problem When I meet Zope for the first time I was absolutely impress with it There was nothing better to represent an object universe I know that Zopers have their own way (this was discuss some time ago, too) but my ideal scenario will be a minimalism Zope where everything was an URL In this ideal scenario you could ask for an URL with or without parameters as if you ask for to the browser We stop this theme to wait for a Plone2PDF or similar. I hope we could solve this in a simple way (I think if this needs a more complicated solution we will have failed) I only need to put a link with the PDF download to the current page! (this don't sound to much complicated, isn't it?) 2008/10/12 Dieter Maurer <dieter@handshake.de>
Garito wrote at 2008-10-11 16:39 +0200:
Did you imagine another way to do what I need to do?
I have not followed intensively "what you need to do". Thus, what follows may not be adequate.
When I remember right, then a PageTemplate's namespace is passed on to a "Script (Python)" when this script binds "namespace". Thus, this way you get access to the variables defined in the template.
A simple path "var/s1/.../sn" is roughly requivalent to
x = var.restricedTraverse("s1/.../sn") if callable(x): x = x() # "callable" may not be available in "Script (Python)"
If the path contains "?var", these must be resolved beforehand.
More complex paths "p1 | p2 | ... pn" are roughly equivalent to
exc = None for p in (p1, p2, ... pn): try: return path1(p, ...) except <some standard exceptions>: exc = sys.exc_info() if exc is not None: raise exc[0], exc[1], exc[2]
The most difficult part are for paths where "pn" is not a path expression but an arbitrary one. In this case, the concrete TALES implementation will be required for an interpretation.
Along this outline, a function "path(path_expr, variable_binding)" can be defined which roughly behaves like "path(path_expr)" in a PageTemplate with the current variable binding expressed as "variable_binding".
For simple cases, this function could be implemented in untrusted code. Complex cases will require access to the TALES implementation and therefore probably trusted code.
-- Dieter
-- Mis Cosas http://blogs.sistes.net/Garito Zope Smart Manager http://blogs.sistes.net/Garito/670
Garito wrote at 2008-10-12 17:13 +0200:
This is like KSS question: why we resolve a question with the first way we find?
I do not think that this was the case for KSS. When KSS was developped, there already have been lots of solutions -- but not satisfactory ones when you want only small differences between your site visited with and without JavaScript.
not the better one? Is the human being. But as Steve Jobs said some time ago: only excelence people don't stop in the first way to resolve a problem
Steve Jobs also was responsible for ealier versions of Mac-OS -- and they suffered heavily for a very peculiar memory management system (it took more effort to port a working solution to those Mac-OS versions than the complete development on a different platform). Here, the trial to be excellent was very counterproductive.
... I only need to put a link with the PDF download to the current page! (this don't sound to much complicated, isn't it?)
The url of the current page is "string:${request/URL}?${request/QUERY_STRING}" (in a PageTemplate) or "'%s?%s' % (request['URL'], request['QUERY_STRING'])" (in a "Script (Python)"). I do not know "Plone2PDF" and cannot tell how it is integrated with the page it should render as PDF. But it cannot be that difficult to contruct the corresponding urls. It is very unlikely that you need the "path" "function" for this. -- Dieter
participants (8)
-
Andreas Jung -
Damien Baty -
Dieter Maurer -
Encolpe Degoute -
Garito -
Philipp von Weitershausen -
Tarek Ziadé -
Tino Wildenhain