[Zope] Q: Accessing a ZSQL Method from an External Method
a.wacknitz@francotyp.com
a.wacknitz@francotyp.com
Mon, 29 May 2000 17:09:25 +0200
Hi all,
I want to use ZSQL Methods from within External Methods and have already
read the appropriate HowTo but it is somehow vague in some respects and
I have some problems with my adaption.
I have ZSQL methods in a subfolder /SQL, eg. /SQL/sqlZuordnung
My External Method named "extShow" should use the ZSQL method sqlZuordnung:
def Show(self, zuordnungsbereich, zuordnung):
"""Show retrieves some database items."""
res=self.SQL.sqlZuordnung(zuordnungsbereich=zuordnungsbereich,
zuordnung=zuordnung)
fields2index={}
fieldnames=res._schema.items()
for i in range(len(fieldnames)):
fields2index[fieldnames[i][0]]=fieldnames[i][1]
id_val=res[0][fields2index['ID']]
return id_val
First, I want to know how to call this function, especially how to submit
the
correct namespace.
Calling it with <dtml-var "extShow(_, zuordnungsbereich, zuordnung)">
results in
an AttributeError (SQL). Here's a TraceBack:
<!--
Traceback (innermost last):
File C:\PROGRA~1\graffias\lib\python\ZPublisher\Publish.py, line 214, in
publish_module
File C:\PROGRA~1\graffias\lib\python\ZPublisher\Publish.py, line 179, in
publish
File C:\PROGRA~1\graffias\lib\python\Zope\__init__.py, line 202, in
zpublisher_exception_hook
(Object: ElementWithAttributes)
File C:\PROGRA~1\graffias\lib\python\ZPublisher\Publish.py, line 165, in
publish
File C:\PROGRA~1\graffias\lib\python\ZPublisher\mapply.py, line 160, in
mapply
(Object: index_html)
File C:\PROGRA~1\graffias\lib\python\ZPublisher\Publish.py, line 102, in
call_object
(Object: index_html)
File C:\PROGRA~1\graffias\lib\python\OFS\DTMLMethod.py, line 150, in
__call__
(Object: index_html)
File C:\PROGRA~1\graffias\lib\python\DocumentTemplate\DT_String.py, line
502, in __call__
(Object: index_html)
File C:\PROGRA~1\graffias\lib\python\DocumentTemplate\DT_Let.py, line 145,
in render
(Object: umgebung="this()")
File C:\PROGRA~1\graffias\lib\python\DocumentTemplate\DT_Util.py, line
335, in eval
(Object: Methoden.extShow(_,'Bereich',Test))
(Info: Test)
File <string>, line 0, in ?
File
C:\PROGRA~1\graffias\lib\python\Products\ExternalMethod\ExternalMethod.py,
line 248, in __call__
(Object: extShow)
(Info: ((<TemplateDict object at 1b97e20>, 'Bereich', Test), {},
None))
File C:\PROGRA~1\graffias\Extensions\functions.py, line 132, in Show
AttributeError: (see above)
-->
So, what am I doing wrong here?
TIA,
Andreas
**********************************************************************
This email message has been swept by MIMEsweeper for the presence of
computer viruses.
Francotyp-Postalia AG & Co.