[Zope] Managing subobjects
Dieter Maurer
dieter@handshake.de
Wed, 16 Aug 2000 23:01:35 +0200 (CEST)
Menard.Jean-Francois@hydro.qc.ca writes:
> I created a ZClass, zRow. This class can contain other ZClass: zField_Text,
> zField_Date, etc.
> This let me define the columns contained in a zRow.
> I then defined a Class zTable, wich contains zRows.
>
> Question:
>
> - In my manage tabs, I needed a have a tab "Define columns". Do
> achieve this, I inserted a ZRow Instace (with id Definition) in my zTable
> product definition, and a method called Define_Columns, containing:
>
> <dtml-with Definition>
> <dtml-var manage_main>
> </dtml-with>
>
> And I defined a view "Define Columns" pointing to that method. When
> i click on the "Define Columns", I can see the manage screen of the instance
> "Definition", that's what I wantwd.
>
> But when Add a zField, the instance is create in the zTable level,
> not IN Definition instance! All the classes are Based on CatalogAware,
> ObjectManager.
There are 2 hierarchies, the object hierarchy in Zope
and the URL hierarchy used by the browser.
Usually, these two hierarchies are magically in sync.
However, it is easy to change this.
In your case:
the "with Definition" changes (in some way) the current location in
Zope's object hiararchy. However, the current location
in the URL hierarchy is not changed.
When you press "add", an HTTP request is generated, almost
surely with a relative URL, i.e. relative to the current
location in the URL hierarchy.
Obviously, your add method is called in the wrong context
(or maybe, the add method of the wrong object is called).
You may succeed, when you change the location in the
URL hierarchy, too.
You do this with a "RESPONSE.setBase(newBase)".
Dieter