GNUnet 0.21.1
httpdomain.autohttp.flask_base Namespace Reference

Data Structures

class  AutoflaskBase
 

Functions

def translate_werkzeug_rule (rule)
 
def get_routes (app, endpoint=None, order=None)
 
def quickref_directive (method, path, content)
 

Detailed Description

    sphinxcontrib.autohttp.flask
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    The sphinx.ext.autodoc-style HTTP API reference builder (from Flask)
    for sphinxcontrib.httpdomain.

    :copyright: Copyright 2011 by Hong Minhee
    :license: BSD, see LICENSE for details.

Function Documentation

◆ translate_werkzeug_rule()

def httpdomain.autohttp.flask_base.translate_werkzeug_rule (   rule)

Definition at line 31 of file flask_base.py.

32 from werkzeug.routing import parse_rule
33 buf = six.StringIO()
34 for conv, arg, var in parse_rule(rule):
35 if conv:
36 buf.write('(')
37 if conv != 'default':
38 buf.write(conv)
39 buf.write(':')
40 buf.write(var)
41 buf.write(')')
42 else:
43 buf.write(var)
44 return buf.getvalue()
45
46

Referenced by httpdomain.autohttp.flask_base.get_routes().

Here is the caller graph for this function:

◆ get_routes()

def httpdomain.autohttp.flask_base.get_routes (   app,
  endpoint = None,
  order = None 
)

Definition at line 47 of file flask_base.py.

47def get_routes(app, endpoint=None, order=None):
48 endpoints = []
49 for rule in app.url_map.iter_rules(endpoint):
50 url_with_endpoint = (
51 six.text_type(next(app.url_map.iter_rules(rule.endpoint))),
52 rule.endpoint
53 )
54 if url_with_endpoint not in endpoints:
55 endpoints.append(url_with_endpoint)
56 if order == 'path':
57 endpoints.sort()
58 endpoints = [e for _, e in endpoints]
59 for endpoint in endpoints:
60 methodrules = {}
61 for rule in app.url_map.iter_rules(endpoint):
62 methods = rule.methods.difference(['OPTIONS', 'HEAD'])
63 path = translate_werkzeug_rule(rule.rule)
64 for method in methods:
65 if method in methodrules:
66 methodrules[method].append(path)
67 else:
68 methodrules[method] = [path]
69 for method, paths in methodrules.items():
70 yield method, paths, endpoint
71
72
def get_routes(app, endpoint=None, order=None)
Definition: flask_base.py:47

References httpdomain.autohttp.flask_base.translate_werkzeug_rule().

Referenced by httpdomain.autohttp.flask_base.AutoflaskBase.make_rst().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ quickref_directive()

def httpdomain.autohttp.flask_base.quickref_directive (   method,
  path,
  content 
)

Definition at line 73 of file flask_base.py.

73def quickref_directive(method, path, content):
74 rcomp = re.compile("^\s*.. :quickref:\s*(?P<quick>.*)$")
75 method = method.lower().strip()
76 if isinstance(content, six.string_types):
77 content = content.splitlines()
78 description=""
79 name=""
80 ref = path.replace("<","(").replace(">",")").replace("/","-").replace(":","-")
81 for line in content:
82 qref = rcomp.match(line)
83 if qref:
84 quickref = qref.group("quick")
85 parts = quickref.split(";",1)
86 if len(parts)>1:
87 name = parts[0]
88 description= parts[1]
89 else:
90 description= quickref
91 break
92
93 row ={}
94 row['name'] = name
95 row['operation'] = ' - `%s %s <#%s-%s>`_' % (method.upper(), path, method.lower(), ref)
96 row['description'] = description
97
98 return row
99
static int replace
Replace DID Document Flag.
Definition: gnunet-did.c:53
def quickref_directive(method, path, content)
Definition: flask_base.py:73

References replace.

Referenced by httpdomain.autohttp.flask_base.AutoflaskBase.make_rst().

Here is the caller graph for this function: