Skip to content

Commit

Permalink
Improved support for ZSET (sorted set)
Browse files Browse the repository at this point in the history
  • Loading branch information
marians committed Apr 7, 2015
1 parent 5e2ef23 commit 9c5f1e1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion runserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def key(host, port, db, key):
elif t == "set":
val = r.smembers(key)
elif t == "zset":
val = r.zrange(key, 0, -1)
val = r.zrange(key, 0, -1, withscores=True)
return render_template('key.html',
host=host,
port=port,
Expand Down
22 changes: 21 additions & 1 deletion templates/key.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h1>Key: {{ key }}</h1>
<h2>String Value</h2>
<code>{{ value }}</code>

{% elif type == "list" or type == "zset" %}
{% elif type == "list" %}

<h2>Values</h2>
<ol>
Expand Down Expand Up @@ -89,6 +89,26 @@ <h2>Hash keys and values</h2>
</tbody>
</table>

{% elif type == "zset" %}

<h2>Sorted set entries</h2>
<table class="table table-hover">
<thead>
<tr>
<th>Score</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for item in value %}
<tr>
<td><code>{{ item[1] }}</code></td>
<td><code>{{ item[0] }}</code></td>
</tr>
{% endfor %}
</tbody>
</table>

{% endif %}

{% endblock %}

0 comments on commit 9c5f1e1

Please sign in to comment.