Calling DTML methods from Python
I want to run manage_tabs from a PythonMethod. So I do request = self.manage_tabs(_.None, _) but now manage_tabs doesn't know who filtered_manage_tabs is. So how do I call a dtml method so that it knows where it is and works correctly? -- Itamar S.T. itamars@ibm.net
At 12:32 PM 11/24/99 , Itamar Shtull-Trauring wrote:
I want to run manage_tabs from a PythonMethod. So I do
request = self.manage_tabs(_.None, _)
but now manage_tabs doesn't know who filtered_manage_tabs is. So how do I call a dtml method so that it knows where it is and works correctly?
Quick guess (untested): request = self.manage_tabs(self, _) The first parameter is the client object, a DTML Method's 'self'. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
On Wed, 24 Nov 1999, Martijn Pieters wrote:
At 12:32 PM 11/24/99 , Itamar Shtull-Trauring wrote: Quick guess (untested):
request = self.manage_tabs(self, _)
The first parameter is the client object, a DTML Method's 'self'.
Hmm, But the filter list isn't hanging off self so that won't work. Check out the source at lib/python/App/manage_tabs.dtml. The filter is some global meta-dictionary thing that is defined elsewhere. Cheers, Anthony Pfrunder
Martijn Pieters wrote:
request = self.manage_tabs(self, _)
I tried that too - it gives the following error: Error Type: AttributeError Error Value: validate Traceback (innermost last): File /home/zope/lib/python/ZPublisher/Publish.py, line 214, in publish_module File /home/zope/lib/python/ZPublisher/Publish.py, line 179, in publish File /home/zope/lib/python/Zope/__init__.py, line 202, in zpublisher_exception_hook (Object: CatalogAware) File /home/zope/lib/python/ZPublisher/Publish.py, line 165, in publish File /home/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: manage_ImagesForm) File /home/zope/lib/python/ZPublisher/Publish.py, line 102, in call_object (Object: manage_ImagesForm) File /home/zope/lib/python/Products/PythonMethod/PythonMethod.py, line 168, in __call__ (Object: manage_ImagesForm) (Info: ((<Article instance at 8578a80>,), {}, None)) File <string>, line 3, in manage_ImagesForm (Object: CatalogAware) File /home/zope/lib/python/App/special_dtml.py, line 120, in __call__ (Object: manage_tabs) (Info: /home/zope/lib/python/App/manage_tabs.dtml) File /home/zope/lib/python/DocumentTemplate/DT_String.py, line 490, in __call__ (Object: manage_tabs) AttributeError: (see above) -- Itamar S.T. itamars@ibm.net
On Wed, 24 Nov 1999, Itamar Shtull-Trauring wrote:
I want to run manage_tabs from a PythonMethod. So I do
request = self.manage_tabs(_.None, _)
but now manage_tabs doesn't know who filtered_manage_tabs is. So how do I call a dtml method so that it knows where it is and works correctly?
I could never get manage_tabs to work so I wrote my own ;) Check out VZClasses/Form/Editor/tab_management within VZ. Its based on manage_tabs but cleaned up. Next release i'll give it a makeover Cheers, Anthony Pfrunder
Itamar Shtull-Trauring wrote:
I want to run manage_tabs from a PythonMethod. So I do
request = self.manage_tabs(_.None, _)
but now manage_tabs doesn't know who filtered_manage_tabs is. So how do I call a dtml method so that it knows where it is and works correctly?
This needs a bit more context. Is this PythonMethod being called from another object, or is it the target of the request? I ask because the following works for me, if it is the target: <params>self, REQUEST</params> print self.standard_html_header(self, REQUEST) print self.manage_tabs(self, REQUEST) print '<h1>Test</h1>' print self.standard_html_footer(self, REQUEST) return printed When called from a DTML Method with <dtml-var expr="do_tabs(this(), _)">, the following also works: <params>client, _</params> return client.manage_tabs(client, _) Cheers, Evan @ 4-am
Evan Simpson wrote:
This needs a bit more context. Is this PythonMethod being called from another object, or is it the target of the request? I ask because the following works for me, if it is the target:
<params>self, REQUEST</params> print self.standard_html_header(self, REQUEST) print self.manage_tabs(self, REQUEST)
Thanks - that worked. -- Itamar S.T. itamars@ibm.net
participants (4)
-
Anthony Pfrunder -
Evan Simpson -
Itamar Shtull-Trauring -
Martijn Pieters