[Zope] Acquisition with External Methods
Chad McDaniel
chadm@sgi.com
07 Apr 1999 13:31:45 -0700
Michel Pelletier <michel@digicool.com> writes:
> > -----Original Message-----
> > From: Chad McDaniel [mailto:chadm@sgi.com]
> > Sent: Wednesday, April 07, 1999 2:23 PM
> > To: zope@zope.org
> > Subject: [Zope] Acquisition with External Methods
> >
> >
> > I'm having some trouble with calling External Methods from DTML
> > documents.
> > I have DTML document "Query" that defines a form with action
> > "View". "View" is also a DTML document containing a call to an
> > External Method:
> > <!--#var ExtMethod -->
> >
> > Ext Method would like to get access to the form values passed
> > to View,
> > but I can't figure out how to do it. There doesn't seem to be a way
> > for ExtMethod to acquire the values and I can't pass them as
> > arguments.
> >
>
> Try passing in the REQUEST mapping:
>
> in DTML:
>
> <!--#var "ExtMethod(REQUEST=REQUEST)"-->
>
> in Python:
>
> def ExtMethod(self, REQUEST):
> fv1 = REQUEST['form_var1']
> fv2 = REQUEST['form_var2']
>
> This what your looking for?
>
> -Michel
>
When I try that I get an error:
---
Traceback (innermost last):
File /usr/people/chadm/work/Zope-1.10.2-src/lib/python/ZPublisher/Publish.py, line 877, in publish_module
File /usr/people/chadm/work/Zope-1.10.2-src/lib/python/ZPublisher/Publish.py, line 590, in publish
(Info: /custServBug/bwView)
File /usr/people/chadm/work/Zope-1.10.2-src/lib/python/OFS/DTMLDocument.py, line 212, in __call__
(Object: bwView)
File /usr/people/chadm/work/Zope-1.10.2-src/lib/python/OFS/DTMLDocument.py, line 208, in __call__
(Object: bwView)
File /usr/people/chadm/work/Zope-1.10.2-src/lib/python/DocumentTemplate/DT_String.py, line 513, in __call__
(Object: bwView)
File /usr/people/chadm/work/Zope-1.10.2-src/lib/python/DocumentTemplate/DT_Util.py, line 266, in eval
(Object: ExtMethod(REQUEST=REQUEST))
File <string>, line 0, in ?
File /usr/people/chadm/work/Zope-1.10.2-src/lib/python/Products/ExternalMethod/ExternalMethod.py, line 254, in __call__
(Object: CopySource)
(Info: ((), {'REQUEST': form:
bugID: '491304'
environ:
SCRIPT_NAME: '/Zope'
UNIQUE_ID: 'Nwu-xYI@M7MABFMXVAg'
HTTP_ACCEPT_ENCODING: 'gzip'
REMOTE_HOST: 'unhinged.engr.sgi.com'
REMOTE_ADDR: '130.62.51.179'
HTTP_ACCEPT_LANGUAGE: 'ja'
PCGI_PUBLISHER: '/usr/people/chadm/work/Zope-1.10.2-src/pcgi/pcgi_publisher.py'
GATEWAY_INTERFACE: 'CGI/1.1'
PCGI_DISPLAY_ERRORS: '1'
HTTP_ACCEPT: 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*'
REQUEST_URI: '/Zope/custServBug/bwView?bugID=491304'
SCRIPT_URL: '/Zope/custServBug/bwView'
HTTP_HOST: 'unhinged.engr'
PCGI_PID_FILE: '/usr/people/chadm/work/Zope-1.10.2-src/var/pcgi.pid'
SCRIPT_URI: 'http://unhinged.engr.sgi.com/Zope/custServBug/bwView'
SERVER_ADMIN: 'chadm@sgi.com'
SCRIPT_FILENAME: '/usr/freeware/apache/share/cgi-bin/Zope.cgi'
PCGI_MODULE_PATH: '/usr/people/chadm/work/Zope-1.10.2-src/lib/python/Main.py'
BOBO_REALM: 'Zope'
BOBO_DEBUG_MODE: '1'
HTTP_PRAGMA: 'no-cache'
PCGI_ERROR_LOG: '/usr/people/chadm/work/Zope-1.10.2-src/var/pcgi.log'
PCGI_NAME: 'Main'
DOCUMENT_ROOT: '/usr/freeware/apache/share/htdocs'
PCGI_EXE: '/usr/local/bin/python'
SERVER_PORT: '80'
PATH_TRANSLATED: '/usr/freeware/apache/share/htdocs/custServBug/bwView'
INSTANCE_HOME: '/usr/people/chadm/work/Zope-1.10.2-src'
SYBASE: '/usr/local/sybase'
REMOTE_PORT: '12680'
SERVER_NAME: 'unhinged.engr.sgi.com'
HTTP_CONNECTION: 'Keep-Alive'
HTTP_USER_AGENT: 'Mozilla/4.51C-SGI [en] (X11; I; IRIX 6.5 IP32; Nav)'
HTTP_ACCEPT_CHARSET: 'iso-8859-1,*,utf-8'
PATH: '/usr/sbin:/usr/bsd:/sbin:/usr/bin:/etc:/usr/etc:/usr/bin/X11'
QUERY_STRING: 'bugID=491304'
SERVER_PROTOCOL: 'HTTP/1.0'
PATH_INFO: '/custServBug/bwView'
REQUEST_METHOD: 'GET'
SERVER_SIGNATURE: '<ADDRESS>Apache/1.3.3 Server at unhinged.engr.sgi.com Port 80</ADDRESS>\012'
PCGI_SOCKET_FILE: '/usr/people/chadm/work/Zope-1.10.2-src/var/pcgi.soc'
SERVER_SOFTWARE: 'Apache/1.3.3 (Unix)'
HTTP_COOKIE: 'tree-s="eJyLjjaMjQUABOIBog"'
PCGI_INFO_FILE: '/usr/freeware/apache/share/cgi-bin/Zope.cgi'
TZ: 'PST8PDT'
HTTP_REFERER: 'http://unhinged.engr/Zope/custServBug/bwQuery'
}, None))
TypeError: (see above)
---
even when ExtMethod is very simple:
---
def ExtMethod(self, REQUEST):
return "testing"
---
--
-chad