Author
|
zPlus <zplus@peers.community>
2024-11-20 12:39:50
|
Committer
|
zPlus <zplus@peers.community>
2024-11-20 12:39:50
|
Commit
|
cf95e4e
(patch)
|
Tree
|
2885718
|
Parent(s)
|
|
Move license queries from templates to controllers.
commits diff:
ee4ad5c..cf95e4e
3 files changed,
29 insertions,
20 deletions
—
download
Diffstat
Diff options
+29/-1
M app.py
229
|
229
|
|
|
230
|
230
|
|
return template('templates/library/item.tpl', item_id=item_id, plaintext=item_plaintext)
|
231
|
231
|
|
|
|
232
|
+ |
@bottle.get('/license', name='license_list')
|
|
233
|
+ |
def license_list():
|
|
234
|
+ |
"""
|
|
235
|
+ |
List all licenses.
|
|
236
|
+ |
"""
|
|
237
|
+ |
|
|
238
|
+ |
# TODO sanitize input
|
|
239
|
+ |
data = query(f"""
|
|
240
|
+ |
PREFIX license: <dokk:vocab:license:>
|
|
241
|
+ |
|
|
242
|
+ |
SELECT *
|
|
243
|
+ |
WHERE {{
|
|
244
|
+ |
?license license:id ?id ;
|
|
245
|
+ |
license:name ?name .
|
|
246
|
+ |
}}
|
|
247
|
+ |
ORDER BY ASC(UCASE(?name))
|
|
248
|
+ |
""")
|
|
249
|
+ |
|
|
250
|
+ |
return template('license.html', data=data)
|
|
251
|
+ |
|
232
|
252
|
|
@bottle.get('/license/<id>', name='license')
|
233
|
253
|
|
def license(id):
|
234
|
254
|
|
"""
|
|
255
|
+ |
Show a single license
|
235
|
256
|
|
"""
|
236
|
257
|
|
|
237
|
|
- |
return template('templates/license/license.tpl', license_id=id)
|
|
258
|
+ |
# TODO sanitize input
|
|
259
|
+ |
data = query(f"""
|
|
260
|
+ |
PREFIX license: <dokk:vocab:license:>
|
|
261
|
+ |
|
|
262
|
+ |
DESCRIBE <dokk:license:{id}>
|
|
263
|
+ |
""")
|
|
264
|
+ |
|
|
265
|
+ |
return template('templates/license/license.tpl', data=data)
|
238
|
266
|
|
|
239
|
267
|
|
@bottle.get('/manpages/<distribution>/<version>', name='manpages_distribution')
|
240
|
268
|
|
def manpages_distribution(distribution, version):
|
+0/-12
M pages/license.html
1
|
1
|
|
{% extends "templates/base.tpl" %}
|
2
|
2
|
|
|
3
|
|
- |
{% set data = query("""
|
4
|
|
- |
PREFIX license: <dokk:license:>
|
5
|
|
- |
|
6
|
|
- |
SELECT *
|
7
|
|
- |
WHERE {
|
8
|
|
- |
?license license:id ?id ;
|
9
|
|
- |
license:name ?name.
|
10
|
|
- |
}
|
11
|
|
- |
ORDER BY ASC(UCASE(?name))
|
12
|
|
- |
""")
|
13
|
|
- |
%}
|
14
|
|
- |
|
15
|
3
|
|
{% block title %}Licenses{% endblock %}
|
16
|
4
|
|
|
17
|
5
|
|
{% block body %}
|
+0/-7
M pages/templates/license/license.tpl
1
|
1
|
|
{% extends "templates/base.tpl" %}
|
2
|
2
|
|
|
3
|
|
- |
{% set data = query("""
|
4
|
|
- |
PREFIX license: <dokk:license:>
|
5
|
|
- |
|
6
|
|
- |
DESCRIBE license:""" + license_id + """
|
7
|
|
- |
""")
|
8
|
|
- |
%}
|
9
|
|
- |
|
10
|
3
|
|
{% block title %}{{ data['license:name'] }}{% endblock %}
|
11
|
4
|
|
|
12
|
5
|
|
{% block body %}
|