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
Re: [Zope-PTK] Re: Invalid index name
by Tres Seaver other posts by this author
Apr 28 2000 12:59AM messages near this date
Re: [Zope-PTK] Re: Invalid index name | Re: [Zope-PTK] Re: Invalid index name
Steve Alexander wrote:
>  
>  Dave Seidel wrote:
>  >
>  > Thanks, Steve.  Security's not an issue at this point, I'm experimenting on
>  > a private server.  Unfortunately, after making the changes you suggest, now
>  > there's another error:
>  >
>  > Error Type: AttributeError
>  > Error Value: 'None' object has no attribute 'setMemberProperties'
>  >
>  > Traceback (innermost last):
>  >   File /www/Zope/lib/python/ZPublisher/Publish.py, line 214, in
>  > publish_module
>  >   File /www/Zope/lib/python/ZPublisher/Publish.py, line 179, in publish
>  >   File /www/Zope/lib/python/Zope/__init__.py, line 211, in
>  > zpublisher_exception_hook
>  >   File /www/Zope/lib/python/ZPublisher/Publish.py, line 165, in publish
>  >   File /www/Zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
>  >     (Object: Portal_add)
>  >   File /www/Zope/lib/python/ZPublisher/Publish.py, line 102, in call_object
>  >     (Object: Portal_add)
>  >   File /www/Zope/lib/python/OFS/DTMLMethod.py, line 156, in __call__
>  >     (Object: Portal_add)
>  >   File /www/Zope/lib/python/DocumentTemplate/DT_String.py, line 502, in
>  > __call__
>  >     (Object: Portal_add)
>  >   File /www/Zope/lib/python/DocumentTemplate/DT_With.py, line 148, in render
>  >     (Object: Portal.createInObjectManager(REQUEST['id'], REQUEST))
>  >   File /www/Zope/lib/python/DocumentTemplate/DT_Util.py, line 335, in eval
>  >     (Object: apply_wizard(REQUEST))
>  >     (Info: REQUEST)
>  >   File <string>, line 0, in ?
>  >   File /www/Zope/lib/python/Products/PTKDemo/Portal.py, line 241, in
>  > apply_wizard
>  >     (Object: DemoPortalBase)
>  > AttributeError: (see above)
>  >
>  > I'll try to track this down a little later, when I have more time.
>  
>  Something rather strange is going on there.
>  
>  Here's the line of the error, from
>  lib/python/Products/PTKDemo/Portal.py:
>  
>              self.addMember(username, password,
>                             ['Member', 'Manager', 'Reviewer'], [])
>   -->
>  self.acl_users.getUser(username).setMemberProperties(REQUEST)
>  
>  This implies that the call to addMember isn't properly adding a member.
>  Otherwise, the marked line would discover the just-added member for
>  setting its properties.
>  
>  Perhaps you could download a fresh Zope-2.1.6 ?  I'm using a recent PTK
>  CVS download with Zope-2.1.6 with none of these problems.

Here is an automatable patch (I made it this afternoon, while investigating an
unrelated problem, and then read Steve's description of it here when catching up
on mail):

Index: PortalCatalog.py
===================================================================
RCS file: /cvs-repository/ZopePTK/PTKBase/PortalCatalog.py,v
retrieving revision 1.14
diff -u -r1.14 PortalCatalog.py
--- PortalCatalog.py    2000/04/06 20:42:28     1.14
+++ PortalCatalog.py    2000/04/28 02:58:18
@@ -11,7 +11,7 @@
         # Reviewing indexes
         self._catalog.addIndex('review_state', 'FieldIndex')
         self._catalog.addIndex('Date', 'FieldIndex')
-        self._catalog.addIndex('_allowedRolesAndUsers', 'KeywordIndex')
+        self._catalog.addIndex('allowedRolesAndUsers', 'KeywordIndex')
         # Content indexes
         self._catalog.addIndex('Creator', 'FieldIndex')
         self._catalog.addIndex('Title', 'TextIndex')
@@ -44,7 +44,7 @@
             REQUEST = self.REQUEST
         if REQUEST is not None:
             user = REQUEST.AUTHENTICATED_USER
-            kw['_allowedRolesAndUsers'] = list(user.getRoles()) + +            kw['allowedR
olesAndUsers'] = list(user.getRoles()) +                                           ['Anonymo
us',
                                           'user:'+user.getUserName()]
             if not user.has_permission('Review portal content', self):
Index: PortalContent.py
===================================================================
RCS file: /cvs-repository/ZopePTK/PTKBase/PortalContent.py,v
retrieving revision 1.41
diff -u -r1.41 PortalContent.py
--- PortalContent.py    2000/04/06 20:27:57     1.41
+++ PortalContent.py    2000/04/28 02:58:19
@@ -42,7 +42,7 @@
         # Should be overriden by portal objects
         return "%s %s" % (self.Title(), self.Description())

-    def _allowedRolesAndUsers(self, permission='View'):
+    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.


I will put this into the PTK Tracker ASAP -- I can't think of any reason why the
'allowedRolesAndUsers()' method shouldn't be callable through the web.

-- 
=========================================================
Tres Seaver  tseaver@[...].com   tseaver@palladion.com

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