[selectors] minor: use similar __repr__ implementation for selector instances stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 21 Jan 2011 12:51:58 +0100
branchstable
changeset 6870 658039c5eeac
parent 6869 900cb9b1b687
child 6871 b746dae3a004
[selectors] minor: use similar __repr__ implementation for selector instances
appobject.py
selectors.py
--- a/appobject.py	Thu Jan 20 13:16:30 2011 +0100
+++ b/appobject.py	Fri Jan 21 12:51:58 2011 +0100
@@ -214,6 +214,9 @@
         return NotImplementedError("selector %s must implement its logic "
                                    "in its __call__ method" % self.__class__)
 
+    def __repr__(self):
+        return u'<Selector %s at %x>' % (self.__class__.__name__, id(self))
+
 
 class MultiSelector(Selector):
     """base class for compound selector classes"""
--- a/selectors.py	Thu Jan 20 13:16:30 2011 +0100
+++ b/selectors.py	Fri Jan 21 12:51:58 2011 +0100
@@ -1156,8 +1156,8 @@
             rql = 'Any COUNT(X) WHERE X eid %%(x)s, %s' % expression
         self.rql = rql
 
-    def __repr__(self):
-        return u'<rql_condition "%s" at %x>' % (self.rql, id(self))
+    def __str__(self):
+        return '%s(%r)' % (self.__class__.__name__, self.rql)
 
     def score(self, req, rset, row, col):
         try: