[Grok-dev] Re: Referencing objects by id

Gerard Petersen lijssies at gp-net.nl
Tue Aug 5 04:38:06 EDT 2008


Hi Martijn,

I found some interesting code snippets on the zope faq. In my previous I email was looking more for a semantical answer on naming objects.

Thanx again.

Gerard.

Martijn Faassen wrote:
> Hey,
> 
> One thing you should realize is that in Zope 3 (and therefore Grok) what 
> is called 'id' in Zope 2 is actually called __name__. We call these the 
> name in the container.
> 
> So if you do:
> 
>   container[my_id] = s = Something()
> 
> you can later retrieve the __name__ of the object in that container like 
> this:
> 
>   s.__name__
> 
> I hope that helps!
> 
> It might also be worthwhile to investigate the NameChooser story in Zope 
> 3, though that isn't strictly necessary.
> 
> Regards,
> 
> Martijn
> 
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
> 


More information about the Grok-dev mailing list