[Zope] manage_editCataloger-Question

Martijn Pieters mj@antraciet.nl
Sat, 09 Oct 1999 10:33:47 +0200


At 06:27 9-10-99 , Tom wrote:
>I applied the proposed patch
>
>def manage_editCataloger(self, default, REQUEST=None):
>         """ """
>         self.default_catalog=default
>         message = "Your changes have been saved"
>         return self.manage_main(self, REQUEST,
>manage_tabs_message=message)
>
>to use it in
>
><dtml-let obj="Firma.createInObjectManager(REQUEST['id'], REQUEST)">
><dtml-call "obj.propertysheets.daten.manage_editProperties(REQUEST)">
><dtml-call "obj.propertysheets.daten.manage_editCataloger('Catalog1',
>REQUEST)">
><dtml-call "obj.reindex_object">
></dtml-let>

This should read:
<dtml-with "Firma.createInObjectManager(REQUEST['id'], REQUEST)">
   <dtml-call "propertysheets.daten.manage_editProperties(REQUEST)">
   <dtml-call "manage_editCataloger('Catalog1', REQUEST)">
   <dtml-call reindex_object>
</dtml-with>

You didn't call reindex_object, you only asked for it's object reference. 
Above code will work, altough it is from the top of my head.

>which will not work, because of the return self.manage_main() call.
>After updating the entry it shows up in Catalog1 as expected,
>but I would like to have it there directly after inserting the entry.
>Just to see if I understand the code correctly, I changed
>manage_editCataloger to

The call tag ignores whatever is returned. It doesn't work because 
"obj.reindex_object" is not the same as "obj.reindex_obj()"


>def manage_editCataloger(self, default, REQUEST=None):
>         """ """
>         self.default_catalog=default
>         self.index_object()
>         message = "Your changes have been saved"
>         return self.manage_main(self, REQUEST,
>manage_tabs_message=message)
>
>and after that used
>
><dtml-let obj="Firma.createInObjectManager(REQUEST['id'], REQUEST)">
><dtml-call "obj.propertysheets.daten.manage_editProperties(REQUEST)">
><dtml-call "obj.propertysheets.daten.manage_editCataloger('Catalog1',
>REQUEST)">
></dtml-let>
>
>which works as expected. :-)

Only because you now actually call reindex_object. Note that 
manage_edit_cataloger is a method of the ZClass, not of the property sheet. 
It happens to work because of acquisition.


>So, what about
>
>def manage_editCataloger(self, default, REQUEST=None, reindex=1):
>         """ """
>         self.default_catalog=default
>         if reindex: self.index_object()
>         message = "Your changes have been saved"
>         return self.manage_main(self, REQUEST,
>manage_tabs_message=message)
>
>or is there a better solution?


See above.

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| T: +31 35 7502100 F: +31 35 7502111
| mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
---------------------------------------------