[Zope] Can't access a method 'in this context'
Tim Hicks
tim@sitefusion.co.uk
Tue, 20 Aug 2002 17:40:52 +0100
> Tim Hicks wrote:
> >
> > # 'self' is the plugin converter object
> > folder = self.restrictedTraverse(path_to_folder)
> > #Authenticate with the same acl_users as the original uploader
> > acl_users = folder.acl_users
> > user = acl_users.authenticate(qfile.user, qfile.passw, request={})
> > user = user.__of__(acl_users)
> > newSecurityManager(None, user)
>
> Urm, I don't know whether that'll work. If it doesn't error, you may
experience
> weird security stuff happening later on...
>
> Urm, hang on... ;-)
Do you have a better/correct way <crosses fingers and toes ;-)>?
> > Debug log output reveals the following:
> >
> > 2002-08-20 00:10:41,871 DEBUG dir(self.aq_parent) => ['_objects',
> > '_pluginConverters', 'asyncSuccess', 'cleanId', 'currentConverter',
> > 'handleFiles', 'id', 'makeZPT', 'nullUpload', 'title', 'uploadBox',
> > 'uploadBoxAsync', 'uploadDispatch', 'uploadDispatchAsync']
> > 2002-08-20 00:10:41,871 DEBUG self.aq_parent.__roles__ => ('Anonymous',
> > 'Manager', 'sysUser', 'zlaveUser')
> > 2002-08-20 00:10:41,901 DEBUG dir(user) => ['__', 'domains', 'name',
> > 'roles']
> > 2002-08-20 00:10:41,901 DEBUG user.roles => ['Manager']
>
> And that helps me how? ;-)
Ah, good point some explanation in order perhaps ;-)! In the first line, I
was just trying to show that I am successfully acquiring the ZOffice
instance that is the parent of the plugin converter. The second line shows
the __roles__ on the ZOffice object. I included this as
ZopeSecurityPolicy.py seems to try to match this with the roles of the user.
Hence, the last line is showing that the logged-in user does indeed have the
'Manager' role.
I'll leave you to decide if that helps you ;-).
cheers
tim