diff options
| author | Dan Prince <dan.prince@rackspace.com> | 2011-03-13 13:51:42 -0400 |
|---|---|---|
| committer | Dan Prince <dan.prince@rackspace.com> | 2011-03-13 13:51:42 -0400 |
| commit | 2bfa7b29c7882da559041cea771b9243555828fa (patch) | |
| tree | e2090a81d319192da4c91acf8395775434424ee2 /nova/api | |
| parent | ae7ab4346d851a8284e004ed8efb44a3d4fc95f2 (diff) | |
The extension name is constructed from the camel cased module_name +
'Extension'.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/extensions.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nova/api/openstack/extensions.py b/nova/api/openstack/extensions.py index 24846d9cd..13789863b 100644 --- a/nova/api/openstack/extensions.py +++ b/nova/api/openstack/extensions.py @@ -38,6 +38,12 @@ class ExtensionManager(object): return resources def _load_extensions(self): + """ + Load extensions from the configured path. The extension name is + constructed from the camel cased module_name + 'Extension'. If your + extension module was named widgets.py the extension class within that + module should be 'WidgetsExtension'. + """ if not os.path.exists(self.path): return @@ -46,7 +52,8 @@ class ExtensionManager(object): ext_path = os.path.join(self.path, f) if file_ext.lower() == '.py': mod = imp.load_source(mod_name, ext_path) - self.extensions.append(getattr(mod, 'get_extension')()) + ext_name = mod_name[0].upper() + mod_name[1:] + 'Extension' + self.extensions.append(getattr(mod, ext_name)()) class ExtensionResource(object): |
