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

Jonathan dev101 at magma.ca
Thu Dec 15 08:06:53 EST 2005


----- Original Message ----- 
From: "Cameron Beattie" <kjcsb at orcon.net.nz>
To: <zope at zope.org>
Sent: Thursday, December 15, 2005 1:25 AM
Subject: Re: [Zope] Unauthorized exception when trying to access a list item


>
>> 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
>>>
>> Whats in your list?  A protected item?  Does this happen everytime or 
>> just with '1'?
>> David
>>
> The list consists of something like this: [61282125371L, 1, 6, 0]. It 
> happens whatever element I try to access.

I tried the following test script:

list = [61282125371L, 1, 6, 0]
ret = []
tup = (0,1,2)
factortup = (1,2)
factor = 2
for i in range(len(list)):
 if i in tup:
   if i in factortup:
      x = list[i] * factor
      print x

return printed


and it returned:

2
12

No errors, so it must be something else.


Jonathan




More information about the Zope mailing list