diff sat/core/sat_main.py @ 2914:25f14fbd364e

core: added getNamespace method to retrieve a namespace from short name.
author Goffi <goffi@goffi.org>
date Sun, 14 Apr 2019 08:21:51 +0200
parents 82b781c46841
children 06f30ad8e110
line wrap: on
line diff
--- a/sat/core/sat_main.py	Sun Apr 14 08:21:51 2019 +0200
+++ b/sat/core/sat_main.py	Sun Apr 14 08:21:51 2019 +0200
@@ -613,6 +613,13 @@
     def getNamespaces(self):
         return self.ns_map
 
+    def getNamespace(self, short_name):
+        try:
+            return self.ns_map[short_name]
+        except KeyError:
+            raise exceptions.NotFound(u"namespace {short_name} is not registered"
+                                      .format(short_name=short_name))
+
     def getSessionInfos(self, profile_key):
         """compile interesting data on current profile session"""
         client = self.getClient(profile_key)