[Zope] Acqusition and External Methods...
Tony McDonald
tony.mcdonald@ncl.ac.uk
Fri, 6 Aug 1999 17:22:31 +0100
Ok,
I 'simplified'? my code of a few hours ago and got this
External Method: testDocTemplate.py
import DocumentTemplate
from Acquisition import Implicit
def doit(self):
template_str = '''<table>
<tr><td bgcolor=silver colspan=2>This data is being dynamically
generated from a database</td></tr>
<dtml-in "info_from_email(email=content)">
<tr><td><dtml-var Title> <dtml-var Surname></td></tr>
</dtml-in>
</table>'''
template = DocumentTemplate.HTML(template_str)
return template(content='hirst')
(1) info_from_email is a ZSQL method *in the same folder* as the
external method itself.
(2) Ideally I want to get a DTML document in the folder heirarchy, ie
template_str = str(self.Actors.RENDER.modulecontributor)
On clicking 'Try It' I get:
<!--
Error type: NameError
Error value: info_from_email
-->
......
<!--
Traceback (innermost last):
File
/home/nnle/Zope-2.0.0b1-solaris-2.6-sparc/lib/python/ZPublisher/Publis
h.py, line 256, in publish_module
File
/home/nnle/Zope-2.0.0b1-solaris-2.6-sparc/lib/python/ZPublisher/Publis
h.py, line 161, in publish
File
/home/nnle/Zope-2.0.0b1-solaris-2.6-sparc/lib/python/ZPublisher/mapply
.py, line 154, in mapply
(Object: doit)
File
/home/nnle/Zope-2.0.0b1-solaris-2.6-sparc/lib/python/ZPublisher/Publis
h.py, line 98, in call_object
(Object: doit)
File
/home/nnle/Zope-2.0.0b1-solaris-2.6-sparc/lib/python/Products/External
Method/ExternalMethod.py, line 259, in __call__
(Object: doit)
(Info: ((<Folder instance at 59f4c8>,), {}, None))
File
/home/nnle/Zope-2.0.0b1-solaris-2.6-sparc/lib/python/Products/External
Method/ExternalMethod.py, line 247, in __call__
(Object: doit)
(Info: ((<Folder instance at 59f4c8>,), {}, None))
File
/home/nnle/Zope-2.0.0b1-solaris-2.6-sparc/Extensions/testDocTemplate.p
y, line 16, in doit
(Object: ElementWithAttributes)
File
/home/nnle/Zope-2.0.0b1-solaris-2.6-sparc/lib/python/DocumentTemplate/
DT_String.py, line 502, in __call__
(Object: <string>)
File
/home/nnle/Zope-2.0.0b1-solaris-2.6-sparc/lib/python/DocumentTemplate/
DT_In.py, line 631, in renderwob
(Object: info_from_email(email=content))
File
/home/nnle/Zope-2.0.0b1-solaris-2.6-sparc/lib/python/DocumentTemplate/
DT_Util.py, line 315, in eval
(Object: info_from_email(email=content))
File <string>, line 0, in ?
NameError: (see above)
-->
...and I'm totally baffled.
I'm now I'm off to the pub to befuddle my head even more.....
tone
------
Dr Tony McDonald, FMCC, Networked Learning Environments Project
http://nle.ncl.ac.uk/
The Medical School, Newcastle University Tel: +44 191 222 5888
Fingerprint: 3450 876D FA41 B926 D3DD F8C3 F2D0 C3B9 8B38 18A2