Personal tools
You are here: Home Lists ZPUG DC List Archives 2005 2005-06 local roles / David Greisen <dgreisen@gmail.com>
Navigation
Log in


Forgot your password?
New user?
Mailing Lists
You can read our ZPUGDC mailing list archives online.
You can subscribe to our mailing list:
Book Review

The Definitive Guide to Plone

Reviewer: joel
 

local roles / David Greisen <dgreisen@gmail.com>

local roles
David Greisen <dgreisen(at)gmail.com>
2005-06-25 06:54:19 [ FULL ]
I have written a transition that should give the user a Reviewer localrole. 
Unfortunately, the script I call to do this does not seem to be working.

The code, based on folder_localrole_edit, is: 

# get the object and its ID
object = state_change.object
id = object.getId()

# get the user and id
user = context.portal_membership.getAuthenticatedMember()
userId = (user.getId(),)

return userId
pm = container.portal_membership
pm.setLocalRoles(object, userId, 'Reviewer')

it has one parameter, state_change. It has a proxy role of Manager. I know 
it is being called from the transition, because an early code bug elicited 
an error.

I am stumped, any help would be much appreciated.

David
Attachments: 
text.html text/html - 1753 Bytes

Re: [ZPUGDC] local roles / Joel Burton <joel@joelburton.com>

Re: [ZPUGDC] local roles
Joel Burton <joel(at)joelburton.com>
2005-06-25 08:36:31 [ FULL ]
On Saturday 25 June 2005 11:55 am, David Greisen wrote:[...]

What's "not working" about it? Does it return any error? Or silently fail?

I assume you've tried taking out that "return userId" that appears before the 
local-role-setting lines? ;)

I don't see anything obviously wrong here, but have only eyeballed this and 
not tested it. If you're stumped, I'd run it under the debugger. You can do 
this by:

1) making this an external method, and adding pdb-drop-into lines into (import 
pdb; pdb.set_trace()), then step through it via the console

2) use WingIDE's Zope debugging capabilities to step through it

Then you can literally see what happens.

- j.

Re: [ZPUGDC] local roles / David Greisen <dgreisen@gmail.com>

Re: [ZPUGDC] local roles
David Greisen <dgreisen(at)gmail.com>
2005-06-27 09:34:21 [ FULL ]
Thanks for the suggestion. I created a script as suggested. I played around 
with it all weekend and have determined that it must be a permissions 
problem. Any user that is a manager can use the script, but nobody else can. 
It doesn't give the standard error that you don't have the privileges, it 
just silently fails. I have given the script manager proxy, but that didn't 
work. I then gave it a proxy for every role, still didn't work. Am I doing 
something wrong? or is this a bug in zope/plone?

Thanks again,

David
On 6/25/05, Joel Burton <joel(at)joelburton.com> wrote:[...]
Attachments: 
text.html text/html - 2899 Bytes

RE: [ZPUGDC] local roles / "Boos, Paul M." <PAUL.M.BOOS@saic.com>

RE: [ZPUGDC] local roles
"Boos, Paul M." <PAUL.M.BOOS(at)saic.com>
2005-06-27 09:39:11 [ FULL ]
I would suggest using verbose security and see if that reveals anything,
although it may not since it is silently failing...

-----Original Message-----
From: zpugdc-owner(at)lists.zpugdc.org
[mailto:zpugdc-owner(at)lists.zpugdc.org]On
Behalf Of David Greisen
Sent: Monday, June 27, 2005 10:36 AM
To: zpugdc(at)lists.zpugdc.org
Subject: Re: [ZPUGDC] local roles


Thanks for the suggestion. I created a script as suggested. I played around
with it all weekend and have determined that it must be a permissions
problem. Any user that is a manager can use the script, but nobody else can.
It doesn't give the standard error that you don't have the privileges, it
just silently fails. I have given the script manager proxy, but that didn't
work. I then gave it a proxy for every role, still didn't work. Am I doing
something wrong? or is this a bug in zope/plone?

Thanks again,

David

On 6/25/05, Joel Burton < joel(at)joelburton.com
<mailto:joel(at)joelburton.com> >
wrote: 

On Saturday 25 June 2005 11:55 am, David Greisen wrote:[...]
localrole.[...]
[...]

What's "not working" about it? Does it return any error? Or silently fail? 

I assume you've tried taking out that "return userId" that appears before
the
local-role-setting lines? ;)

I don't see anything obviously wrong here, but have only eyeballed this and
not tested it. If you're stumped, I'd run it under the debugger. You can do 
this by:

1) making this an external method, and adding pdb-drop-into lines into
(import
pdb; pdb.set_trace()), then step through it via the console

2) use WingIDE's Zope debugging capabilities to step through it 

Then you can literally see what happens.

- j.


--
To unsubscribe send an email with subject 'unsubscribe' to
zpugdc(at)lists.zpugdc.org <mailto:zpugdc(at)lists.zpugdc.org> .
Please contact zpugdc-owner(at)lists.zpugdc.org
<mailto:zpugdc-owner(at)lists.zpugdc.org>  for questions.
http://zpugdc.org/lists/zpugdc/archive/2005/2005-06/1119700459177/1119706580
329
<http://zpugdc.org/lists/zpugdc/archive/2005/2005-06/1119700459177/111970658
0329>
Attachments: 
text.html text/html - 3920 Bytes

Re: [ZPUGDC] local roles / Joel Burton <joel@joelburton.com>

Re: [ZPUGDC] local roles
Joel Burton <joel(at)joelburton.com>
2005-06-27 10:10:30 [ FULL ]
On Monday 27 June 2005 2:35 pm, David Greisen wrote:[...]

What did running it under a debugger show?

- j.

Re: [ZPUGDC] local roles / jamesr <circlecycle@gmail.com>

Re: [ZPUGDC] local roles
jamesr <circlecycle(at)gmail.com>
2005-06-27 15:51:35 [ FULL ]
about silently failing, may I suggest a dirty dirty tactic?  when
you're not sure just where bad things happen, stick a "raise
Exception, str(something)"  in your code. quick sanity checks... you
could call state_change .object.get_local_roles() for instance.

at least I try... of course doing this on a production site may cause
rashes or halitosis, but hey.

On 6/27/05, Joel Burton <joel(at)joelburton.com> wrote:[...]

Re: [ZPUGDC] local roles / David Greisen <dgreisen@gmail.com>

Re: [ZPUGDC] local roles
David Greisen <dgreisen(at)gmail.com>
2005-06-28 18:22:06 [ FULL ]
Hey guys,

Thanks for the suggestions. I'm trying to set up WingIDE to give that a 
shot. I just got really sick last night, so I'll continue work and let you 
know the outcome when I am functioning again.

David

On 6/27/05, jamesr <circlecycle(at)gmail.com> wrote:[...]
Attachments: 
text.html text/html - 2711 Bytes

Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: