cubicweb/web/views/isioc.py
author Philippe Pepiot <philippe.pepiot@logilab.fr>
Thu, 19 Jan 2017 15:27:39 +0100
changeset 11899 bf6106b91633
parent 11057 0b59724cb3f2
permissions -rw-r--r--
[schema] load schema from modules names instead of directories Introspect cubicweb, cubes and apphome using pkgutil to generate the full list of modules names for loading the schema. Keep historical behavior and check if source .py file exists if a module is found using python bytecode file (.pyc and .pyo) Loading schema from apphome require apphome to be present in sys.path and that "schema" module resolve to a file located in apphome. Update migraction tests to explicitely update sys.path when loading schema from different apps, use a contextmanager for this so it's more readable. Require updated logilab-common and yams
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8800
8ca1a0da5a29 [web/views] extract cube sioc (closes #1916018)
Simon Chabot <simon.chabot@logilab.fr>
parents: 8190
diff changeset
     1
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     2
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     3
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     4
# This file is part of CubicWeb.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     5
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     6
# CubicWeb is free software: you can redistribute it and/or modify it under the
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     7
# terms of the GNU Lesser General Public License as published by the Free
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     8
# Software Foundation, either version 2.1 of the License, or (at your option)
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     9
# any later version.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    10
#
5424
8ecbcbff9777 replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5421
diff changeset
    11
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    13
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    14
# details.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    15
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    16
# You should have received a copy of the GNU Lesser General Public License along
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    17
# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    18
"""Specific views for SIOC (Semantically-Interlinked Online Communities)
1547
cb8c15a1e140 backport isioc view from blog
sylvain.thenault@logilab.fr
parents:
diff changeset
    19
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    20
http://sioc-project.org
1547
cb8c15a1e140 backport isioc view from blog
sylvain.thenault@logilab.fr
parents:
diff changeset
    21
"""
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    22
8800
8ca1a0da5a29 [web/views] extract cube sioc (closes #1916018)
Simon Chabot <simon.chabot@logilab.fr>
parents: 8190
diff changeset
    23
from logilab.common.deprecation import class_moved
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    24
8800
8ca1a0da5a29 [web/views] extract cube sioc (closes #1916018)
Simon Chabot <simon.chabot@logilab.fr>
parents: 8190
diff changeset
    25
try:
8ca1a0da5a29 [web/views] extract cube sioc (closes #1916018)
Simon Chabot <simon.chabot@logilab.fr>
parents: 8190
diff changeset
    26
    from cubes.sioc.views import *
1547
cb8c15a1e140 backport isioc view from blog
sylvain.thenault@logilab.fr
parents:
diff changeset
    27
8800
8ca1a0da5a29 [web/views] extract cube sioc (closes #1916018)
Simon Chabot <simon.chabot@logilab.fr>
parents: 8190
diff changeset
    28
    ISIOCItemAdapter = class_moved(ISIOCItemAdapter, message='[3.17] ISIOCItemAdapter moved to cubes.isioc.views')
8ca1a0da5a29 [web/views] extract cube sioc (closes #1916018)
Simon Chabot <simon.chabot@logilab.fr>
parents: 8190
diff changeset
    29
    ISIOCContainerAdapter = class_moved(ISIOCContainerAdapter, message='[3.17] ISIOCContainerAdapter moved to cubes.isioc.views')
8ca1a0da5a29 [web/views] extract cube sioc (closes #1916018)
Simon Chabot <simon.chabot@logilab.fr>
parents: 8190
diff changeset
    30
    SIOCView = class_moved(SIOCView, message='[3.17] SIOCView moved to cubes.is.view')
8ca1a0da5a29 [web/views] extract cube sioc (closes #1916018)
Simon Chabot <simon.chabot@logilab.fr>
parents: 8190
diff changeset
    31
    SIOCContainerView = class_moved(SIOCContainerView, message='[3.17] SIOCContainerView moved to cubes.is.view')
8ca1a0da5a29 [web/views] extract cube sioc (closes #1916018)
Simon Chabot <simon.chabot@logilab.fr>
parents: 8190
diff changeset
    32
    SIOCItemView = class_moved(SIOCItemView, message='[3.17] SIOCItemView moved to cubes.is.view')
8ca1a0da5a29 [web/views] extract cube sioc (closes #1916018)
Simon Chabot <simon.chabot@logilab.fr>
parents: 8190
diff changeset
    33
except ImportError:
8ca1a0da5a29 [web/views] extract cube sioc (closes #1916018)
Simon Chabot <simon.chabot@logilab.fr>
parents: 8190
diff changeset
    34
    from cubicweb.web import LOGGER
8ca1a0da5a29 [web/views] extract cube sioc (closes #1916018)
Simon Chabot <simon.chabot@logilab.fr>
parents: 8190
diff changeset
    35
    LOGGER.warning('[3.17] isioc extracted to cube sioc that was not found. try installing it.')