[Zope] Create or edit instance objects
Tino Wildenhain
tino@wildenhain.de
Sat, 11 Aug 2001 19:11:15 +0200
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 )