-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Laurence Rowe wrote: > Log message for revision 104254: > In Zope 2.10 OFS.ObjectManager does not have a get method > > Changed: > U Products.GenericSetup/trunk/Products/GenericSetup/components.py > > -=- > Modified: Products.GenericSetup/trunk/Products/GenericSetup/components.py > =================================================================== > --- Products.GenericSetup/trunk/Products/GenericSetup/components.py > 2009-09-17 17:32:06 UTC (rev 104253) > +++ Products.GenericSetup/trunk/Products/GenericSetup/components.py > 2009-09-17 17:51:28 UTC (rev 104254) > @@ -221,7 +221,10 @@ > if ofs_id not in self.context.objectIds(): > self.context._setObject(ofs_id, aq_base(obj), > set_owner=False, suppress_events=True) > - obj = self.context.get(ofs_id) > + try: > + obj = self.context.get(ofs_id) > + except AttributeError: > + obj = self.context[ofs_id] # Zope 2.10 > obj.__name__ = ofs_id > obj.__parent__ = aq_base(self.context) > self.context.registerUtility(aq_base(obj), provided, name)
I'm pretty sure the motivation is sound (the GS trunk is still supposed to support 2.10) but I think __getitem__'s semantics don't match here (it can raise KeyError, which get doesn't). Catching AttributeError also masks the possibility that __getitem__ would be present, but would raise AttributeError when called. Maybe instead: getter = getattr(self.context, 'get', None) if getter is None: getter = self.context._getOb # BBB: Zope <= 2.10.x obj = getter(ofs_id, None) Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFKsuzL+gerLs4ltQ4RAnWWAKC4euqQqnsPFsbG0Zi12JUCtygSJQCfS+54 zQJwUiLO0hLEzEB7vs1mx60= =yHyA -----END PGP SIGNATURE----- _______________________________________________ Zope-CMF maillist - Zope-CMF@zope.org https://mail.zope.org/mailman/listinfo/zope-cmf See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests