[Zope-dev] getattr for non-Folderish item

Johnson, Michael (MIJOHNSO) MIJOHNSO@arinc.com
Mon, 25 Jun 2001 11:45:22 -0400


When using getattr to obtain a dtml file, etc from a newly formed product, I
am able 
to get the appropriate Zope object and use it.  However, I am trying to
abstract my 
class, and when I do, the getattr() function does not work properly.

Here's some info:
1) it is not a folderish item
2) the abstract class does not have the need to be managed (ex. Add)
3). Originally I just inherited (for Class 2) from Acquisition.Implicit,
figured I could 
access a persistant member in ZODB, but not even sure if I know what
persistance is 
anymore even after reading some wonderful Tutorials

If this all sounds like jibberish, it is.. I'll explain by example

Class1
I can use getattr(self, item_id) and it returns item, I guess because the
product is 
actually managed by Zope.. Could someone shed more light on this?

I would like to say db_item = Class2(class2 constructors)
db_item.process_something(item_id, args)

Class2
def process_something(item_id, args)
item_to_process=getattr(?, item_id) ? tried self, does not find
item_to_process().whatever_the_function(args)

Please excuse my dismal attempts.