nicer __str__ and __repr__ methods on rql constraints stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 02 Dec 2009 12:54:16 +0100
branchstable
changeset 3965 94f95928f5ae
parent 3964 21387ffb0731
child 3966 f742c525b7b4
nicer __str__ and __repr__ methods on rql constraints
schema.py
--- a/schema.py	Wed Dec 02 12:53:46 2009 +0100
+++ b/schema.py	Wed Dec 02 12:54:16 2009 +0100
@@ -596,10 +596,11 @@
         pass # this is a vocabulary constraint, not enforce XXX why?
 
     def __str__(self):
-        return self.restriction
+        return '%s(Any %s WHERE %s)' % (self.__class__.__name__, self.mainvars,
+                                        self.restriction)
 
     def __repr__(self):
-        return '<%s : %s>' % (self.__class__.__name__, repr(self.restriction))
+        return '<%s @%#x>' % (self.__str__(), id(self))
 
 
 class RQLConstraint(RQLVocabularyConstraint):