geni_api_versions should be a dict not a list
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Sat, 9 Feb 2013 21:46:05 +0000 (16:46 -0500)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Sat, 9 Feb 2013 21:46:05 +0000 (16:46 -0500)
sfa/managers/aggregate_manager.py
sfa/server/api_versions.py

index 4d773fc..fe6b07b 100644 (file)
@@ -14,7 +14,7 @@ class AggregateManager:
         xrn=Xrn(api.hrn)
         version = version_core()
         geni_api_versions = ApiVersions().get_versions()
-        geni_api_versions.append({'2': 'http://%s:%s' % (api.config.SFA_AGGREGATE_HOST, api.config.SFA_AGGREGATE_PORT)})
+        geni_api_versions['2'] = 'http://%s:%s' % (api.config.SFA_AGGREGATE_HOST, api.config.SFA_AGGREGATE_PORT)
         version_generic = {
             'interface':'aggregate',
             'sfa': 2,
index 2f1ccf7..9b05dbe 100644 (file)
@@ -32,7 +32,7 @@ class ApiVersions:
         self.xml = XML(source)
 
     def get_versions(self):
-        versions = []
+        versions = {}
         for value in self.xml.todict().values():
             if not value:
                 continue
@@ -40,8 +40,7 @@ class ApiVersions:
                 for item in value:
                     if isinstance(item, dict) and \
                        set(ApiVersions.required_fields).issubset(item.keys()):
-                        api_version = {str(item['version']): item['url']}
-                        versions.append(api_version)
+                        versions[str(item['version'])] = item['url']
         return versions