[Zope3-Users] Re: Why in apidoc, I don't found the interface must be implemented to be register by IntIds ?

Philipp von Weitershausen philipp at weitershausen.de
Fri Sep 29 21:12:55 EDT 2006


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.

> in lib/python/zope/app/intid/tests.py I see :
> 
> class P(Persistent):
>    implements(ILocation)
> 
> and too far :

?

>        u = IntIds()
>        obj = P()
> 
>        uid = u.register(obj)
> 
> When, in debugzope I test :
> 
>        u = IntIds()
>        obj = object()
> 
>        uid = u.register(obj)
> 
> this don't work.

"it doesn't work" is not a proper error description. We can't help you 
without knowing *what's* going wrong on your side.


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 
interfaces:

   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()' 
object.


> Where can I found documentation about IntIds ?

My new book :)



More information about the Zope3-users mailing list