merge changes from 3.22.2
authorJulien Cristau <julien.cristau@logilab.fr>
Tue, 23 Feb 2016 12:18:47 +0100
changeset 11151 4259c55df3e7
parent 11144 fd8bf29ed00e (current diff)
parent 11150 6f0c9d5c2f85 (diff)
child 11152 fccc6ddd975c
merge changes from 3.22.2
cubicweb/__pkginfo__.py
cubicweb/schema.py
cubicweb/server/schemaserial.py
cubicweb/server/sources/datafeed.py
cubicweb/web/test/unittest_views_editforms.py
cubicweb/web/views/autoform.py
debian/control
--- a/.hgtags	Tue Dec 22 09:23:00 2015 +0100
+++ b/.hgtags	Tue Feb 23 12:18:47 2016 +0100
@@ -545,3 +545,6 @@
 d0d86803a804854be0a1b2d49079a94d1c193ee9 3.22.1
 d0d86803a804854be0a1b2d49079a94d1c193ee9 debian/3.22.1-1
 d0d86803a804854be0a1b2d49079a94d1c193ee9 centos/3.22.1-1
+1b93ff37755b0588081f6fcb93da0dde772a6adb 3.22.2
+1b93ff37755b0588081f6fcb93da0dde772a6adb debian/3.22.2-1
+1b93ff37755b0588081f6fcb93da0dde772a6adb centos/3.22.2-1
--- a/README	Tue Dec 22 09:23:00 2015 +0100
+++ b/README	Tue Feb 23 12:18:47 2016 +0100
@@ -14,7 +14,7 @@
 Install
 -------
 
-More details at http://docs.cubicweb.org/book/admin/setup
+More details at https://docs.cubicweb.org/book/admin/setup
 
 Getting started
 ---------------
@@ -26,12 +26,12 @@
  cubicweb-ctl start -D myblog
  sensible-browser http://localhost:8080/
 
-Details at http://docs.cubicweb.org/tutorials/base/blog-in-five-minutes
+Details at https://docs.cubicweb.org/tutorials/base/blog-in-five-minutes
 
 Documentation
 -------------
 
-Look in the doc/ subdirectory or read http://docs.cubicweb.org/
+Look in the doc/ subdirectory or read https://docs.cubicweb.org/
 
 
-It includes the Entypo pictograms by Daniel Bruce — www.entypo.com
+CubicWeb includes the Entypo pictograms by Daniel Bruce — www.entypo.com
--- a/cubicweb.spec	Tue Dec 22 09:23:00 2015 +0100
+++ b/cubicweb.spec	Tue Feb 23 12:18:47 2016 +0100
@@ -8,14 +8,14 @@
 %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
 
 Name:           cubicweb
-Version:        3.22.1
+Version:        3.22.2
 Release:        logilab.1%{?dist}
 Summary:        CubicWeb is a semantic web application framework
-Source0:        http://download.logilab.org/pub/cubicweb/cubicweb-%{version}.tar.gz
+Source0:        https://pypi.python.org/packages/source/c/cubicweb/cubicweb-%{version}.tar.gz
 License:        LGPLv2+
 Group:          Development/Languages/Python
 Vendor:         Logilab <contact@logilab.fr>
-Url:            http://www.cubicweb.org/project/cubicweb
+Url:            https://www.cubicweb.org/project/cubicweb
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
 BuildArch:      noarch
@@ -58,6 +58,6 @@
 %files 
 %defattr(-, root, root)
 %dir /var/log/cubicweb
