[Zope] ZCatalog problem on insert

2000-11-14 Thread Menard . Jean-Francois

I'm experiencing some problems with the zCatalog.  I made some customized
forms for inserting data.  Yes, I use the ...reindex_object.  And Yes, I
use ...manage_addProduct.

I can see the objects in the Catalog, but my search results are always
empty!  If I update the Catalog manually (in the "Cataloged Objects" tab),
everything is OK, until I insert data again.

It only happens when I insert data, not when I modify or delete an object.
So, as soon as I insert objects via my custom form, my Catalog search stop
working ! 

Am I the only one experiencing this problem ?

I use Catalog in a lot of sites, it's the first time I have such problem.  

Any clue would be very appreciated...  I'm supposed to demo the site
tomorrow morning... :\

Jean-François Ménard
Intranet DPAS
Pratiques d'affaires et orientations
*(514) 840-3000  poste 3939
*  (514) 840-5585
*  [EMAIL PROTECTED]
* 855 Ste-Catherine est, 6e étage
  Montréal, Qué. H2L 4P5


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




[Zope] ZCatalog problem!

2000-09-03 Thread Kevin Howe

Hi, I have a Folderish class (FClass) and I am trying to write it so that
when an FClass object is added in ZOPE, it will automatically create a
ZCatalog object inside itself. I attempted to do this in the manner I had
successfully done this before with other object types:

# handle represents the new object to be added with self,_setObject(id,
handle)
handle.manage_addZCatalog('CatName', 'CatTitle, None)

But this doesn't work. I then did some testing with DTML using the following
method inside a Folder:

dtml-call " manage_addFolder('FolderName') "
dtml-call " manage_addImage('ImageName', '') "
dtml-call " manage_addZCatalog('CatName', 'CatTitle', _.None) "

The new Folder and new Image were both added with no problems. This was what
I expected since the "manage_addFolder" and "manage_addZCatalog" methods are
inherited from OFS.Folder.Folder. The method "manage_addZCatalog" however,
doesn't seem to have been inherited for some reason.

I can add a ZCatalog using the "Add" List, but not programmatically for some
reason, as I can with Folder and Image (and probably most other object
types). Anyone have the faintest clue why this might be?

Thanks,
kh







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




Re: [Zope] ZCatalog problem!

2000-09-03 Thread Kapil Thangavelu

Kevin Howe wrote:
 
 Hi, I have a Folderish class (FClass) and I am trying to write it so that
 when an FClass object is added in ZOPE, it will automatically create a
 ZCatalog object inside itself. I attempted to do this in the manner I had
 successfully done this before with other object types:
 
 # handle represents the new object to be added with self,_setObject(id,
 handle)
 handle.manage_addZCatalog('CatName', 'CatTitle, None)

generally i reserve this type of stuff into the __init__ method of the
object... hence i don't clutter up my manage_add method with code thats
not directly relevant to its function.

anyways, such is mainly a style matter.. 

to answer your question...
here is a method i call from my __init__  method of a python product.


def setup_catalog(self):
''' setups catalog for searching news channels '''

id = 'news_catalog'
catalog = Products.ZCatalog.ZCatalog.ZCatalog(id)
self._setObject(id, catalog)

# setup indexes and such
self.news_catalog.manage_addColumn('description')

self.news_catalog.manage_addColumn('Date')
self.news_catalog.manage_addIndex('Date', 'FieldIndex')

self.news_catalog.manage_addColumn('ChannelName')
self.news_catalog.manage_addIndex('ChannelName', 'FieldIndex')

self.news_catalog.manage_addColumn('link')
self.news_catalog.manage_addIndex('link', 'FieldIndex')

self.news_catalog.manage_addIndex('SearchableText', 'TextIndex')

# get rid of defaults
self.news_catalog.manage_delColumns(['bobobase_modification_time',
'summary'])
   
self.news_catalog.manage_delIndexes(['bobobase_modification_time',   
  'PrincipiaSearchSource'])

return 1


you can also do it from a dtml-method.

i'd don't have the exact syntax handy...

but i'll take a stab at it


 But this doesn't work. I then did some testing with DTML using the following
 method inside a Folder:
 
 dtml-call " manage_addFolder('FolderName') "
 dtml-call " manage_addImage('ImageName', '') "
 dtml-call " manage_addZCatalog('CatName', 'CatTitle', _.None) "
 
 The new Folder and new Image were both added with no problems. This was what
 I expected since the "manage_addFolder" and "manage_addZCatalog" methods are
 inherited from OFS.Folder.Folder. The method "manage_addZCatalog" however,
 doesn't seem to have been inherited for some reason.

the Folder, Image, Document, Method manage_adds are globally available
methods... to add a product you need

see the howto on adding zclasses programamtically for examples/more
info.

if i remember correctly the syntax is something like

dtml-with "Control_Panel.Products['ZCatalog']"
dtml-call "manage_addZCatalog('foo', 'bar', _.None)"
/dtml-with

but i would check that...

Cheers

Kapil

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