[Zope] Help: Unzuthorized Context on sub-object of product sub-class
jkinsley
jkinsley@bticc.net
Sun, 15 Jun 2003 17:26:37 -0400 (EDT)
I am working on a large multiple object application product and in
one module I have encountered an unauthorized context' error that I
have been unable to solve over several days now. The following
classes make up the module causing me problems. Most of the classes
are pure Python and used outside of Zope as well.
class KVItem:
""" A (key, value) object that contains metadata about key
and value and that when displayed as a string is
key=value
"""
def getType(self): return self._type
def getKey(self): return self._key
def getVal(self): return self._val
def getFlags(self): return self._flags
class KVItems:
""" A collection of KVItem objects """
def getKVItems(self): return self._items
class URLBase:
""" Basic URL class """
class Query:
""" A URL Query Class """
def __init__(self, query=None, **qitems):
if query is None: query = qitems
self._query=KVItems(query)
def getQueryItems(self):
""" Returns a list of KVItem objects that make up the query """
return self._query.getKVItems()
class URL(URLBase, Query): pass
class Link(URL, LinkTracker):
""" A Link object. Mostly pure Python, but contains some
conditional Zope code
"""
class ZLink(SimpleItem, Link):
""" Zope version of Link """
zlink = ZLink(id='test', title='Test Link',
href='http://localhost:9080/path/to/file.ext?key1=val1&key2:list=["val2a","val2b"]&key3:int=3')
Now in the editZLinkForm.pt on zlink, I want to get access to the
query items and their meta data.
<table>
<tr tal:repeat="qi here/getQueryItems">
<td tal:content="qi/getType">Data Type</td>
<td tal:content="qi/getKey">Query Key</td>
<td tal:content="qi/getVal">Query Value</td>
</tr>
</table>
so the output would be:
<table>
<tr>
<td>string</td>
<td>key1</td>
<td>val1</td>
</tr>
<tr>
<td>list</td>
<td>key2</td>
<td>['val2a', 'val2b']</td>
</tr>
<tr>
<td>int</td>
<td>key2</td>
<td>val3</td>
</tr>
</table>
Unfortunately, when I try this ZPT fragment, I get the following
Error:
Error Type: TALESError
Error Value: AccessControl.unauthorized.Unauthorized on You are
not allowed to access getType in this context in '',
line 113, column 10
The methods of KVItem are inaccessable. However, I must be able to
edit the metadata of the KVItem objects that make up the query of the
Link URL so that link templates with dynamic query data can generated
on the fly fron REQUEST and SESSION data. I have messed with
AccessControl.ModuleSecurityInfo in various places to see if I could
gain access to the KVItem data to no avail. At this point I am not
sure what to do. I have studied the Security chapter of the ZDG as
well as searched the Zope site over and over.
Any help would be greatly appreciated.
Regards,
Jarrod Kinsley