From c11bf29f4bdf252f850b963e33ebcdb2f7609b5c Mon Sep 17 00:00:00 2001 From: William Brown Date: Nov 19 2015 00:07:06 +0000 Subject: Fix up pep8 --- diff --git a/RESTfulLDAP.py b/RESTfulLDAP.py index f8f39f0..ee2e7de 100644 --- a/RESTfulLDAP.py +++ b/RESTfulLDAP.py @@ -259,9 +259,14 @@ app.register_blueprint(repl_api) app.register_blueprint(ldap_api) app.register_blueprint(schema_api) + @app.route('/v1/whoami', methods=['GET', 'OPTIONS', 'HEAD']) @authenticateConnection def whoami(ds): + """ +Returns the DN of the current user bound to the DS from your authentication +details, or will return "" for Anonymous bind. + """ if request.method == 'OPTIONS': # # Return a list of the allowed methods @@ -292,7 +297,13 @@ def welcome_page(): # Can we return a list of all api end points here? # Must be last so that we get all the api bits registered. - urls = dict([ (r.rule, app.view_functions.get(r.endpoint).func_doc ) for r in app.url_map.iter_rules() if r.rule.startswith('/v1')] ) + urls = dict([ + (r.rule, { + 'docstr': app.view_functions.get(r.endpoint).func_doc, + 'methods': r.methods, + }) + for r in app.url_map.iter_rules() if r.rule.startswith('/v1') + ]) # End dict return render_template('index.html', urls=urls) diff --git a/templates/index.html b/templates/index.html index cebcb8b..77718f7 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,10 +3,11 @@
- {% for path, docstr in urls|dictsort(false, 'key') %} + {% for path, doc in urls|dictsort(false, 'key') %}
{{ path }}
-
{{ docstr }}
+
METHODS:
{{ doc['methods']|sort }}
+
DOCSTR:
{{ doc['docstr'] }}
{% endfor %}