[Zope] Create or edit instance objects

Pablo Ziliani pablo@decode.com.ar
11 Aug 2001 21:55:30 -0000


Hi Tino,

so far, to edit an "iii" instance I only had to call my "MMM" method this 
way from the web:
"http://root/folder1/folder2/iii/MMM"
so method MMM used iii object values.

When the parent was a folder
"http://root/folder1/folder2/MMM"
the method itself set some defaults (even its id) to the request, so the 
instance could be created.

This worked fine placing the method in an "acquirable" folder, but as I 
said before, I´m trying "MMM" to become a class method.

The edit function worked fine by placing "MMM" in 
the "MyProduct/propertysheets/methods" folder but (of course), this way I 
couldn´t call it from a folder (to create a new instance) since it was only 
acquirable from MyProduct´s class instances.

Now, in your proposed schema, how would you call the "xxx_class_add" method 
_VIA_WEB_ for it to get "iii" instance´s values (to edit them)?

Thanks again,
Pablo.


On Sat, 11 Aug 2001 19:11:15 +0200, Tino Wildenhain <tino@wildenhain.de> 
wrote :

> Hi Pablo,
> 
> --On Samstag, 11. August 2001 14:52 +0000 Pablo Ziliani 
<pablo@decode.com.ar> wrote:
> 
> > Dear Zopeists:
> >
> > I guess my problem should be a classical one, but I still haven´t found 
a
> > solution in any How-to or message in this list, so I have no choice to 
ask
> > for your help.
> >
> > - HELP!!!!
> >   How can I make the same method that creates an instance object
> >   to edit it?
> 
> Thats not so hard. If you make a new zclass and let zope create
> the constructor methods, you have XXX_addForm and XXX_add
> in your product folder. Edit XXX_addForm to provide form
> elements for your values.
> Edit XXX_add to check the values in the request first
> and inside the:
> 
> <dtml-with "MyFolder.createInObjectManager(REQUEST['id'], REQUEST)">
> 
>   <dtml-comment>
> 
>      You can add code that modifies the new instance here.
> 
>      For example, if you have a property sheet that you want to update
>      from form values, you can call it here:
> 
>        <dtml-call "propertysheets.Basic.manage_editProperties(
>                   REQUEST)">
> 
>   </dtml-comment>
> 
> </dtml-with>
> 
> remove the comments and change the <dtml-call> to the propertysheets
> you want to change. The name is Basic if you created a propertysheet
> with the name "Basic".
> 
> HTH
> Tino Wildenhain
> 
> > Note: - my class uses Propertysheets
> >       - my class uses random ids.
> >       - I would like to avoid to create the instance object
> >         before all the data is set in the REQUEST (and the
> >         button "create" has been clicked) so no garbage is
> >         to be later cleaned.
> >
> > Lots of thanks in advance,
> > PABLO.
> >
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
> 
> 
> 
> 
>