##// END OF EJS Templates
Add new methods in update_class()
oscar6echo -
Show More
@@ -269,7 +269,7 b' def update_function(old, new):'
269
269
270 def update_class(old, new):
270 def update_class(old, new):
271 """Replace stuff in the __dict__ of a class, and upgrade
271 """Replace stuff in the __dict__ of a class, and upgrade
272 method code objects"""
272 method code objects, and add new methods, if any"""
273 for key in list(old.__dict__.keys()):
273 for key in list(old.__dict__.keys()):
274 old_obj = getattr(old, key)
274 old_obj = getattr(old, key)
275 try:
275 try:
@@ -291,6 +291,13 b' def update_class(old, new):'
291 except (AttributeError, TypeError):
291 except (AttributeError, TypeError):
292 pass # skip non-writable attributes
292 pass # skip non-writable attributes
293
293
294 for key in list(new.__dict__.keys()):
295 if key not in list(old.__dict__.keys()):
296 try:
297 setattr(old, key, getattr(new, key))
298 except (AttributeError, TypeError):
299 pass # skip non-writable attributes
300
294
301
295 def update_property(old, new):
302 def update_property(old, new):
296 """Replace get/set/del functions of a property"""
303 """Replace get/set/del functions of a property"""
General Comments 0
You need to be logged in to leave comments. Login now