[Zope-PTK] Re: Invalid index name
Steve Alexander
steve@cat-box.net
Thu, 27 Apr 2000 20:24:55 +0100
Dave wrote:
> This may have been asked recently in the list, but I don't think there's
> been a reply yet. Apparently the maintainer is offline, but maybe someone
> else can offer a clue.
>
> I'm using CVS versions of both Zope and PTK, and I'm new to both. When I
> try to add a Portal to a folder, I get all the way through the wizard, then
> when I click on Finish, I get:
>
> Error Type: Invalid Index Name
> Error Value: Cannot index fields beginning with "_"
>
> the traceback is:
<deletia>
> File /www/Zope/lib/python/DocumentTemplate/DT_With.py, line 148, in render
> (Object: Portal.createInObjectManager(REQUEST['id'], REQUEST))
> File /www/Zope/lib/python/Products/PTKDemo/Portal.py, line 79, in install
> (Object: DemoPortalBase)
> File /www/Zope/lib/python/Products/PTKBase/PortalCatalog.py, line 14, in
> initialize
> (Object: ElementWithAttributes)
> File /www/Zope/lib/python/Products/ZCatalog/Catalog.py, line 309, in
> addIndex
> Invalid Index Name: (see above)
I didn't get this problem, but I just finished reading the PTK source
(lucky me!).
Alter lib/python/Products/PTKBase/PortalCatalog.py, line 14, to read:
self._catalog.addIndex('allowedRolesAndUsers', 'KeywordIndex')
instead of
self._catalog.addIndex('_allowedRolesAndUsers', 'KeywordIndex')
change line 47 to
kw['allowedRolesAndUsers'] = list(user.getRoles()) + \
instead of
kw['_allowedRolesAndUsers'] = list(user.getRoles()) + \
The other related line is in
lib/python/Products/PTKBase/PortalContent.py, line 45:
def _allowedRolesAndUsers(self, permission='View'):
"""
Return a list of roles and users with View permission.
Used by PortalCatalog to filter out items you're not allowed to
see.
"""
you'll also need to change this method name to remove the underscore.
Watch out, though -- I have no idea what these changes do to the
security of your PTK site!
--
Steve Alexander
Software Engineer
Cat-Box limited