update tracked view to take id instead of URL

This commit is contained in:
James Turk 2011-09-22 12:52:01 -04:00
parent 4174a25595
commit f2c2e2d6f2
2 changed files with 4 additions and 5 deletions

View File

@ -1,7 +1,7 @@
<tr{% if log.error %} class="error" {% endif %}> <tr{% if log.error %} class="error" {% endif %}>
<td>{{log.action}}</td> <td>{{log.action}}</td>
<td><a href="{{request.script_root}}/tracked/{{log.url}}">{{log.url}}</td> <td><a href="{{request.script_root}}/tracked/{{log._id}}">{{log.url}}</td>
<td>{{log.timestamp.strftime("%Y-%m-%d %H:%M:%S")}}</td> <td>{{log.timestamp.strftime("%Y-%m-%d %H:%M:%S")}}</td>
<td>{% if log.error %}{{log.error}}{% endif %}</td> <td>{% if log.error %}{{log.error}}{% endif %}</td>
</tr> </tr>

View File

@ -85,10 +85,9 @@ def tracked():
return json.dumps(tracked, cls=JSONEncoder) return json.dumps(tracked, cls=JSONEncoder)
@app.route('/tracked/<path:url>') @app.route('/tracked/<id>')
def tracked_view(url): def tracked_view(id):
url = _path_fixer(url) doc = client.db.tracked.find_one({'_id': id})
doc = client.db.tracked.find_one({'url': url})
return json.dumps(doc, cls=JSONEncoder) return json.dumps(doc, cls=JSONEncoder)