Re: [Zope] Unauthorized exception when trying to access a list item
Cameron Beattie wrote: The list consists of something like this: [61282125371L, 1, 6, 0]. Are you _sure_ this is a plain python list? Looking at its format, and the apparently weird nature of your other questions, are you maybe abusing a relational database somewhere in this spider's web? ;-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Unauthorized exception when trying to access a list item
- Original Message - From: "Cameron Beattie" <[EMAIL PROTECTED]> To: 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 ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
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. Regards Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
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 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 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 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 ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Unauthorized exception when trying to access a list item
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 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 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 ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )