[Zope] Newbie questions about OOBTree, persistence

Glen Ecklund Glen@TheGeoGroup.com
Fri, 25 Apr 2003 10:14:06 -0500


Thank you.
I have tried to provide the necessary import permissions:
    allow_module('BTrees')
    allow_module('BTrees.OOBTree')
plus a bunch of others that were probably not useful.

Is there some reason that OOBTree is a security risk?

Glen
   

Andreas Jung wrote:

> Try to do this inside an externmal method. You are not
> allowed to import such module into PythonScript since
> PythonScripts are executed within a sandbox with
> tons of restrictions.
>
> -aj
>
> --On Freitag, 25. April 2003 9:58 Uhr -0500 Glen Ecklund 
> <Glen@TheGeoGroup.com> wrote:
>
>> Hello.
>> I am have trouble accessing an OOBTree.
>> I have found several clues that indicate several different syntaxes,
>> none of which work.
>> Here are some of the things I've tried:
>>
>> ===============================================================
>>
>> from BTrees.OOBTree import OOBTree
>>
>> tree = OOBTree()
>>  tree['a'] = 'AAA'
>>
>> Gets:
>>
>> Error Type: TypeError
>>  Error Value: object does not support item or slice assignment
>>
>>
>> ===============================================================
>>
>> from BTrees.OOBTree import OOBTree
>>
>> tree = OOBTree()
>>  tree.insert['a'] = 'AAA'
>>
>> Gets:
>>
>> Error Type: Unauthorized
>>  Error Value: You are not allowed to access insert in this context
>>
>> ===============================================================
>>
>> from BTrees.OOBTree import OOBTree
>>
>> tree = OOBTree()
>>  insert(tree, 'a', 'AAA')
>>
>> Gets:
>>
>> Error Type: NameError
>>  Error Value: global name 'insert' is not defined
>>
>> ===============================================================
>>
>> from BTrees.OOBTree import OOBTree
>>
>> tree = OOBTree()
>>  OOBTree.insert(tree, 'a', 'AAA')
>>
>> Gets:
>>
>> Error Type: Unauthorized
>>  Error Value: You are not allowed to access insert in this context
>>
>> ===============================================================
>>
>> Also, I need to be able to access elements of the tree.
>> Do I use has_key to check for existence of an element?
>> I haven't been able to get it working either.
>> Do I use
>>     Val = tree['a']
>> to retrieve the value?
>>
>> Third, how do I make my object persistent?
>> I know that there is a Persistent package, but I don't know how to
>> make my tree persistent.
>>
>> Thank you very much,
>> Glen
>>
>> _______________________________________________ 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 )
>
>
>
>

-- 
Glen Ecklund
The Geo Group
6 Odana Court
Madison, WI 53719  USA

glen@TheGeoGroup.com
+1 608 230 1000