[Zope-dev] Re: Acquisition Questions
Kent Polk
kent@goathill.org
20 Apr 1999 19:16:41 GMT
On 19 Apr 1999 21:48:36 GMT, Kent Polk wrote:
[...]
>What I have done is to build a hierarchy of object instances which
>correspond to the subdirectories and files contained within that
>file-system. Not by happenstance, each instance highly resembles a
>TinyTable and is query-able in the same fashion as TinyTables.
[...]
>Question #2:
>------------
>
>How do I point a DTML method at the correct object ?
Hmmm... re-re-reading ExtensionClass.stx, I ran across this statement:
"Currently, when accessing a class instance attribute, the attribute
value is bound together with the instance in a method object *if
and only if* the attribute value is a python function. For some
applications, we might also want to be able to bind extension
functions, or other types of callable objects, such as HTML document
templates [2]."
I think this describes my problem where my instance mapping
a.b.c.d.e() can call Python methods and attributes, but DTML
can't locate the methods or attributes.
I suspect that I am not instantiating my objects correctly, but
don't see what I'm supposed to be doing.
Currently, as a parent object determines its children, I have it
instantiate them and then call their 'load' method which (recursively)
has them locate their children, instantiate and load them, etc.
def _setObject(self,id,object):
setattr(self,id,object)
try: t=object.meta_type
except: t=None
self._objects=self._objects+({'id':id,'meta_type':t},)
self._setObject(name, SubDir(name))
obj = getattr(self, name)
obj.load()
my classes are:
class Connection(ExtensionClass.Base):
class SubDir(Acquisition.Implicit) :
class Database(Acquisition.Implicit) :
class PedSysFile(Acquisition.Implicit) :
and all but the last can contain children.
Does anyone have an example of how objects are supposed to be
recursively instantiated using ExtensionClass? I've seen a few
potential examples, but each is instantiated differently and doesn't
provide an explanation for why they are instantiated differently.
Thanks Much!
Kent