changeset 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 672e6be3290f
children d1fcb8e9aced
files sat/core/sat_main.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
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)