[Zope] Dynamic object lookup

Helmut Toplitzer helmut@ifit.uni-klu.ac.at
Fri, 18 Aug 2000 11:29:55 +0200


This is a multi-part message in MIME format.
--------------C6FDA5AD7E1367DDCAA3393A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Chris Withers wrote:
> 
> Helmut Toplitzer wrote:
> >
> > Hi!
> >
> > I'm trying to get objects (even acquired) by
> > pasing a string to a python method.
> > Has someone an idea how to make that work?
> 
> getattr(self,'string') ?
> 
> cheers,
> 
> Chris

NewsFolderClass is a CatalogAware Class created by me.

Structured in the following way:
/HM.News
/News      current folder tries to access HM.News

return getattr(self,'HM')  # from /News
Returns:

Error
Encountered an error while publishing this resource. 
Error Type: AttributeError
Error Value: validate
Troubleshooting Suggestions
   The URL may be incorrect. 
   The parameters passed to this resource may be incorrect. 
   A resource that this resource relies on may be encountering an error. 
   For more detailed information about the error, please refer to the HTML
source for this page. 
   If the error persists please contact the site maintainer. Thank you for
your patience. 

Traceback (innermost last):
  File
/home/misc/s_zope/Zope-2.2.0-solaris-2.6-sparc/lib/python/ZPublisher/Publish.py,
line 222, in publish_module
  File
/home/misc/s_zope/Zope-2.2.0-solaris-2.6-sparc/lib/python/ZPublisher/Publish.py,
line 187, in publish
  File
/home/misc/s_zope/Zope-2.2.0-solaris-2.6-sparc/lib/python/Zope/__init__.py,
line 221, in zpublisher_exception_hook
    (Object: CatalogAware)
  File
/home/misc/s_zope/Zope-2.2.0-solaris-2.6-sparc/lib/python/ZPublisher/Publish.py,
line 171, in publish
  File
/home/misc/s_zope/Zope-2.2.0-solaris-2.6-sparc/lib/python/ZPublisher/mapply.py,
line 160, in mapply
    (Object: helpme)
  File
/home/misc/s_zope/Zope-2.2.0-solaris-2.6-sparc/lib/python/ZPublisher/Publish.py,
line 112, in call_object
    (Object: helpme)
  File
/home/misc/s_zope/Zope-2.2.0-solaris-2.6-sparc/lib/python/Products/PythonMethod/PythonMethod.py,
line 168, in __call__
    (Object: helpme)
    (Info: ((<NewsFolderClass instance at e442f8>,), {}, None))
  File <string>, line 2, in helpme
    (Object: CatalogAware)
  File
/home/misc/s_zope/Zope-2.2.0-solaris-2.6-sparc/lib/python/DocumentTemplate/DT_Util.py,
line 135, in careful_getattr
AttributeError: (see above)

Sorry!
Maybe I've misunderstod sth?

Helmut


-- 
My GNUpg Fingerprint
1355 4103 AC62 6818 DBC9  48B1 8D7D 6250 2D92 B100
--------------C6FDA5AD7E1367DDCAA3393A
Content-Type: text/x-vcard; charset=us-ascii;
 name="helmut.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Helmut Toplitzer
Content-Disposition: attachment;
 filename="helmut.vcf"

begin:vcard 
n:Toplitzer;Helmut
tel;fax:++43 463/2700 505
tel;work:++43 463/2700 6247
x-mozilla-html:FALSE
org:Universität Klagenfurt;Institut für Wirtschaftsinformatik und Anwendungssysteme (IWAS)
adr:;;Universitaetsstrasse 65-67;Klagenfurt;Kaernten;9020;Austria
version:2.1
email;internet:helmut@ifit.uni-klu.ac.at
note:Praktische Informatik
x-mozilla-cpt:;-10816
fn:Helmut Toplitzer
end:vcard

--------------C6FDA5AD7E1367DDCAA3393A--