Of Containers, Objects and Properties
I have a folder containing multiple DTML Method objects. The folder has some properties. Each DTML method has its own set of properties that are different from those of the folder. Everything is being generated dynamically by Python scripts. When I query the folder for its propertyItems as in: print context.propertyItems called with the folder as the context, I get a list of all the properties in the folder *and* in all of its contained DTML Method objects. Not what I had in mind. Worse, when I call the same script using one of the documents in the folder as the context, I *still* get returned a list of all the properties in the folder and all of its contained DTML methods. Is there some inheritance or traversal going on here? Is this expected behavior? If not, does this behavior indicate I've assigned properties incorrectly or some such thing? Dan Shafer, Chief Scribe and Tablet Keeper PythonCard Open Source Project http://pythoncard.sourceforge.net
Dan Shafer writes:
I have a folder containing multiple DTML Method objects. The folder has some properties. Each DTML method has its own set of properties that are different from those of the folder. Everything is being generated dynamically by Python scripts.
When I query the folder for its propertyItems as in:
print context.propertyItems
called with the folder as the context, I get a list of all the properties in the folder *and* in all of its contained DTML Method objects. Almost surely not:
DTML Method's are *not* property managers. They do not have properties. I expect, that when you tried to add properties to them, the properties have been added to the containing folder instead (that's the magic of acquisition). Dieter
At 08:34 PM 7/17/2002 +0200, Dieter Maurer wrote:
Dan Shafer writes:
I have a folder containing multiple DTML Method objects. The folder has some properties. Each DTML method has its own set of properties that are different from those of the folder. Everything is being generated dynamically by Python scripts.
When I query the folder for its propertyItems as in:
print context.propertyItems
called with the folder as the context, I get a list of all the properties in the folder *and* in all of its contained DTML Method objects. Almost surely not:
DTML Method's are *not* property managers. They do not have properties.
Wow. I used DTML Methods because someone on this list told me they *could* have properties but DTML Documents could *not*.
I expect, that when you tried to add properties to them, the properties have been added to the containing folder instead (that's the magic of acquisition).
That appears to be what happened. Back to the drawing board. Fourth re-design.
Dieter
Dan Shafer, Chief Scribe and Tablet Keeper PythonCard Open Source Project http://pythoncard.sourceforge.net
Wow. I used DTML Methods because someone on this list told me they *could* have properties but DTML Documents could *not*.
It's exactly the other way round... DTML methods don't have their own context or properties but documents do. So hopefully your redesign isn't too complex?? Julian.
At 05:02 PM 7/18/2002 +1000, Julian Melville wrote:
Wow. I used DTML Methods because someone on this list told me they *could* have properties but DTML Documents could *not*.
It's exactly the other way round... DTML methods don't have their own context or properties but documents do. So hopefully your redesign isn't too complex??
Right. Turned out to be a search-and-replace "redesign" once I figured out that DTMLDocuments *do* support properties.
Julian.
Dan Shafer, Chief Scribe and Tablet Keeper PythonCard Open Source Project http://pythoncard.sourceforge.net
participants (3)
-
Dan Shafer -
Dieter Maurer -
Julian Melville