[Zope3-dev] Re: ObjectHub
Gary Poster
gary@ZOPE.COM
Sat, 07 Dec 2002 08:34:10 -0500
Steve Alexander wrote:
...
As I wrote privately to Steve, I stupidly forgot that we were returning
hubids from register, which is definitely what we want. So I agree that
returning a Boolean is not as nice as what we have now.
To new proposal:
> For another example:
>
> newly_registered_count = 0
> for wrapped_object in iteratorOfSomeObjectHierarchy():
> hubid, isregistered = hub.register(wrapped_object)
> newly_registered_count += isregistered # True == 1, False == 0
> print "I registered %s additional objects" % newly_registered_count
...I suppose. +0. That's a reasonable use case, but I don't care for
the return signature that much, and the code above doing a try-except
instead isn't that much uglier.
> There's a similar issue with 'unregister': it raises a NotFoundError if
> the object/location is not registered.
>
> We can change 'unregister' to return a bool. This is fine, as it
> currently does not return anything meaningful.
+.5: if the change above is implemented,, +1, and if not, -0.
Gary