2006/9/30, Philipp von Weitershausen <[EMAIL PROTECTED]>:
KLEIN Stéphane wrote:
> I read IntIds apidoc, I see :
> #  register(ob)
> Interface : zope.app.intid.interfaces.IIntIdsSet
> Permissions : zope.ManageContent (lecture), non disponible (écriture)

When quoting things from the Zope ZMI, I suggest switching to English
first. Not everyone understands French.

Sorry :(


By the way, it probably doesn't work because you're missing an adapter
for 'obj' to IKeyReference. This is necessary to make it work and
required by intid utilities as documented in one of the zope.app.intid

   class IIntIdsSet(Interface):

       def register(ob):
           """Register an object and returns a unique id generated for it.

           The object *must* be adaptable to IKeyReference.

           If the object is already registered, its id is returned anyway.

So, you first need to register an IKeyReference adapter for your 'P()'

Now, I do that :

class P(Persistent):
...     pass
from zope.app.keyreference.persistent import KeyReferenceToPersistent
from zope.app.keyreference.interfaces import IKeyReference
from zope.app.testing import setup, ztapi
from persistent.interfaces import IPersistent
ztapi.provideAdapter(IPersistent, IKeyReference, KeyReferenceToPersistent)
from zope.app.intid import IntIds
u = IntIds()
obj = object()
obj = P()
uid = u.register(obj)
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
line 110, in register
   key = IKeyReference(ob)
line 675, in __call__
   adapter = self.__adapt__(obj)
line 742, in __adapt__
   adapter = hook(self, obj)
line 96, in adapter_hook
   return siteinfo.adapter_hook(interface, object, name, default)
line 415, in adapter_hook
   adapter = factory(object)
line 41, in __init__
   raise zope.app.keyreference.interfaces.NotYet(object)
zope.app.keyreference.interfaces.NotYet: <__main__.P object at 0xb6969dec>

What is it ? I've IPersistent adapter to IKeyReference. I don't
understand what is "zope.app.keyreference.interfaces.NotYet:
<__main__.P object at 0xb6969dec>" ?

> Where can I found documentation about IntIds ?

My new book :)

Yes! I want it !

Thanks for your help,
Zope3-users mailing list

Reply via email to