[Zope] optimize old code
Yuri
yurj at alfa.it
Wed Jan 17 03:24:34 EST 2007
Hi!
I've an old product, based on zclass and zope 2.6, I would like to
optimize (as possibile) the insert and cataloging of a zclass.
Now I use this scripts:
form that creates the request ->
--
<dtml-let ut="_.SecurityGetUser().getUserName()">
<dtml-with "manage_addProduct['Dafne']">
<dtml-with "dafne_item_add(_.None,_,NoRedir=1)">
</dtml-with>
</dtml-with>
</dtml-let>
--
<dtml-with "dafne_item.createInObjectManager(REQUEST['identificativo'],
REQUEST)"> <- just set an id for the class
<dtml-call
"propertysheets.metadati.manage_editProperties(
REQUEST)"> <- edit properties
<dtml-call "manage_permission('Cambia il contenuto dei
dafne',('Manager','Owner',),acquire=0)"> <- set permission and roles
<dtml-call "manage_addLocalGroupRoles(ut,['guardone'],REQUEST)">
<dtml-if expr="pubblici == '1'"> <- anonymous can view?
<dtml-call "manage_permission('View',('Anonymous',),acquire=0)">
<dtml-else>
<dtml-call
"manage_permission('View',('Manager','Owner','guardone',),acquire=0)">
</dtml-if>
<dtml-call "manage_permission('Change Images and
Files',('Manager','Owner'),acquire=0)">
<dtml-call "manage_permission('Add Documents, Images, and
Files',('Manager','Owner',),acquire=0)">
<dtml-call "manage_permission('Add
ExtFiles',('Manager','Owner',),acquire=0)">
<dtml-call "manage_permission('Change
ExtFile/ExtImage',('Manager','Owner'),acquire=0)">
* Can optimize here? *
<dtml-call unindex_object> <- my catalog is not called Catalog but
catalog, so I've read I've to do this three steps
<dtml-call "manage_editCataloger('catalog', REQUEST)">
<dtml-var index_object>
* *
</dtml-with>
* do redirecting*
<dtml-comment> Now we need to return something. We do this via
a redirect so that the URL is correct.
Unfortunately, the way we do this depends on
whether we live in a product or in a class.
If we live in a product, we need to use DestinationURL
to decide where to go. If we live in a class,
DestinationURL won't be available, so we use URL2.
</dtml-comment>
<dtml-if NoRedir>
<dtml-else>
<dtml-if DestinationURL>
<dtml-call "RESPONSE.redirect(
DestinationURL+'/manage_workspace')">
<dtml-else>
<dtml-call "RESPONSE.redirect(
URL2+'/manage_workspace')">
</dtml-if>
</dtml-if>
---
Any idea? TIA!
More information about the Zope
mailing list