[Zope] Create or edit instance objects

Tino Wildenhain tino@wildenhain.de
Sun, 12 Aug 2001 00:56:52 +0200


Hi Pablo,

sorry, I misread you originally post.
I see the solution in using not the same but a similar
method to create and to manage.
Just put the MMM method either in the root folder or
even better subclass Folder and put this method in it.
This simply should get all parameters and call manage_addProduct
with the class you want.

The other method, also called MMM in the zclass you added can
edit on the current object.

Would this solve your problem?

Regards
Tino

--On Samstag, 11. August 2001 21:55 +0000 Pablo Ziliani <pablo@decode.com.ar> wrote:

> 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=B4m 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=B4t call it from a folder (to create a new instance) since it was only
> acquirable from MyProduct=B4s class instances.
>
> Now, in your proposed schema, how would you call the "xxx_class_add" method
> _VIA_WEB_ for it to get "iii" instance=B4s 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=B4t 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 )
>>
>>
>>
>>
>>