[Zope] Unauthorized exception when trying to access a list item

David H bluepaul at earthlink.net
Wed Dec 14 23:09:57 EST 2005


Cameron Beattie wrote:

> I am trying to access a value in a list. The script getDIDS_list is 
> passed a list called listoflists:
> list = listoflists
> ret = []
> tup = (0,1,2)
> factortup = (1,2)
> factor = 2
> for i in range(len(list)):
> #   1 == 1
>  if i in tup:
>    if i in factortup:
>       x = list[i] * factor
> etc
>
> The code is a bit strange due to my testing. However zope gets upset 
> when trying to evaluate list[i]:
>
> You are not allowed to access '1' in this context
>
> a.. Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
> __traceback_info__: context.getDIDS_list(listoflists = DIDs)
> a.. Module Python expression "context.getDIDS_list(listoflists = 
> DIDs)", line 1, in <expression>
> a.. Module Shared.DC.Scripts.Bindings, line 311, in __call__
> a.. Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
> a.. Module Products.PythonScripts.PythonScript, line 323, in _exec
> a.. Module None, line 10, in getDIDS_list
> <PythonScript at /Conversant/account/getDIDS_list>
> Line 10
> a.. Module AccessControl.ZopeGuards, line 71, in guarded_getitem
> a.. Module AccessControl.ImplPython, line 529, in validate
> a.. Module AccessControl.ImplPython, line 329, in validate
>
> I've tried calling the script from the page template using 
> here.getDIDS_list, container.getDIDS_list context.getDIDS_list but the 
> problem persists. Am I accessing the list in the wrong way? Any advice 
> would be appreciated.
>
> Regards
>
> Cameron

Whats in your list?  A protected item?  Does this happen everytime or 
just with '1'? 

David



More information about the Zope mailing list