[Zope] object manager - getOb(...) - parameter '_marker'

Tino Wildenhain tino at wildenhain.de
Tue Dec 7 07:45:03 EST 2004


Hi,

Am Dienstag, den 07.12.2004, 12:47 +0100 schrieb friedrich steindl:
> hi,
> 
> can somebody give me a hint what the parameter '_marker' is meant for in this 
> code of the zope object manager -
> 
>     def _getOb(self, id, default=_marker):
>         # FIXME: what we really need to do here is ensure that only
>         # sub-items are returned. That could have a measurable hit
>         # on performance as things are currently implemented, so for
>         # the moment we just make sure not to expose private attrs.
>         if id[:1] != '_' and hasattr(aq_base(self), id):
>             return getattr(self, id)
>         if default is _marker:
>             raise AttributeError, id
>         return default
> 
> 
> _marker ist declared as an empty list at the beginning of the module, but 
> outside of the object manager class
> 
> ... and as i believe has something to do with the path to (container of) the 
> object ???

Well, marker has its name for a reason. Its just an non simple object
(list,tuple,dict,...) which is compared by reference, not value.(via is)
This is used to find out if the parameter "default" has actually been
passed as argument or not. 

Regards
Tino



More information about the Zope mailing list