Commit e4432383 by Jonathan Kamens

Make classes a little more user-friendly (__dir__, __str__, __repr__)

parent 84143f12
...@@ -41,6 +41,14 @@ class Executable: ...@@ -41,6 +41,14 @@ class Executable:
def __call__(self, *args, **kwargs): def __call__(self, *args, **kwargs):
return self.method(*args, **kwargs) return self.method(*args, **kwargs)
def __dir__(self):
return dir(self.method)
def __str__(self):
return self.method.__str__()
def __repr__(self):
return self.method.__repr__()
class MongoProxy: class MongoProxy:
""" Proxy for MongoDB connection. """ Proxy for MongoDB connection.
...@@ -82,6 +90,9 @@ class MongoProxy: ...@@ -82,6 +90,9 @@ class MongoProxy:
def __dir__(self): def __dir__(self):
return dir(self.conn) return dir(self.conn)
def __str__(self):
return self.conn.__str__()
def __repr__(self): def __repr__(self):
return self.conn.__repr__() return self.conn.__repr__()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment