Merge with 3.25 branch
authorDenis Laxalde <denis.laxalde@logilab.fr>
Mon, 10 Jul 2017 11:43:18 +0200
changeset 12192 cf5d11ac79fb
parent 12189 ef46695adb68 (current diff)
parent 12191 7ce838e67a61 (diff)
child 12203 c615f945b38a
Merge with 3.25 branch
cubicweb/__pkginfo__.py
--- a/.hgtags	Fri Apr 21 14:01:46 2017 +0200
+++ b/.hgtags	Mon Jul 10 11:43:18 2017 +0200
@@ -602,3 +602,6 @@
 dacc5b168e29b33515cee5940de1e392dc9d522a 3.25.0
 dacc5b168e29b33515cee5940de1e392dc9d522a debian/3.25.0-1
 dacc5b168e29b33515cee5940de1e392dc9d522a centos/3.25.0-1
+5fe62978801a4ac19cb8764812226190db12bbd7 3.25.1
+5fe62978801a4ac19cb8764812226190db12bbd7 debian/3.25.1-1
+5fe62978801a4ac19cb8764812226190db12bbd7 centos/3.25.1-1
--- a/cubicweb.spec	Fri Apr 21 14:01:46 2017 +0200
+++ b/cubicweb.spec	Mon Jul 10 11:43:18 2017 +0200
@@ -8,7 +8,7 @@
 %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
 
 Name:           cubicweb
-Version:        3.25.0
+Version:        3.25.1
 Release:        logilab.1%{?dist}
 Summary:        CubicWeb is a semantic web application framework
 Source0:        https://pypi.python.org/packages/source/c/cubicweb/cubicweb-%{version}.tar.gz
--- a/cubicweb/cwconfig.py	Fri Apr 21 14:01:46 2017 +0200
+++ b/cubicweb/cwconfig.py	Mon Jul 10 11:43:18 2017 +0200
@@ -285,12 +285,15 @@
         return 'cubes.' + cube
 
 
-def _expand_modname(modname):
-    """expand modules names `modname` if exists by walking non package submodules
-    and yield (submodname, filepath) including `modname` itself
+def _expand_modname(modname, recursive=True):
+    """expand modules names `modname` if exists by recursively walking
+    submodules and subpackages and yield (submodname, filepath) including
+    `modname` itself
 
     If the file ends with .pyc or .pyo (python bytecode) also check that the
     corresponding source .py file exists before yielding.
