Commits

Matthew Frazier  committed 5192161

root keys only raise RuntimeError for actual key methods now

  • Participants
  • Parent commits 848c20a

Comments (0)

Files changed (1)

File redismap/key.py

         return Key(self, client)
     
     def __getattr__(self, attr):
-        if self == "":
-            raise RuntimeError("cannot call methods on a root key")
         if attr in key_methods:
+            if self == "":
+                raise RuntimeError("cannot invoke key methods on root key")
             return _MethodProxy(self.client, attr, self)
         else:
-            raise AttributeError("%r has no method %s" % (self, attr))
+            raise AttributeError("%r has no attribute %s" % (self, attr))
     
     def __getitem__(self, item):
         if isinstance(item, slice):