Commits

Chris Jones committed a7f7f9f

Key view and template now display the TTL on the key if an expire is set.

Comments (0)

Files changed (2)

             output = [r.lindex(key, n) for n in xrange(r.llen(key))]
         else:
             output = r.get(key)
-        return render_template('key.html', rtype=rtype, key=key, output=output)
+        return render_template('key.html', rtype=rtype, key=key, output=output,
+            ttl=r.ttl(key))
     else:
         return render_template('no_key.html', key=key)
 
 <article>
 	<header>
 		<h2>{{ rtype }}</h2>
+		{% if ttl %}
+		<h3>Key expires in: {{ ttl }} seconds</h3>
+		{% endif %}
 	</header>
-	<form action="{{ url_for('save', key=key) }}" method="post" 
-		id="key">
+	<form action="{{ url_for('save', key=key) }}" method="post" id="key">
 		<textarea name="value" cols="60" rows="20">{{ output }}</textarea>
 		<div id="controls">
 			<a id="refresh" href="{{ url_for('key', key=key) }}" title="refresh">refresh</a>