+
+    If `recursive` is False skip subpackages.
     """
     try:
         loader = pkgutil.find_loader(modname)
@@ -312,11 +315,14 @@
     if loader.is_package(modname):
         path = dirname(filepath)
         for subloader, subname, ispkg in pkgutil.walk_packages([path]):
-            # ignore subpackages (historical behavior)
+            submodname = '.'.join([modname, subname])
             if not ispkg:
                 filepath = subloader.find_module(subname).get_filename()
                 if check_source_file(filepath):
-                    yield modname + '.' + subname, filepath
+                    yield submodname, filepath
+            elif recursive:
+                for x in _expand_modname(submodname, recursive=True):
+                    yield x
 
 
 # persistent options definition
@@ -819,11 +825,13 @@
             modnames.append(('cubicweb', 'cubicweb.schemas.' + name))
         for cube in reversed(self.cubes()):
             for modname, filepath in _expand_modname(
-                    '{0}.schema'.format(_cube_modname(cube))):
+                    '{0}.schema'.format(_cube_modname(cube)),
+                    recursive=False):
                 modnames.append((cube, modname))
         if self.apphome:
             apphome = realpath(self.apphome)
-            for modname, filepath in _expand_modname('schema'):
+            for modname, filepath in _expand_modname(
+                    'schema', recursive=False):
                 if realpath(filepath).startswith(apphome):
                     modnames.append(('data', modname))
         return modnames
--- a/cubicweb/misc/migration/3.24.0_Any.py	Fri Apr 21 14:01:46 2017 +0200
+++ b/cubicweb/misc/migration/3.24.0_Any.py	Mon Jul 10 11:43:18 2017 +0200
@@ -8,7 +8,7 @@
     sql('UPDATE cw_{} SET cw_cwuri=%(cwuri)s WHERE cw_eid=%(eid)s'.format(etype),
         {'eid': eid, 'cwuri': b64decode(encoded_extid)})
 
-sql('DROP TABLE moved_entities')
+sql('DROP TABLE IF EXISTS moved_entities')
 sql('ALTER TABLE entities DROP COLUMN asource')
 sql('ALTER TABLE entities DROP COLUMN extid')
 sql('DROP INDEX entities_type_idx')
--- a/cubicweb/pyramid/__init__.py	Fri Apr 21 14:01:46 2017 +0200
+++ b/cubicweb/pyramid/__init__.py	Mon Jul 10 11:43:18 2017 +0200
@@ -22,6 +22,7 @@
 
 import atexit
 import os
+import warnings
 
 import wsgicors
 
@@ -240,5 +241,11 @@
 
     config.include('cubicweb.pyramid.core')
 
-    if asbool(config.registry.settings.get('cubicweb.bwcompat', True)):
-        config.include('cubicweb.pyramid.bwcompat')
+    if asbool(config.registry.settings.get('cubicweb.bwcompat',
+                                           cwconfig.name == 'all-in-one')):
+        if cwconfig.name != 'all-in-one':
+            warnings.warn('"cubicweb.bwcompat" setting only applies to '
+                          '"all-in-one" instance configuration',
+                          UserWarning)
+        else:
+            config.include('cubicweb.pyramid.bwcompat')
--- a/cubicweb/pyramid/development.ini.tmpl	Fri Apr 21 14:01:46 2017 +0200
+++ b/cubicweb/pyramid/development.ini.tmpl	Mon Jul 10 11:43:18 2017 +0200
@@ -23,7 +23,6 @@
 # http://cubicweb.readthedocs.io/en/latest/book/pyramid/settings/
 ##
 cubicweb.instance = %(instance)s
-cubicweb.bwcompat = false
 cubicweb.debug = true
 cubicweb.session.secret = %(session-secret)s
 cubicweb.auth.authtkt.persistent.secure = false
--- a/cubicweb/test/unittest_cwconfig.py	Fri Apr 21 14:01:46 2017 +0200
+++ b/cubicweb/test/unittest_cwconfig.py	Mon Jul 10 11:43:18 2017 +0200
@@ -409,20 +409,32 @@
         self.assertEqual(list(_expand_modname('lib.a')), [
             ('lib.a', join(tempdir, 'a.py')),
         ])
-        # lib.b.d (subpackage) not to be imported
+        # lib.b.d should be imported
         self.assertEqual(list(_expand_modname('lib.b')), [
             ('lib.b', join(tempdir, 'b', '__init__.py')),
             ('lib.b.a', join(tempdir, 'b', 'a.py')),
             ('lib.b.c', join(tempdir, 'b', 'c.py')),
+            ('lib.b.d', join(tempdir, 'b', 'd', '__init__.py')),
+        ])
+        # lib.b.d should not be imported without recursive mode
+        self.assertEqual(list(_expand_modname('lib.b', recursive=False)), [
+            ('lib.b', join(tempdir, 'b', '__init__.py')),
+            ('lib.b.a', join(tempdir, 'b', 'a.py')),
+            ('lib.b.c', join(tempdir, 'b', 'c.py')),
         ])
         self.assertEqual(list(_expand_modname('lib')), [
             ('lib', join(tempdir, '__init__.py')),
             ('lib.a', join(tempdir, 'a.py')),
+            ('lib.b', join(tempdir, 'b', '__init__.py')),
+            ('lib.b.a', join(tempdir, 'b', 'a.py')),
+            ('lib.b.c', join(tempdir, 'b', 'c.py')),
+            ('lib.b.d', join(tempdir, 'b', 'd', '__init__.py')),
             ('lib.c', join(tempdir, 'c.py')),
         ])
         for source in (
             join(tempdir, 'c.py'),
             join(tempdir, 'b', 'c.py'),
+            join(tempdir, 'b', 'd', '__init__.py'),
         ):
             if not PY3:
                 # ensure pyc file exists.
@@ -441,6 +453,8 @@
         self.assertEqual(list(_expand_modname('lib')), [
             ('lib', join(tempdir, '__init__.py')),
             ('lib.a', join(tempdir, 'a.py')),
+            ('lib.b', join(tempdir, 'b', '__init__.py')),
+            ('lib.b.a', join(tempdir, 'b', 'a.py')),
         ])
 
     @templibdir
@@ -451,6 +465,8 @@
             join(libdir, 'cubicweb_foo', 'schema', '__init__.py'),
             join(libdir, 'cubicweb_foo', 'schema', 'a.py'),
             join(libdir, 'cubicweb_foo', 'schema', 'b.py'),
+            # subpackages should not be loaded
+            join(libdir, 'cubicweb_foo', 'schema', 'c', '__init__.py'),
             join(libdir, 'cubes', '__init__.py'),
             join(libdir, 'cubes', 'bar', '__init__.py'),
             join(libdir, 'cubes', 'bar', 'schema.py'),
@@ -492,6 +508,10 @@
             join(libdir, 'cubicweb_foo', '__init__.py'),
             join(libdir, 'cubicweb_foo', 'entities', '__init__.py'),
             join(libdir, 'cubicweb_foo', 'entities', 'a.py'),
+            # subpackages should be loaded recursively
+            join(libdir, 'cubicweb_foo', 'entities', 'b', '__init__.py'),
+            join(libdir, 'cubicweb_foo', 'entities', 'b', 'a.py'),
+            join(libdir, 'cubicweb_foo', 'entities', 'b', 'c', '__init__.py'),
             join(libdir, 'cubicweb_foo', 'hooks.py'),
             join(libdir, 'cubes', '__init__.py'),
             join(libdir, 'cubes', 'bar', '__init__.py'),
@@ -513,6 +533,9 @@
             'cubes.bar.hooks',
             'cubicweb_foo.entities',
             'cubicweb_foo.entities.a',
+            'cubicweb_foo.entities.b',
+            'cubicweb_foo.entities.b.a',
+            'cubicweb_foo.entities.b.c',
             'cubicweb_foo.hooks',
         ]
         # data1 has entities
--- a/cubicweb/web/views/editforms.py	Fri Apr 21 14:01:46 2017 +0200
+++ b/cubicweb/web/views/editforms.py	Mon Jul 10 11:43:18 2017 +0200
@@ -77,7 +77,8 @@
 
     def _iter_composite_entities(self, entity, limit=None):
         eids = set()
-        for rdef, role in entity.e_schema.composite_rdef_roles:
+        for rdef, role in sorted(entity.e_schema.composite_rdef_roles,
+                                 key=lambda x: x[0].rtype):
             if rdef.rtype in self.show_composite_skip_rtypes:
                 continue
             for centity in entity.related(
--- a/debian/changelog	Fri Apr 21 14:01:46 2017 +0200
+++ b/debian/changelog	Mon Jul 10 11:43:18 2017 +0200
@@ -1,3 +1,9 @@
+cubicweb (3.25.1-1) unstable; urgency=medium
+
+  * New upstream release.
+
+ -- Denis Laxalde <denis.laxalde@logilab.fr>  Mon, 10 Jul 2017 11:23:14 +0200
+
 cubicweb (3.25.0-1) unstable; urgency=medium
 
   * New upstream release.
--- a/doc/book/pyramid/settings.rst	Fri Apr 21 14:01:46 2017 +0200
+++ b/doc/book/pyramid/settings.rst	Mon Jul 10 11:43:18 2017 +0200
@@ -76,7 +76,10 @@
 
 .. confval:: cubicweb.bwcompat (bool)
 
-    (True) Enable/disable backward compatibility. See :ref:`bwcompat_module`.
+    (True) Enable/disable backward compatibility. This only applies to
+    "all-in-one" configuration type.
+
+    See :ref:`bwcompat_module`.
 
 .. confval:: cubicweb.bwcompat.errorhandler (bool)
 
--- a/doc/changes/3.25.rst	Fri Apr 21 14:01:46 2017 +0200
+++ b/doc/changes/3.25.rst	Mon Jul 10 11:43:18 2017 +0200
@@ -1,5 +1,5 @@
-3.25 (UNRELEASED)
-=================
+3.25 (14 April 2017)
+====================
 
 New features
 ------------