-%{_prefix}/share/cubicweb
-%{python_sitelib}
-%{_bindir}
+%{_prefix}/share/cubicweb/*
+%{python_sitelib}/*
+%{_bindir}/*
--- a/cubicweb/__pkginfo__.py	Tue Dec 22 09:23:00 2015 +0100
+++ b/cubicweb/__pkginfo__.py	Tue Feb 23 12:18:47 2016 +0100
@@ -22,13 +22,13 @@
 
 modname = distname = "cubicweb"
 
-numversion = (3, 22, 1)
+numversion = (3, 22, 2)
 version = '.'.join(str(num) for num in numversion)
 
 description = "a repository of entities / relations for knowledge management"
 author = "Logilab"
 author_email = "contact@logilab.fr"
-web = 'http://www.cubicweb.org'
+web = 'https://www.cubicweb.org'
 license = 'LGPL'
 
 classifiers = [
--- a/cubicweb/schema.py	Tue Dec 22 09:23:00 2015 +0100
+++ b/cubicweb/schema.py	Tue Feb 23 12:18:47 2016 +0100
@@ -1140,12 +1140,6 @@
 
 # additional cw specific constraints ###########################################
 
-# these are implemented as CHECK constraints in sql, don't do the work
-# twice
-StaticVocabularyConstraint.check = lambda *args: True
-IntervalBoundConstraint.check = lambda *args: True
-BoundaryConstraint.check = lambda *args: True
-
 class BaseRQLConstraint(RRQLExpression, BaseConstraint):
     """base class for rql constraints"""
     distinct_query = None
--- a/cubicweb/server/schemaserial.py	Tue Dec 22 09:23:00 2015 +0100
+++ b/cubicweb/server/schemaserial.py	Tue Feb 23 12:18:47 2016 +0100
@@ -23,12 +23,13 @@
 import os
 import json
 import sys
+import sqlite3
 
 from six import PY2, text_type, string_types
 
 from logilab.common.shellutils import ProgressBar, DummyProgressBar
 
-from yams import BadSchemaDefinition, schema as schemamod, buildobjs as ybo
+from yams import BadSchemaDefinition, schema as schemamod, buildobjs as ybo, constraints
 
 from cubicweb import Binary
 from cubicweb.schema import (KNOWN_RPROPERTIES, CONSTRAINTS, ETYPE_NAME_MAP,
@@ -312,12 +313,20 @@
             res.setdefault(eid, {}).setdefault(action, []).append( (expr, mainvars, expreid) )
     return res
 
+
 def deserialize_rdef_constraints(cnx):
     """return the list of relation definition's constraints as instances"""
+    if cnx.repo.system_source.dbdriver != 'sqlite' or sqlite3.sqlite_version_info >= (3, 7, 12):
+            # these are implemented as CHECK constraints in sql, don't do the work twice. Unless we
+            # are using too old version of sqlite which misses the constraint name in the integrity
+            # error so we've to check them by ourselves anyway
+            constraints.StaticVocabularyConstraint.check = lambda *args: True
+            constraints.IntervalBoundConstraint.check = lambda *args: True
+            constraints.BoundaryConstraint.check = lambda *args: True
     res = {}
     for rdefeid, ceid, ct, val in cnx.execute(
-        'Any E, X,TN,V WHERE E constrained_by X, X is CWConstraint, '
-        'X cstrtype T, T name TN, X value V', build_descr=False):
+            'Any E, X,TN,V WHERE E constrained_by X, X is CWConstraint, '
+            'X cstrtype T, T name TN, X value V', build_descr=False):
         cstr = CONSTRAINTS[ct].deserialize(val)
         cstr.eid = ceid
         res.setdefault(rdefeid, []).append(cstr)
--- a/cubicweb/server/sources/datafeed.py	Tue Dec 22 09:23:00 2015 +0100
+++ b/cubicweb/server/sources/datafeed.py	Tue Feb 23 12:18:47 2016 +0100
@@ -521,23 +521,9 @@
                 raise
             self.import_log.record_error(str(ex))
             return True
-        error = False
-        commit = self._cw.commit
-        rollback = self._cw.rollback
         for args in parsed:
-            try:
-                self.process_item(*args, raise_on_error=raise_on_error)
-                # commit+set_cnxset instead of commit(free_cnxset=False) to let
-                # other a chance to get our connections set
-                commit()
-            except ValidationError as exc:
-                if raise_on_error:
-                    raise
-                self.source.error('Skipping %s because of validation error %s'
-                                  % (args, exc))
-                rollback()
-                error = True
-        return error
+            self.process_item(*args, raise_on_error=raise_on_error)
+        return False
 
     def parse(self, url):
         stream = self.retrieve_url(url)
--- a/cubicweb/web/test/unittest_views_editforms.py	Tue Dec 22 09:23:00 2015 +0100
+++ b/cubicweb/web/test/unittest_views_editforms.py	Tue Feb 23 12:18:47 2016 +0100
@@ -198,6 +198,13 @@
                     formviews = list(form.inlined_form_views())
                     self.assertEqual(len(formviews), 1, formviews)
                     self.assertIsInstance(formviews[0], autoform.InlineAddNewLinkView)
+            # though do not introduce regression on entity creation with 1 cardinality relation
+            with tempattr(use_email_schema, 'cardinality', '11'):
+                user = self.vreg['etypes'].etype_class('CWUser')(req)
+                form = self.vreg['forms'].select('edition', req, entity=user)
+                formviews = list(form.inlined_form_views())
+                self.assertEqual(len(formviews), 1, formviews)
+                self.assertIsInstance(formviews[0], autoform.InlineEntityCreationFormView)
 
     def test_check_inlined_rdef_permissions(self):
         # try to check permissions when creating an entity ('user' below is a
--- a/cubicweb/web/views/autoform.py	Tue Dec 22 09:23:00 2015 +0100
+++ b/cubicweb/web/views/autoform.py	Tue Feb 23 12:18:47 2016 +0100
@@ -899,13 +899,13 @@
             ttype = tschema.type
             formviews = list(self.inline_edition_form_view(rschema, ttype, role))
             card = rschema.role_rdef(entity.e_schema, ttype, role).role_cardinality(role)
-            related = entity.has_eid() and entity.related(rschema, role)
-            if self.should_display_inline_creation_form(rschema, related, card):
+            existing = entity.related(rschema, role) if entity.has_eid() else formviews
+            if self.should_display_inline_creation_form(rschema, existing, card):
                 formviews += self.inline_creation_form_view(rschema, ttype, role)
             # we can create more than one related entity, we thus display a link
             # to add new related entities
             if self.must_display_add_new_relation_link(rschema, role, tschema,
-                                                       ttype, related, card):
+                                                       ttype, existing, card):
                 addnewlink = self._cw.vreg['views'].select(
                     'inline-addnew-link', self._cw,
                     etype=ttype, rtype=rschema, role=role, card=card,
@@ -915,24 +915,24 @@
             allformviews += formviews
         return allformviews
 
-    def should_display_inline_creation_form(self, rschema, existant, card):
+    def should_display_inline_creation_form(self, rschema, existing, card):
         """return true if a creation form should be inlined
 
         by default true if there is no related entity and we need at least one
         """
-        return not existant and card in '1+'
+        return not existing and card in '1+'
 
-    def should_display_add_new_relation_link(self, rschema, existant, card):
+    def should_display_add_new_relation_link(self, rschema, existing, card):
         """return true if we should add a link to add a new creation form
         (through ajax call)
 
         by default true if there is no related entity or if the relation has
         multiple cardinality
         """
-        return not existant or card in '+*'
+        return not existing or card in '+*'
 
     def must_display_add_new_relation_link(self, rschema, role, tschema,
-                                           ttype, existant, card):
+                                           ttype, existing, card):
         """return true if we must add a link to add a new creation form
         (through ajax call)
 
@@ -941,7 +941,7 @@
         relation.
         """
         return (self.should_display_add_new_relation_link(
-                    rschema, existant, card) and
+                    rschema, existing, card) and
                 self.check_inlined_rdef_permissions(
                     rschema, role, tschema, ttype))
 
--- a/debian/changelog	Tue Dec 22 09:23:00 2015 +0100
+++ b/debian/changelog	Tue Feb 23 12:18:47 2016 +0100
@@ -1,3 +1,9 @@
+cubicweb (3.22.2-1) unstable; urgency=medium
+
+  * new upstream release
+
+ -- Julien Cristau <julien.cristau@logilab.fr>  Tue, 23 Feb 2016 11:45:38 +0100
+
 cubicweb (3.22.1-1) unstable; urgency=medium
 
   * new upstream release
--- a/debian/control	Tue Dec 22 09:23:00 2015 +0100
+++ b/debian/control	Tue Feb 23 12:18:47 2016 +0100
@@ -19,7 +19,7 @@
  python-yams (>= 0.42.0),
  python-lxml,
 Standards-Version: 3.9.1
-Homepage: http://www.cubicweb.org
+Homepage: https://www.cubicweb.org
 X-Python-Version: >= 2.6
 
 Package: cubicweb
--- a/debian/watch	Tue Dec 22 09:23:00 2015 +0100
+++ b/debian/watch	Tue Feb 23 12:18:47 2016 +0100
@@ -1,3 +1,3 @@
 version=3
 opts=uversionmangle=s/(rc|a|b|c)/~$1/ \
-http://pypi.debian.net/cubicweb/cubicweb-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
+https://pypi.debian.net/cubicweb/cubicweb-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))