[Zope] Newbie questions about OOBTree, persistence

Andreas Jung Andreas Jung <andreas@andreas-jung.com>
Fri, 25 Apr 2003 17:06:12 +0200


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 )