"""
+# pylint: disable-msg=C0103
+
+# C0103: Invalid name, since the R_* names are not conforming
+
import cgi
import re
"""Map resource to method.
"""
- def __init__(self, connector=CONNECTOR):
+ def __init__(self, connector=None):
"""Resource mapper constructor.
@param connector: a dictionary, mapping method name with URL path regexp
"""
+ if connector is None:
+ connector = CONNECTOR
self._connector = connector
def getController(self, uri):
"""/ resource.
"""
- def GET(self):
+ @staticmethod
+ def GET():
"""Show the list of mapped resources.
@return: a dictionary with 'name' and 'uri' keys for each of them.
return baserlib.BuildUriList(rootlist, "/%s")
-def _getResources(id):
+def _getResources(id_):
"""Return a list of resources underneath given id.
This is to generalize querying of version resources lists.
@return: a list of resources names.
"""
- r_pattern = re.compile('^R_%s_([a-zA-Z0-9]+)$' % id)
+ r_pattern = re.compile('^R_%s_([a-zA-Z0-9]+)$' % id_)
rlist = []
for handler in CONNECTOR.values():
""" /2 resource, the root of the version 2 API.
"""
- def GET(self):
+ @staticmethod
+ def GET():
"""Show the list of mapped resources.
@return: a dictionary with 'name' and 'uri' keys for each of them.
"/2/tags": rlib2.R_2_tags,
"/2/info": rlib2.R_2_info,
"/2/os": rlib2.R_2_os,
+ "/2/redistribute-config": rlib2.R_2_redist_config,
}