flectra/doc/howtos/website/routing-converter

21 lines
716 B
Plaintext
Raw Permalink Normal View History

# HG changeset patch
# Parent e9d9740fa1852c80541c6b5b94280c8ec74cc4bb
# Parent cf501446e2f8d7a059ef7bd16866ed03c8f2a04f
diff --git a/academy/controllers.py b/academy/controllers.py
--- a/academy/controllers.py
+++ b/academy/controllers.py
@@ -9,9 +9,9 @@ class Academy(http.Controller):
'teachers': Teachers.search([])
})
- @http.route('/academy/<name>/', auth='public', website=True)
- def teacher(self, name):
- return '<h1>{}</h1>'.format(name)
+ @http.route('/academy/<int:id>/', auth='public', website=True)
+ def teacher(self, id):
+ return '<h1>{} ({})</h1>'.format(id, type(id).__name__)
# @http.route('/academy/academy/objects/', auth='public')