julien tayon <julien.tayon@logilab.fr> [Tue, 11 Jun 2019 09:40:12 +0200] rev 12640
Fix sorting key for rdefs in schema viewer
With changeset 234ca3cbbb46, clicking in the schema of an entity with
cubicweb in py3 on "vue en boite" will probably result in an infinite
spinner (which implies cw > 3.26)
What happened ?
This "vue en boite" used to work at least until...
hg diff -c a8c1ea390400 cubicweb/schema.py
@@ -993,10 +992,6 @@ class CubicWebRelationSchema(PermissionM
return False
return True
- @deprecated('use .rdef(subjtype, objtype).role_cardinality(role)')
- def cardinality(self, subjtype, objtype, target):
- return self.rdef(subjtype, objtype).role_cardinality(target)
-
class CubicWebSchema(Schema):
"""set of entities and relations schema defining the possible data sets
But, wait ...
If I open a shell on an instance of cw 3.24 something seems off
>>> list(schema['CWUniqueTogetherConstraint'].relation_definitions())[0][0].cardinality
# <bound method CubicWebRelationSchema.wrapped of <constraint_of [CWUniqueTogetherConstraint,CWEType]>>
We have been sorting on a method the whole time ? Is it possible what
were the effects ?
1) We cannot sort function can't we ?
>>> def adder(i): return lambda x: x+i
>>> sorted(map(adder,range(10)))
[<function __main__.<lambda>>,
<function __main__.<lambda>>,
...
Yes we can.
2) what does it means.
>>> { adder(1) : 1 }
Out[19]: {<function __main__.<lambda>>: 1}
In fact the function object as a __hash__ method (which is practical for making
memoizers (cache)), and return truly random results (pseudo random).
My take on this patch is relations have NEVER been sorted by cardinality.
No one never ever noticed. Hence, I propose to not fix a bug that never was
reported.
julien tayon <julien.tayon@logilab.fr> [Tue, 04 Jun 2019 09:35:47 +0200] rev 12639
Flake8 cubicweb/web/schemaviewer.py
julien tayon <julien.tayon@logilab.fr> [Tue, 04 Jun 2019 09:35:47 +0200] rev 12638
[py3] changing unicode to str
py2 support being dropped, passing the code in full py3 str/bytes syntax
julien tayon <julien.tayon@logilab.fr> [Tue, 11 Jun 2019 09:07:24 +0200] rev 12637
[py3] Use sorted(key=...) instead of sorted(cmp=...)
Denis Laxalde <denis.laxalde@logilab.fr> [Fri, 07 Jun 2019 14:56:22 +0200] rev 12636
Merge with 3.26
Denis Laxalde <denis.laxalde@logilab.fr> [Fri, 07 Jun 2019 14:53:03 +0200] rev 12635
Added tag 3.26.11, debian/3.26.11-1 for changeset 633ca84bea58
Denis Laxalde <denis.laxalde@logilab.fr> [Fri, 07 Jun 2019 14:52:51 +0200] rev 12634
[pkg] Version 3.26.11
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 06 Jun 2019 16:40:14 +0200] rev 12633
Added tag debian/3.26.10-1 for changeset 0ce26fb5ab48