Personal tools
You are here: Home Lists ZPUG DC List Archives 2005 2005-09 Can't Bind to Context in a workflow script / jamesr <circlecycle@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
 

Can't Bind to Context in a workflow script / jamesr <circlecycle@gmail.com>

Can't Bind to Context in a workflow script
jamesr <circlecycle(at)gmail.com>
2005-09-29 17:52:20 [ FULL ]
Hi all, need a little assistance for those in the know! I have made a 
workflow that uses scripts in the transtitions(after). Since workflow 
scripts can't apparently bind certain things, i need to put the meat of 
the scripts in the custom folder. Now here is what is bothering me: At 
my home instance, i am perfectly able to make a statement like so in a 
workflow script:

context.workflowscripts.somescript(state_change)

and have that work. But it stands against what i've seen, that you 
can't bind context in a workflow scripts. How did this work at home? 
Why doesn't it work on another 2.05 instance somewhere else?

here is an excerpt of the UnauthorizedBinding Exception docstring, and 
below this is the exception I got. From that exception - can you divine 
where the big bad error is occuring? I cannot, yet. Thank you for 
browsing this material, thanks yet again if you can answer any of it!

James.

  class UnauthorizedBinding:
  """Explanation: as of Zope 2.6.3 a security hole was closed - no
  security check was happening when 'context' and 'container'
  were bound to a script. Adding the check broke lots of sites
  where existing scripts had the container binding but the users
  of the scripts didn't have access to the container (e.g. workflow
  scripts). This meant getting unauthorized even if the container
  binding wasn't used in the script.

  Now, instead of raising unauthorized at binding time, we bind
  to an UnauthorizedBinding that will allow the script to run if
  it doesn't actually use the binding, but will raise a meaningful
  unauthorized error if the binding is accessed. This makes the
  backward compatibility problem less painful because only those
  actually using the container binding (for ex. workflow scripts)
  need to take explicit action to fix existing sites."""


Exception Type	Unauthorized	
Exception Value	Not authorized to access binding: context	

Traceback (innermost last):
Module ZPublisher.Publish, line 101, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 39, in call_object
Module Shared.DC.Scripts.Bindings, line 306, in __call__
Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
Module Products.PageTemplates.ZopePageTemplate, line 222, in _exec
Module Products.PageTemplates.PageTemplate, line 96, in pt_render
<ZopePageTemplate at /home/calendars/home/month>
Module TAL.TALInterpreter, line 190, in __call__
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 657, in do_useMacro
Module Products.PageTemplates.TALES, line 221, in evaluate
URL: /home/month
Line 1, Column 0
Expression: standard:'here/main_template/macros/master'
- AccessControl.unauthorized.Unauthorized: Not authorized to access 
binding: container
Module Products.PageTemplates.Expressions, line 172, in __call__
Module Products.PageTemplates.Expressions, line 160, in _eval
Module Products.PageTemplates.Expressions, line 116, in _eval
__traceback_info__: here
Module Products.PageTemplates.Expressions, line 294, in 
restrictedTraverse
__traceback_info__: {'path': ['main_template', 'macros', 'master'], 
'TraversalRequestNameStack': ['master', 'macros']}
Module Shared.DC.Scripts.Bindings, line 176, in __getattr__
Module Shared.DC.Scripts.Bindings, line 182, in __you_lose
Unauthorized: Not authorized to access binding: context
Attachments: 
text.enriched application/octet-stream - 5030 Bytes

Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: