| |
@@ -363,16 +363,16 @@
|
| |
'hubs.html', hub=hub, session=session, edit=True)
|
| |
|
| |
|
| |
- @app.route('/<hub>/<idx>/')
|
| |
- @app.route('/<hub>/<idx>')
|
| |
+ @app.route('/<hub>/<int:idx>/')
|
| |
+ @app.route('/<hub>/<int:idx>')
|
| |
def widget_render(hub, idx):
|
| |
widget = get_widget(session, hub, idx)
|
| |
return widget.render(session) # , edit=False)
|
| |
# was blocking all widgets from working, sorry!
|
| |
|
| |
|
| |
- @app.route('/<hub>/<idx>/json')
|
| |
- @app.route('/<hub>/<idx>/json/')
|
| |
+ @app.route('/<hub>/<int:idx>/json')
|
| |
+ @app.route('/<hub>/<int:idx>/json/')
|
| |
def widget_json(hub, idx):
|
| |
widget = get_widget(session, hub, idx)
|
| |
response = flask.jsonify(widget.__json__(session))
|
| |
@@ -380,8 +380,8 @@
|
| |
return response
|
| |
|
| |
|
| |
- @app.route('/<hub>/<idx>/edit/', methods=['GET', 'POST'])
|
| |
- @app.route('/<hub>/<idx>/edit', methods=['GET', 'POST'])
|
| |
+ @app.route('/<hub>/<int:idx>/edit/', methods=['GET', 'POST'])
|
| |
+ @app.route('/<hub>/<int:idx>/edit', methods=['GET', 'POST'])
|
| |
def widget_edit(hub, idx):
|
| |
if flask.request.method == 'POST':
|
| |
return widget_edit_post(hub, idx)
|
| |
@@ -432,8 +432,8 @@
|
| |
return flask.redirect(flask.url_for('hub', name=hub))
|
| |
|
| |
|
| |
- @app.route('/<hub>/<idx>/delete/', methods=['POST'])
|
| |
- @app.route('/<hub>/<idx>/delete', methods=['POST'])
|
| |
+ @app.route('/<hub>/<int:idx>/delete/', methods=['POST'])
|
| |
+ @app.route('/<hub>/<int:idx>/delete', methods=['POST'])
|
| |
def widget_edit_delete(hub, idx):
|
| |
''' Remove a widget from a hub. '''
|
| |
widget = get_widget(session, hub, idx)
|
| |
@@ -592,7 +592,7 @@
|
| |
""" Utility shorthand to get a widget and 404 if not found. """
|
| |
try:
|
| |
idx = int(idx)
|
| |
- except TypeError:
|
| |
+ except (TypeError, ValueError):
|
| |
flask.abort(404)
|
| |
|
| |
hub = get_hub(session, hub)
|
| |
Calling
int()
on a string raises a ValueError, return 404 instead.