Brock Pytlik wrote:
> generic.py:
> I think I sort of understand why you needed to do this, put could
> you add some comments to the NSG.__new__ function?
Good idea. I discovered a bug writing the comments. I've copied the
function here.
def __new__(mcs, name, bases, dict):
nsg = None
# We only look at subclasses of Action, and we ignore multiple
# inheritance.
if name != "Action" and issubclass(bases[0], Action):
# Iterate through the inheritance chain to see if any
# parent class has a namespace_group member, and grab
# its value.
for c in bases[0].__mro__:
if c == Action:
break
nsg = getattr(c, "namespace_group", None)
if nsg is not None:
break
# If the class didn't have a namespace_group member
# already, assign one. If we found one in our traversal
# above, use that, otherwise make one up.
if "namespace_group" not in dict:
if not nsg:
nsg = NSG.__nsg
# Prepare for the next class.
NSG.__nsg += 1
dict["namespace_group"] = nsg
return type.__new__(mcs, name, bases, dict)
Thanks,
Danek
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss