RE: [Zope-dev] Problems with CatalogAware?

2001-09-10 Thread sean . upton

Right now I only call index_object() after an edit, as I was assuming that
after adding things would be automatically taken care fo for me, but
obviously this is not the case.  There are, indeed, default values in some
properties within the class __init__ method.

I think what is happening is that I am indexing methods (not properties),
and since my factory method doesn't call an explicit reindex_object() after
some properties are changed (code below) I am having problems.  I wonder if
I call self[id].index_object() after self._setObject(id, ad) if that will do
the trick?

Thanks for the reply,
Sean

def manage_addAdItem(self, id, title, REQUEST=None):
 """Zope managment interface create method for AdItem"""

 ad=AdItem(id)
 ad.setId(id)
 ad.setTitle(title)
 if REQUEST is not None:
   ad.setAdBody(REQUEST['adBody'])
   if (len(REQUEST['keywords']) > 0):
 ad.setKeys(REQUEST['keywords'])
   ad.setAdDateMulti(=REQUEST['Ad'], mm=REQUEST['Admm'],
dd=REQUEST['Addd'])
   ad.setRtDateMulti(=REQUEST['Rt'], mm=REQUEST['Rtmm'],
dd=REQUEST['Rtdd'])
   ad.featureURL=REQUEST['featureURL']
 self._setObject(id, ad)
 if REQUEST is not None:
   return self.manage_main(self, REQUEST)



-Original Message-
From: Toby Dickenson [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 6:28 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [Zope-dev] Problems with CatalogAware?


On Fri, 31 Aug 2001 15:17:27 -0700, [EMAIL PROTECTED] wrote:

>I have a python product that has a class derived from CatalogAware and
>Folder.  I programmatically add instances of these (1000s of them) on an
>automated basis every day in the early morning.
>
>My problem is that whenever I do this, the Catalog is updated with some
>problems:
>1 - Metadata is skewed: DateTime objects are cataloged, and they end up
with
>the wrong date ('2001/01/01') instead of today's date, even though the
>actual property contains today's date.  The index in question is built from
>a property.
>2 - Text indexes only get a portion of their text stored in the metadata,
>not all of it.  The index in question is built from a class method in the
>product code.
>

Appologies if you already know this.

CatalogAware will automatically reindex if an object is added,
deleted, or moved. However it does not automatically reindex if
properties are changed.

It sounds like your index might contain the default (initial) values
for these properties. Do you need to add a call to reindex_object()
after changing them from the defaults?

Toby Dickenson
[EMAIL PROTECTED]

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Problems with CatalogAware?

2001-09-11 Thread Toby Dickenson

On Mon, 10 Sep 2001 09:40:46 -0700, [EMAIL PROTECTED] wrote:

>def manage_addAdItem(self, id, title, REQUEST=None):
> """Zope managment interface create method for AdItem"""
>
> ad=AdItem(id)
I assume the __init__ of AdItem that sets the default values that you
mentioned

> ad.setId(id)
> ad.setTitle(title)
> if REQUEST is not None:
>   ad.setAdBody(REQUEST['adBody'])
>   if (len(REQUEST['keywords']) > 0):
> ad.setKeys(REQUEST['keywords'])
>   ad.setAdDateMulti(=REQUEST['Ad'], mm=REQUEST['Admm'],
>dd=REQUEST['Addd'])
>   ad.setRtDateMulti(=REQUEST['Rt'], mm=REQUEST['Rtmm'],
>dd=REQUEST['Rtdd'])
>   ad.featureURL=REQUEST['featureURL']
You overwrite all the defaults with the real values... .good.

> self._setObject(id, ad)
You add the new object to the folder. The folder calls
ad.manage_afterAdd (or whatever its called), which in the case of
CatalogAware calls index_object.

Everything looks right to me. The catalog should contain the real
values.



Toby Dickenson
[EMAIL PROTECTED]

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )