Permalink
Browse files

Try to convert values to ints (so l10n can format them).

  • Loading branch information...
1 parent f50394b commit 2749a5b137dc657f6c59567c4af0e4992b3b203a @ionelmc committed Nov 5, 2011
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/redisboard/views.py
@@ -5,6 +5,15 @@
from django.utils.datastructures import SortedDict
from redis.exceptions import ResponseError
+def safeint(value):
+ try:
+ return int(value)
+ except ValueError:
+ return value
+
+def _fixup_pair((a, b)):
+ return a, safeint(b)
+
def _get_key_details(conn, db):
conn.execute_command('SELECT', db)
keys = conn.keys()
@@ -15,7 +24,7 @@ def _get_key_details(conn, db):
key_details[key] = {
'type': conn.type(key),
'details': dict(
- i.split(':') for i in details.split() if ':' in i
+ _fixup_pair(i.split(':')) for i in details.split() if ':' in i
),
'ttl': conn.ttl(key),
}

0 comments on commit 2749a5b

Please sign in to comment.