# HG changeset patch # User Sylvain Thénault # Date 1466608390 -7200 # Node ID 179b5ff3f42855c221f9e41f7bf4eeac532b18e3 # Parent ef53a59140e1644726986b0ebc50b3f280722314 Update to yams 0.44 API diff -r ef53a59140e1 -r 179b5ff3f428 cubicweb.spec --- a/cubicweb.spec Mon Jun 20 17:56:49 2016 +0200 +++ b/cubicweb.spec Wed Jun 22 17:13:10 2016 +0200 @@ -25,7 +25,7 @@ Requires: %{python}-logilab-common >= 1.2.2 Requires: %{python}-logilab-mtconverter >= 0.8.0 Requires: %{python}-rql >= 0.34.0 -Requires: %{python}-yams >= 0.43.0 +Requires: %{python}-yams >= 0.44.0 Requires: %{python}-logilab-database >= 1.15.0 Requires: %{python}-passlib Requires: %{python}-lxml diff -r ef53a59140e1 -r 179b5ff3f428 cubicweb/__pkginfo__.py --- a/cubicweb/__pkginfo__.py Mon Jun 20 17:56:49 2016 +0200 +++ b/cubicweb/__pkginfo__.py Wed Jun 22 17:13:10 2016 +0200 @@ -48,7 +48,7 @@ 'logilab-common': '>= 1.2.2', 'logilab-mtconverter': '>= 0.8.0', 'rql': '>= 0.34.0', - 'yams': '>= 0.43.0', + 'yams': '>= 0.44.0', #gettext # for xgettext, msgcat, etc... # web dependencies 'lxml': '', diff -r ef53a59140e1 -r 179b5ff3f428 cubicweb/entities/adapters.py --- a/cubicweb/entities/adapters.py Mon Jun 20 17:56:49 2016 +0200 +++ b/cubicweb/entities/adapters.py Wed Jun 22 17:13:10 2016 +0200 @@ -427,5 +427,6 @@ # constraint between two attributes). This should be the purpose of an api rework at some # point, we currently rely on the fact that such constraint will provide a dedicated user # message not relying on the `value` argument - msg, args = constraint.failed_message(key, self.entity.cw_edited.get(rschema.type)) + value = self.entity.cw_edited.get(rschema.type) + msg, args = constraint.failed_message(key, value, self.entity) raise ValidationError(self.entity.eid, {key: msg}, args) diff -r ef53a59140e1 -r 179b5ff3f428 cubicweb/hooks/test/unittest_syncschema.py --- a/cubicweb/hooks/test/unittest_syncschema.py Mon Jun 20 17:56:49 2016 +0200 +++ b/cubicweb/hooks/test/unittest_syncschema.py Wed Jun 22 17:13:10 2016 +0200 @@ -274,7 +274,8 @@ def test_unique_change(self): with self.admin_access.repo_cnx() as cnx: try: - eid = cnx.execute('INSERT CWConstraint X: X cstrtype CT, DEF constrained_by X ' + eid = cnx.execute('INSERT CWConstraint X: X cstrtype CT, X value "{}", ' + ' DEF constrained_by X ' 'WHERE CT name "UniqueConstraint", DEF relation_type RT, ' 'DEF from_entity E, RT name "name", ' 'E name "Workflow"').rows[0][0] diff -r ef53a59140e1 -r 179b5ff3f428 cubicweb/server/test/unittest_schema2sql.py --- a/cubicweb/server/test/unittest_schema2sql.py Mon Jun 20 17:56:49 2016 +0200 +++ b/cubicweb/server/test/unittest_schema2sql.py Wed Jun 22 17:13:10 2016 +0200 @@ -52,7 +52,7 @@ d2 date, t1 time, t2 time -, CONSTRAINT cstr67c656afbcbfadd4be34d75656a2521a CHECK(d1 <= CAST(clock_timestamp() AS DATE)) +, CONSTRAINT cstrf6a3dad792ba13c2cddcf61a2b737c00 CHECK(d1 <= CAST(clock_timestamp() AS DATE)) ); CREATE TABLE Division( @@ -97,7 +97,7 @@ datenaiss date, test boolean, salary float -, CONSTRAINT cstrdedefafc86dc831341c33547388c25bb CHECK(promo IN ('bon', 'pasbon')) +, CONSTRAINT cstr151c2116c0c09de13fded0619d5b4aac CHECK(promo IN ('bon', 'pasbon')) ); CREATE UNIQUE INDEX unique_e6c2d219772dbf1715597f7d9a6b3892 ON Person(nom,prenom); @@ -115,7 +115,7 @@ datenaiss date, test boolean, salary float -, CONSTRAINT cstrb62a1623de9e9b92eb552706b6ce0890 CHECK(promo IN ('bon', 'pasbon')) +, CONSTRAINT cstr069569cf1791dba1a2726197c53aeb44 CHECK(promo IN ('bon', 'pasbon')) ); CREATE UNIQUE INDEX unique_98da0f9de8588baa8966f0b1a6f850a3 ON Salaried(nom,prenom); @@ -130,7 +130,7 @@ ad3 varchar(128), cp varchar(12), ville varchar(32) -, CONSTRAINT cstraf91cb60287eec6d5c1175075edcccc0 CHECK(fax <= tel) +, CONSTRAINT cstra0a1deaa997dcd5f9b83a77654d7c287 CHECK(fax <= tel) ); CREATE TABLE State( @@ -159,8 +159,8 @@ author_email varchar(100) NOT NULL, mailinglist varchar(100), debian_handler varchar(6) -, CONSTRAINT cstree063a486aa92d4f721ced56c819f38a CHECK(license IN ('GPL', 'ZPL')) -, CONSTRAINT cstrafb4b6de5d50b5a2eca60b33b7acf59b CHECK(debian_handler IN ('machin', 'bidule')) +, CONSTRAINT cstrbffed5ce7306d65a0db51182febd4a7b CHECK(license IN ('GPL', 'ZPL')) +, CONSTRAINT cstr2238b33d09bf7c441e0888be354c2444 CHECK(debian_handler IN ('machin', 'bidule')) ); diff -r ef53a59140e1 -r 179b5ff3f428 cubicweb/server/test/unittest_schemaserial.py --- a/cubicweb/server/test/unittest_schemaserial.py Mon Jun 20 17:56:49 2016 +0200 +++ b/cubicweb/server/test/unittest_schemaserial.py Wed Jun 22 17:13:10 2016 +0200 @@ -235,12 +235,12 @@ 'WHERE CT eid %(ct)s, EDEF eid %(x)s', {'x': None, 'ct': u'SizeConstraint_eid', - 'value': u'{"max": 2, "min": null}'}), + 'value': u'{"max": 2, "min": null, "msg": null}'}), ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' 'WHERE CT eid %(ct)s, EDEF eid %(x)s', {'x': None, 'ct': u'StaticVocabularyConstraint_eid', - 'value': u'["?1", "11"]'}), + 'value': u'{"msg": null, "values": ["?1", "11"]}'}), ('INSERT CWAttribute X: X cardinality %(cardinality)s,X defaultval %(defaultval)s,' 'X description %(description)s,X formula %(formula)s,X fulltextindexed %(fulltextindexed)s,' @@ -262,13 +262,13 @@ 'WHERE CT eid %(ct)s, EDEF eid %(x)s', {'x': None, 'ct': u'SizeConstraint_eid', - 'value': u'{"max": 2, "min": null}'}), + 'value': u'{"max": 2, "min": null, "msg": null}'}), ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' 'WHERE CT eid %(ct)s, EDEF eid %(x)s', {'x': None, 'ct': u'StaticVocabularyConstraint_eid', - "value": (u'["?*", "1*", "+*", "**", "?+", "1+", "++", "*+", "?1", ' - u'"11", "+1", "*1", "??", "1?", "+?", "*?"]')})], + "value": (u'{"msg": null, "values": ["?*", "1*", "+*", "**", "?+", "1+", "++", "*+", "?1", ' + u'"11", "+1", "*1", "??", "1?", "+?", "*?"]}')})], list(rschema2rql(schema.rschema('cardinality'), cstrtypemap))) def test_rschema2rql_custom_type(self): @@ -328,12 +328,13 @@ ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' 'WHERE CT eid %(ct)s, EDEF eid %(x)s', {'x': None, - 'value': u'None', + 'value': u'{"msg": null, "values": ["text/rest", "text/markdown", ' + '"text/html", "text/plain"]}', 'ct': 'FormatConstraint_eid'}), ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' 'WHERE CT eid %(ct)s, EDEF eid %(x)s', {'x': None, - 'value': u'{"max": 50, "min": null}', + 'value': u'{"max": 50, "min": null, "msg": null}', 'ct': 'SizeConstraint_eid'})], list(rdef2rql(schema['description_format'].rdefs[('CWRType', 'String')], cstrtypemap))) diff -r ef53a59140e1 -r 179b5ff3f428 debian/control --- a/debian/control Mon Jun 20 17:56:49 2016 +0200 +++ b/debian/control Wed Jun 22 17:13:10 2016 +0200 @@ -16,7 +16,7 @@ python-markdown, python-tz, python-rql (>= 0.34.0), - python-yams (>= 0.43.0), + python-yams (>= 0.44.0), python-lxml, Standards-Version: 3.9.1 Homepage: https://www.cubicweb.org diff -r ef53a59140e1 -r 179b5ff3f428 dev-requirements.txt --- a/dev-requirements.txt Mon Jun 20 17:56:49 2016 +0200 +++ b/dev-requirements.txt Wed Jun 22 17:13:10 2016 +0200 @@ -1,1 +1,2 @@ pytest +hg+http://hg.logilab.org/master/yams#egg=yams