Using Zope object unique id ( _p_oid ) to access object itself
Posted
by Alex M
on Stack Overflow
See other posts from Stack Overflow
or by Alex M
Published on 2010-04-06T09:37:03Z
Indexed on
2010/04/06
9:43 UTC
Read the original article
Hit count: 562
Every Zope object has it's own unique id ( _p_oid ).
To convert it into integer value:
from Shared.DC.xml.ppml import u64 as decodeObjectId
oid = decodeObjectId(getattr(<Object instance>, '_p_oid'))
Is it possible to get object itself having it's _p_oid?
I tried this:
from ZODB.utils import p64
object = <RootObject instance>._p_jar[p64(oid)]
But it seems it's a wrong way
© Stack Overflow or respective owner