From 9c5f1e1664b82ee79b17d27c3dbdc218c7fc0d6c Mon Sep 17 00:00:00 2001 From: marians Date: Tue, 7 Apr 2015 20:02:46 +0200 Subject: [PATCH] Improved support for ZSET (sorted set) --- runserver.py | 2 +- templates/key.html | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/runserver.py b/runserver.py index f29ca63..9bac6e3 100644 --- a/runserver.py +++ b/runserver.py @@ -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, diff --git a/templates/key.html b/templates/key.html index 393c6af..1a4c9b0 100644 --- a/templates/key.html +++ b/templates/key.html @@ -49,7 +49,7 @@

Key: {{ key }}

String Value

{{ value }} - {% elif type == "list" or type == "zset" %} + {% elif type == "list" %}

Values

    @@ -89,6 +89,26 @@

    Hash keys and values

    + {% elif type == "zset" %} + +

    Sorted set entries

    + + + + + + + + + {% for item in value %} + + + + + {% endfor %} + +
    ScoreValue
    {{ item[1] }}{{ item[0] }}
    + {% endif %} {% endblock %} \ No newline at end of file