[Zope-CMF] Workflow and zcatalog and zclasses

S Haldar shaldar11@yahoo.com
Fri, 26 Jul 2002 11:57:26 -0700 (PDT)


Hi Dieter, Florent, Chris - 

Thanks for all your help, which helped me solve the
problem with cataloging ZClass instances with indexed
properties.

It turns out that all I had to do was to change the
default catalog before reindexing the ZClass instance.

In 3 steps, here's what I did and didn't do.

1. In the catalog of choice, portal_catalog, I created
FieldIndex type indexes with the same name as the
corresponding ZClass property name

2. If the ZClass instance is programatically
created,it should have been subclassed from
CatalogPathAware (or CatalogAware for Zope versions
below 2.5.1). While defining the ZClass, the
CatalogPathAware should be the FIRST base class.  

Just after the object instance is created, change the
name of the default catalog (which happens to be
"Catalog") to that of your Catalog ("portal_catalog"
in my case). After this, reindex the object.

thisObject.manage_editCataloger('portal_catalog')
.....
thisObject.reindexObject()

This will ensure that the Zclass indexes in the
catalog's brain object get the correct values.

3. Make sure the corresponding workflow object DOES
NOT have any workflow variables having the same name
as the names of the indexes created in Step 1. This
might overwrite the original values for the indexes.

Now the ZClass instances are cataloged and they can be
sorted to be displayed in any order (along with
workflow states).


- Susmit

--- S Haldar <shaldar11@yahoo.com> wrote:
> 
> --- Chris Withers <chrisw@nipltd.com> wrote:
> > > Thanks Chris - Tried that too. The only thing
> that
> > > seem to work when portal_catalog is called are
> the
> > > SearchableText, and the review_state it gets
> from
> > the
> > > workflow instance.
> > 
> > So you're saying the only attributes your brains
> > have are SearchableText 
> > and review_state?
> > 
> > I find that pretty hard to believe :-S
> 
> 
> 
> 
> Thanks Chris, let me be more articulate 8->
> 
> These are the only two I am able to work with. The
> standared indices like, Date, Type, meta_type etc.
> are
> also working. 
> But the indices (and metadata) that I create from
> the 
> ZClass properties (use the property name to create
> index and metadata for the portal_catalog) don't get
> populated, even though I reidex the ZClass instance
> after the property values are populated (which I do
> by
> iterating over a SQL query). The actual property
> values are returned correctly when I list them from
> the actual object (and not just the brain object).
> But
> 
> when I try to access them from the brain object (as
> indices and metadata), they return empty values -
> preventing me from doing any kind of sort_on when I
> search portal_catalog. 
> 
> The only things that return non-zero (and correct!)
> values, besides the standard indices are
> review_state
> and SearchableText. Well, SearchableText is
> standard,
> but it allows me to customize the search to some
> extent. But I would need to have more sorting
> capabilities on more than one ZClass properties, and
> since this is a data mart application, I would
> rather
> take the cost of extra indexing. 
> 
> Which brings me  to the original question, how can I
> get the property indices in the brain reflect the
> same
> values as the corresponding ZClass (ZInstance!) 
> properties?
> 
> > 
> > Check the metadata tab of your portal_catalog
> > again...
> > 
> > > Is there any way to single step through these
> CMF
> > > methods as they are executed? Let me know.
> > 
> > GDB/PDB?
> 
> I am familiar with GDB. Whats the learning curve
> like
> for PDB in a win32 ZMI environment? In other words,
> is
> the documentation fairly decent - like other gnu
> products?
> 
> > 
> > cheers,
> > 
> > Chris
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
> http://health.yahoo.com
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
> 
> See http://collector.zope.org/CMF for bug reports
> and feature requests


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com