Permalink
Browse files

Proxy.keyspace('user:%d:name') can return a keyspace without botherin…

…g with a label
  • Loading branch information...
1 parent 60776e1 commit 4e79ab08ee8a7e0b6c889b6b8723af225d002e6d @atl atl committed Sep 22, 2010
Showing with 5 additions and 2 deletions.
  1. +1 −1 docs/proxy.rst
  2. +4 −1 redish/proxy.py
View
@@ -225,7 +225,7 @@ database, allowing you to treat the keyspace as a dict::
u'Bob'
Not only can you get ``keys`` that match a (glob-style) pattern, as in
-``redis.keys``(), but you can also get ``values`` and ``items``. When
+``redis.keys()``, but you can also get ``values`` and ``items``. When
fed a keyspace label as an argument, the formatstring is converted to
a glob-style pattern. When used with keyspaced proxies, no argument is
needed, and the keyspace's formatstring is converted into a glob-style
View
@@ -186,7 +186,10 @@ def keyspace(self, keyspace):
"""
Convenient, consistent access to a sub-set of all keys.
"""
- return KeyspacedProxy(self, self._keyspaces[keyspace])
+ if FORMAT_SPEC.search(keyspace):
+ return KeyspacedProxy(self, keyspace)
+ else:
+ return KeyspacedProxy(self, self._keyspaces[keyspace])
@keyspaced
def actual_key(self, key):

0 comments on commit 4e79ab0

Please sign in to comment.