RE: [Zope] object manager - getOb(...) - parameter '_marker'
If the object is not found, this raises an Exception unless you have explicitely given a default value (in that case that value is returned). So _marker is just used to know if a default value has been given by the caller (and that value can be None). Pascal -----Message d'origine----- De : zope-bounces@zope.org [mailto:zope-bounces@zope.org]De la part de friedrich steindl Envoyé : mardi 7 décembre 2004 12:47 À : zope@zope.org Objet : [Zope] object manager - getOb(...) - parameter '_marker' 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 ??? thx for any hints steindl friedrich (-:fs) _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************
the parameter being so easy makes my problem more complicated :-)) but through this i know now where i lost my way thank you fritz (-:fs) ======================================================== Am Dienstag, 7. Dezember 2004 12:42 tippte Pascal Peregrina:
If the object is not found, this raises an Exception unless you have explicitely given a default value (in that case that value is returned).
So _marker is just used to know if a default value has been given by the caller (and that value can be None).
Pascal
-----Message d'origine----- De : zope-bounces@zope.org [mailto:zope-bounces@zope.org]De la part de friedrich steindl Envoyé : mardi 7 décembre 2004 12:47 À : zope@zope.org Objet : [Zope] object manager - getOb(...) - parameter '_marker'
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 ???
thx for any hints
steindl friedrich (-:fs)
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.
This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com **********************************************************************
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
friedrich steindl -
Pascal Peregrina