Add support for namespaces
This commit is contained in:
parent
516fdd0f6e
commit
d944d91b3c
11
t0reg.py
11
t0reg.py
|
@ -92,7 +92,16 @@ def new():
|
||||||
@flask_app.route('/<rid>', methods=['GET'])
|
@flask_app.route('/<rid>', methods=['GET'])
|
||||||
def get(rid):
|
def get(rid):
|
||||||
try:
|
try:
|
||||||
return registers[rid], 200, {'Content-Type': 'text/plain; charset=utf-8'}
|
if rid.endswith(':'):
|
||||||
|
response = 'Namespace ' + rid + '\n\n'
|
||||||
|
pairs = []
|
||||||
|
for key, value in registers.items():
|
||||||
|
if key.startswith(rid):
|
||||||
|
pairs.append(key.split(':')[1] + ':\n' + value)
|
||||||
|
response += '\n\n'.join(sorted(pairs))
|
||||||
|
else:
|
||||||
|
response = registers[rid]
|
||||||
|
return response, 200, {'Content-Type': 'text/plain; charset=utf-8'}
|
||||||
except:
|
except:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user