[Zope] Zclass's subobject
   
    Nuno Teixeira
     
    nteixeira@bmc.pt
       
    Fri, 12 Apr 2002 18:52:36 +0100
    
    
  
Hi all!
I've made a ZClass (via web) inside another like following (using ZClass:ObjectManager class)
Programa (Product)
->
  EventManager_add (DTML)
  EventManager_addForm (DTML)
  EventManager_add_permission (Permission)
  Event_add_permission (Permission)
  EventManager_factory (Factory)
  EventManager (ZClass) *
  -> 
    Event_add (DTML)
    Event_addForm (DTML)
    Event_factory (Factory)
    Event (ZClass) *
    ->
      edit (DTML)
      edit_form (DTML)
ZMI interface is working fine but now i want to make an admin DTML outside of ZMI
When a new EventManager is created i want to make Event (sub object of EventManager ) automatically, but i'm stuck when i try to create it.
EventManager object will represent Year and Month
Event object will represent Days of EventManager
Here is a excert of dtml that is called when is submited an "add" EventManager form:
---
<dtml-with expr="manage_addProduct['Programa']">
  <dtml-call name="EventManager_add">
</dtml-with>
 
<dtml-call expr="REQUEST.set('Day', '2')">
<dtml-call name="/Testing/Programa/123401/Event_add">
---
The last two lines are just for testing where:
  'Day' - Event object id
  /Testing/Programa/ - Folder where is dtml
  123401 - id of EventManager (already created)
The EventManager object is created but i don't see a way to add Event objects inside it :(
EventManager_add (on ZClass):
---
(...)
<dtml-call "REQUEST.set('id', Year + _.string.zfill(Month,2))">
<dtml-with "EventManager.createInObjectManager(REQUEST['id'], REQUEST)">
  <dtml-call "propertysheets.Basic.manage_editProperties(REQUEST)">
(...)
---
Event_add (on ZClass):
---
(...)
<dtml-with "Event.createInObjectManager(REQUEST['Day'], REQUEST)">
  <dtml-call "propertysheets.basic.manage_editProperties(REQUEST)">
(...)
---
if i put url: 
http://localhost:9999/Testing/Programa/123401/Event_add?Day=1
This way the EventObject is created. Why that doesn't work on dtml?
If one of you have a better approach to solve that application, tell me.
Thanks,
Nuno Teixeira