From 5d0b2888f69faded8ce54e74a304ff1c930b2472 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Thu, 21 Feb 2013 11:47:39 +0100 Subject: [PATCH] sphinx_ext: Drop text map for RAPI permissions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Other parts of the documentation directly refer to the constants through βpyevalβ. There's no need for this map as it's just additional work to maintain. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/build/sphinx_ext.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/build/sphinx_ext.py b/lib/build/sphinx_ext.py index b02f7b692..439a4ba42 100644 --- a/lib/build/sphinx_ext.py +++ b/lib/build/sphinx_ext.py @@ -68,13 +68,6 @@ _TAB_WIDTH = 2 RAPI_URI_ENCODE_RE = re.compile("[^_a-z0-9]+", re.I) -RAPI_ACCESS_TEXT = { - rapi.RAPI_ACCESS_WRITE: "write", - rapi.RAPI_ACCESS_READ: "read", - } - -assert frozenset(RAPI_ACCESS_TEXT.keys()) == rapi.RAPI_ACCESS_ALL - class ReSTError(Exception): """Custom class for generating errors in Sphinx. @@ -484,14 +477,13 @@ def _BuildRapiAccessTable(res): access = rapi.baserlib.GetHandlerAccess(handler, method) - perms = map(RAPI_ACCESS_TEXT.__getitem__, access) - - if not perms: - perms.append("*everyone*") + if access: + perms = utils.CommaJoin(sorted(access)) + else: + perms = "*everyone*" yield (" | :ref:`%s <%s>`: %s" % - (method, _MakeRapiResourceLink(method, uri), - utils.CommaJoin(perms))) + (method, _MakeRapiResourceLink(method, uri), perms)) class RapiAccessTable(s_compat.Directive): -- GitLab