[ZODB-Dev] Weird errors with Zope 2.7.7

Tim Peters tim.one at comcast.net
Thu Oct 20 11:15:08 EDT 2005


[Chris Withers]
>>> First question, would you mind if I added oid_unrepr to ZODB.utils? I

[Dieter Maurer]
>> Why do you not like "p64" (which is already there)?

[Chris]
> If that's the case, then great :-)
>
> I was just asking 'cos I couldn't find he functionality anywhere,

You found ZODB.utils, which was a sensible place to look.  I don't really
understand how you found ZODB.utils but didn't manage to find p64, because
p64 is the first function in the file.

> I guess p64 needs documenting,

I think its docstring is reasonably clear:

    def p64(v):
        """Pack an integer or long into a 8-byte string"""

In addition to that, it would be helpful to have a tutorial overview
"somewhere" explaining that FileStorage oids are 8-byte strings.  I don't
know where to put that so that people would find it, though.  For example,
where would you have found it?

> and maybe a better name?

Many ZODB users already know this, and there are references to p64 on user
web pages.  For example,

    http://www.zopezone.com/discussions/general/00000168

shows how to do what you started out to do:

>>> from Zope.Startup.run import configure;configure('zope-8000/zope.conf')
>>> from Zope import app; root = app()
>>> from ZODB.utils import p64
>>> o = root._p_jar[p64(0x277FEL)]
>>> o
OOBucket([('566', -1920968609), ...])

I don't want to break pages like that, so the current name has to remain.
It would be possible to add an alias.  I'm -0 on that (would violate TOOWTDI
in exchange for ... well, not sure it would really help anyone anyway).




More information about the ZODB-Dev mailing list