[Zope] ZCatalog pointing to wrong object.
Bart Holthuijsen
gonk_@hotmail.com
Mon, 03 Jul 2000 02:54:00 PDT
Hi all!
I have been having some problems with ZClasses and the Catalog.
I made a new Catalogaware External Product, based mostly on the Boring and
Photo products. When I add an instance to a folder the Catalog is updated,
but doesn't point to the right object.
The product inherits from Catalogaware and Objectmanager (and some others).
Example:
In the folder "test" I add an XML Folder (the product) with name: "fold" and
title: "no1".
The Catalog shows a new object with name "test" and title: "no1".
If I then add an XML Folder to test with name "fold2" and title "no2" the
Catalog still only contains one object: test/no2.
If I want to delete the objects I get some weird behavior. The first one
goes without a problem, it removes the entry from the Catalog. The second
gives an error message:
"Error Type: ValueError
Error Value: Uncatalog of absent id 'Test' " This can probably be explained
by the fact that there was only one entry pointing to the Test Folder.
Below I'll paste a bit of the XMLFolder.py file:
from Products.ZCatalog import ZCatalog
from Products.ZCatalog.CatalogAwareness import CatalogAware
import OFS.ObjectManager
import Acquisition
import AccessControl.Role
from Globals import HTMLFile # fakes a method from a DTML file
from Globals import MessageDialog # provid
from Globals import Persistent # makes an object stick in the ZODB
manage_addXMLFolderForm = HTMLFile('XMLFolderAdd', globals())
def manage_addXMLFolder(self, id, title='', REQUEST=None):
"""Add an XMLFolder to a folder."""
self._setObject(id, XMLFolder(id, title))
if REQUEST is not None:
return self.manage_main(self, REQUEST)
class XMLFolder(
CatalogAware, # Self indexing.
OFS.ObjectManager.ObjectManager, # A Folderish object.
Persistent, # Make us persistent. Yaah!
Acquisition.Implicit, # Uh, whatever.
AccessControl.Role.RoleManager # Security manager.
):
"""XMLFolder object.
"""
meta_type = 'XML Folder' # what do people think they're adding?
manage_options = ( # what management options are there?
{'label': 'Contents', 'action': 'manage_main'},
{'label': 'View', 'action': ''}, # defaults to index_html
{'label': 'Security', 'action': 'manage_access'},
)
__ac_permissions__=( # what permissions make sense for us?
('View management screens', ('manage_tabs','manage_main')),
('Change permissions', ('manage_access',) ),
('Change XML Folders' , ('manage_edit',) ),
('View XML Folders', ('',) ),
)
def __init__(self, id, title=''):
"""initialise a new instance of XMLFolder"""
self.id = id
self.title = title
self.manage_addFolder('test','',0,0)
Does anyone know what the problem might be, how I can get the Catalog point
to the right object? I'm using Zope 2.1.4 on Windows NT.
Thanks in advance,
Bart Holthuijsen.
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com