ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> zope-cmf
zope-cmf
[Zope-PTK] Re: Invalid index name
by Steve Alexander other posts by this author
Apr 28 2000 5:24AM messages near this date
Re: [Zope-PTK] Re: Invalid index name | Re: [Zope-PTK] Re: Invalid index name
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved