Hi Alexander,
"Alexander" == Alexander Limi <alexander@limi.net> writes:
Alexander> Now for the questions: Alexander> 1. I have a folder called "artists" where the Alexander> Artist-objects should be instantiated as unique Alexander> objects. I've managed to do this by copying the Alexander> Artist_addForm method to the "artists" folder, but I Alexander> suspect this is not how it should be done. My guess is Alexander> that the factory is involved in some way, but how Alexander> anonymous users should be able to access it from the Alexander> context of the empty "artists" folder is a bit unclear Alexander> at the moment. First did you modify the wizardly created Artist_add method with the option of not redirecting to the management interface after being invoked? (see http://www.zope.org/Members/tazzzzz/addZClasses) It goes in Artist_add like this: (assuming you have named your propertysheet 'Basic') <!--#with "myProduct.createInObjectManager(REQUEST['id'], REQUEST)"--> <!--#call "propertysheets.Basic.manage_editProperties(REQUEST)"--> <!--#/with--> <!--#if noRedirect--> <!--#else--> <!--#if DestinationURL--> <!--#call "RESPONSE.redirect( DestinationURL+'/manage_workspace')"--> <!--#else--> <!--#call "RESPONSE.redirect( URL2+'/manage_workspace')"--> <!--#/if DestinationURL--> <!--#/if noRedirect--> Then from the parent folder of artists you could have a method called something like 'addArtist' that works like this (untested): <dtml-var standard_html_header> <H2><dtml-var document_title></H2> <center> Adding new artist... <br> <dtml-with artists> <dtml-with "manage_addProduct['myProduct']"> <dtml-call "REQUEST.set('id',codeToGenerateAnIDGoesHere)"> <dtml-call "Artist_add(_.None, _, noRedirect=1)"> </dtml-with manage_addProduct--> </dtml-with> <br> Your new artist has been added.<br> <br> <form action=&dtml-URL1;> <input type=submit value="OK"> </form> </center> <dtml-var standard_html_footer> Then you can make your own form to create a new artist that invokes addArtist with all the right stuff set. Alexander> 2. I would really like to have two different Alexander> "properties"-views on the instantiated class, one for Alexander> the user, who does not need to be able to modify all of Alexander> his attributes, and one for us administrators, which Alexander> can be the standard properties view. How? You can make your own 'edit_instance_form' and 'edit_instance' methods that can be methods of your ZClass. Here is what I usually use as a starting point for edit_instance: <!--#var standard_html_header--> <center> <dtml-call "propertysheets.Basic.manage_editProperties(REQUEST=REQUEST)"> <dtml-call "RESPONSE.redirect(URL1)"> </center> <!--#var standard_html_footer--> Just make your custom 'edit_instance_form' display just what you want to your user and invoke 'edit_instance' when it's done. If this is done in the context of the instance it should display the instances index_html when it's finished. Alexander> 3. As you can see from the above questions, my Alexander> knowledge is a bit incomplete. I've read through Zope Alexander> Content Managers Guide, DTML Reference, and tried to Alexander> find anything of value on zdp.zope.org. If anyone could Alexander> point me to where I can find more relevant info and Alexander> tutorials, I would be grateful. Banging one's head Alexander> against the wall at 0500 in the morning after 6 hours Alexander> struggle with basic concepts is not my idea of Alexander> fun. Python and Java are easier to learn than this :) I've found the all the HowTo's etc on www.zope.org helpful. Alexander> Regards, Alexander> Alexander Limi.