1 class QueryRegister(object):
4 def __init__(self, *args, **kwargs):
5 self.__dict__ = self.__shared_state
7 if not getattr(self, 'initialised', False):
8 self.initialised = True
10 # Dictionary of query paths to help mappings
13 def register_path(self, path, func):
14 self.queries[path] = func.__doc__
17 return sorted(self.queries.keys())
19 def get_path_help(self, path):
20 # We always register with the leading /
21 if not path.startswith('/'):
23 return self.queries.get(path, 'Unknown path')
25 __all__ = ['QueryRegister']