[enh] display CWConstraint type in its repr
This will change CWConstraint repr from something like:
<Entity CWConstraint 314282 [] at 140127700141904>
To:
<Entity CWConstraint 314282 of type UniqueConstraint [] at 140127700141904>
To help improve debugging UX a little bit.
--- a/cubicweb/entities/schemaobjs.py Wed May 15 14:23:19 2019 +0200
+++ b/cubicweb/entities/schemaobjs.py Thu May 16 01:23:51 2019 +0200
@@ -141,6 +141,10 @@
__regid__ = 'CWConstraint'
fetch_attrs, cw_fetch_order = fetch_config(['value'])
+ def __repr__(self):
+ return '<Entity %s %s of type %s %s at %s>' % (
+ self.e_schema, self.eid, self.type, list(self.cw_attr_cache), id(self))
+
def dc_title(self):
return '%s(%s)' % (self.cstrtype[0].name, self.value or u'')