diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-07-16 17:58:34 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-07-16 17:58:34 +0000 |
| commit | c04012242185cc18de13452c7442c7e800552a01 (patch) | |
| tree | 44a6fb60ac91a8c5e49dfe83394b64156b4f4f39 /nova/utils.py | |
| parent | 9f33802364887dd22e7e87e329f51452650b1edd (diff) | |
| parent | a3576bbb0c7090b97b0b02c88ffa81915db6290b (diff) | |
Merge "Return 413 status on over-quota in the native API."
Diffstat (limited to 'nova/utils.py')
| -rw-r--r-- | nova/utils.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py index 86cbdce1d..9cfb6d06d 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -1238,6 +1238,19 @@ def sys_platform_translate(arch): return arch +def walk_class_hierarchy(clazz, encountered=None): + """Walk class hierarchy, yielding most derived classes first""" + if not encountered: + encountered = [] + for subclass in clazz.__subclasses__(): + if subclass not in encountered: + encountered.append(subclass) + # drill down to leaves first + for subsubclass in walk_class_hierarchy(subclass, encountered): + yield subsubclass + yield subclass + + class UndoManager(object): """Provides a mechanism to facilitate rolling back a series of actions when an exception is raised. |
