[Zope] Re: index_object() and bobobase_modification_time with
different ZCatalogs
Tres Seaver
tseaver at palladion.com
Thu Dec 1 12:30:08 EST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Paul Winkler wrote:
> On Thu, Dec 01, 2005 at 04:44:41PM +0000, jens.walte at kk.net wrote:
>
>>Hello,
>>
>>does anybody knows a different possibility to beware the bobobase_modification_time of the given object from the following code?
>>
>>
>>def my_index_object(object, catalogs=['myPointerCatalog', 'mySearchCatalog']):
>>
>> for cat in catalogs:
>> object.default_catalog = cat
>> object.index_object()
>>
>> # set back to default
>> object.default_catalog = 'Catalog'
>>
>
>
> I don't know what "beware" means in this context.
> If you are asking whether it is possible to avoid changing
> bobobase_modification_time, the answer is no.
> ZODB updates bobobase_modification_time on any change to a persistent
> object, and there is nothing you can do to avoid this.
Hmmm, I wonder if one could hack it by avoiding '__setattr__', e.g.:
for cat in catalogs:
object.__dict__['default_catalog'] = cat
object.index_object()
cat._p_deactivate() # throw away changes
But why don't we avoid the whole thing and just call the catalog directly:
for cat in catalogs:
cat.catalog_object(object, object.url()
Tres.
- --
===================================================================
Tres Seaver +1 202-558-7113 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDjzMg+gerLs4ltQ4RApzkAJ9mbsd2+gwxBH5fYl8MehHurqbzWACgss26
H1Lj6yqpVrUME1Ey06/BZCI=
=8QsT
-----END PGP SIGNATURE-----
More information about the Zope
mailing list