[Zope] optimize old code

2007-01-17 Thread Yuri

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!
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] optimize old code

2007-01-17 Thread Andreas Jung



--On 17. Januar 2007 09:24:34 +0100 Yuri [EMAIL PROTECTED] wrote:


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.



Put your stuff inside a PythonScript. All API methods can be called
in the same way as through DTML/ZPT/PythonScript. APIs don't change
just because the object and its methods from different environments.

-aj

pgpXe78bnxW25.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] optimize old code

2007-01-17 Thread Yuri

Andreas Jung wrote:



--On 17. Januar 2007 09:24:34 +0100 Yuri [EMAIL PROTECTED] wrote:


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.



Put your stuff inside a PythonScript. All API methods can be called
in the same way as through DTML/ZPT/PythonScript. APIs don't change
just because the object and its methods from different environments.


Thanks, Andreas!

At the time I changed this scripts, It was dificult for me to put in 
pythonscript :P Maybe now I can do it :)


I think the bottleneck is the unindexing / reindexing that the product 
perform, just because it needs a different catalog.


I will investigate all the options, thanks.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )