[source] Drop source mapping handling
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 06 Oct 2016 12:11:23 +0200
changeset 11775 39cf9e55ada8
parent 11774 51c160677afe
child 11776 b49684ddd543
[source] Drop source mapping handling It was only used by the cwxmlparser which has been deleted. This is too complex for litle benefit, we don't want to maintain that in cubicweb.
cubicweb/entities/sources.py
cubicweb/hooks/syncsources.py
cubicweb/misc/migration/3.11.0_Any.py
cubicweb/misc/migration/3.13.3_Any.py
cubicweb/misc/migration/3.13.6_Any.py
cubicweb/misc/migration/3.24.0_Any.py
cubicweb/schema.py
cubicweb/schemas/base.py
cubicweb/server/sources/__init__.py
cubicweb/server/sources/datafeed.py
cubicweb/server/test/unittest_rql2sql.py
cubicweb/test/data_schemareader/schema.py
cubicweb/test/unittest_schema.py
cubicweb/web/views/cwsources.py
--- a/cubicweb/entities/sources.py	Wed Oct 05 15:30:10 2016 +0200
+++ b/cubicweb/entities/sources.py	Thu Oct 06 12:11:23 2016 +0200
@@ -71,32 +71,6 @@
     def host_configs(self):
         return self.reverse_cw_host_config_of
 
-    def init_mapping(self, mapping):
-        for key, options in mapping:
-            if isinstance(key, tuple): # relation definition
-                assert len(key) == 3
-                restrictions = ['X relation_type RT, RT name %(rt)s']
-                kwargs = {'rt': key[1]}
-                if key[0] != '*':
-                    restrictions.append('X from_entity FT, FT name %(ft)s')
-                    kwargs['ft'] = key[0]
-                if key[2] != '*':
-                    restrictions.append('X to_entity TT, TT name %(tt)s')
-                    kwargs['tt'] = key[2]
-                rql = 'Any X WHERE %s' % ','.join(restrictions)
-                schemarset = self._cw.execute(rql, kwargs)
-            elif key[0].isupper(): # entity type
-                schemarset = self._cw.execute('CWEType X WHERE X name %(et)s',
-                                              {'et': key})
-            else: # relation type
-                schemarset = self._cw.execute('CWRType X WHERE X name %(rt)s',
-                                              {'rt': key})
-            for schemaentity in schemarset.entities():
-                self._cw.create_entity('CWSourceSchemaConfig',
-                                       cw_for_source=self,
-                                       cw_schema=schemaentity,
-                                       options=options)
-
     @property
     def repo_source(self):
         """repository only property, not available from the web side (eg
@@ -117,22 +91,6 @@
         return re.match(self.match_host, hostname)
 
 
-class CWSourceSchemaConfig(AnyEntity):
-    __regid__ = 'CWSourceSchemaConfig'
-    fetch_attrs, cw_fetch_order = fetch_config(['cw_for_source', 'cw_schema', 'options'])
-
-    def dc_title(self):
-        return self._cw._(self.cw_etype) + ' #%s' % self.eid
-
-    @property
-    def schema(self):
-        return self.cw_schema[0]
-
-    @property
-    def cwsource(self):
-        return self.cw_for_source[0]
-
-
 class CWDataImport(AnyEntity):
     __regid__ = 'CWDataImport'
     repo_source = _logs = None # please pylint
--- a/cubicweb/hooks/syncsources.py	Wed Oct 05 15:30:10 2016 +0200
+++ b/cubicweb/hooks/syncsources.py	Thu Oct 06 12:11:23 2016 +0200
@@ -135,68 +135,3 @@
             except IndexError:
                 # XXX no source linked to the host config yet
                 pass
-
-
-# source mapping synchronization ###############################################
-#
-# Expect cw_for_source/cw_schema are immutable relations (i.e. can't change from
-# a source or schema to another).
-
-class SourceMappingImmutableHook(SourceHook):
-    """check cw_for_source and cw_schema are immutable relations
-
-    XXX empty delete perms would be enough?
-    """
-    __regid__ = 'cw.sources.mapping.immutable'
-    __select__ = SourceHook.__select__ & hook.match_rtype('cw_for_source', 'cw_schema')
-    events = ('before_add_relation',)
-    def __call__(self):
-        if not self._cw.added_in_transaction(self.eidfrom):
-            msg = _("You can't change this relation")
-            raise validation_error(self.eidfrom, {self.rtype: msg})
-
-
-class SourceMappingChangedOp(hook.DataOperationMixIn, hook.Operation):
-    def check_or_update(self, checkonly):
-        cnx = self.cnx
-        # take care, can't call get_data() twice
-        try:
-            data = self.__data
-        except AttributeError:
-            data = self.__data = self.get_data()
-        for schemacfg, source in data:
-            if source is None:
-                source = schemacfg.cwsource.repo_source
-            if cnx.added_in_transaction(schemacfg.eid):
-                if not cnx.deleted_in_transaction(schemacfg.eid):
-                    source.add_schema_config(schemacfg, checkonly=checkonly)
-            elif cnx.deleted_in_transaction(schemacfg.eid):
-                source.del_schema_config(schemacfg, checkonly=checkonly)
-            else:
-                source.update_schema_config(schemacfg, checkonly=checkonly)
-
-    def precommit_event(self):
-        self.check_or_update(True)
-
-    def postcommit_event(self):
-        self.check_or_update(False)
-
-
-class SourceMappingChangedHook(SourceHook):
-    __regid__ = 'cw.sources.schemaconfig'
-    __select__ = SourceHook.__select__ & is_instance('CWSourceSchemaConfig')
-    events = ('after_add_entity', 'after_update_entity')
-    def __call__(self):
-        if self.event == 'after_add_entity' or (
-            self.event == 'after_update_entity' and 'options' in self.entity.cw_edited):
-            SourceMappingChangedOp.get_instance(self._cw).add_data(
-                (self.entity, None) )
-
-class SourceMappingDeleteHook(SourceHook):
-    __regid__ = 'cw.sources.delschemaconfig'
-    __select__ = SourceHook.__select__ & hook.match_rtype('cw_for_source')
-    events = ('before_delete_relation',)
-    def __call__(self):
-        SourceMappingChangedOp.get_instance(self._cw).add_data(
-            (self._cw.entity_from_eid(self.eidfrom),
-             self._cw.entity_from_eid(self.eidto).repo_source) )
--- a/cubicweb/misc/migration/3.11.0_Any.py	Wed Oct 05 15:30:10 2016 +0200
+++ b/cubicweb/misc/migration/3.11.0_Any.py	Thu Oct 06 12:11:23 2016 +0200
@@ -1,8 +1,6 @@
 for rtype in ('cw_support', 'cw_dont_cross', 'cw_may_cross'):
     drop_relation_type(rtype)
 
-add_entity_type('CWSourceSchemaConfig')
-
 if not 'url' in schema['CWSource'].subjrels:
     add_attribute('CWSource', 'url')
     add_attribute('CWSource', 'parser')
--- a/cubicweb/misc/migration/3.13.3_Any.py	Wed Oct 05 15:30:10 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-drop_relation_definition('CWSourceSchemaConfig', 'cw_schema', 'CWAttribute')
-sync_schema_props_perms('cw_schema')
--- a/cubicweb/misc/migration/3.13.6_Any.py	Wed Oct 05 15:30:10 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-sync_schema_props_perms('CWSourceSchemaConfig')
--- a/cubicweb/misc/migration/3.24.0_Any.py	Wed Oct 05 15:30:10 2016 +0200
+++ b/cubicweb/misc/migration/3.24.0_Any.py	Thu Oct 06 12:11:23 2016 +0200
@@ -6,3 +6,5 @@
 sql('DROP TABLE moved_entities')
 sql('ALTER TABLE entities DROP COLUMN asource')
 sql('ALTER TABLE entities DROP COLUMN extid')
+
+drop_entity_type('CWSourceSchemaConfig')
--- a/cubicweb/schema.py	Wed Oct 05 15:30:10 2016 +0200
+++ b/cubicweb/schema.py	Thu Oct 06 12:11:23 2016 +0200
@@ -71,7 +71,7 @@
 SYSTEM_RTYPES = set(('in_group', 'require_group',
                      # cwproperty
                      'for_user',
-                     'cw_schema', 'cw_import_of', 'cw_for_source',
+                     'cw_import_of',
                      'cw_host_config_of',
                      )) | WORKFLOW_RTYPES
 NO_I18NCONTEXT = META_RTYPES | WORKFLOW_RTYPES
@@ -96,8 +96,7 @@
                       'SubWorkflowExitPoint'))
 
 INTERNAL_TYPES = set(('CWProperty', 'CWCache', 'ExternalUri', 'CWDataImport',
-                      'CWSource', 'CWSourceHostConfig', 'CWSourceSchemaConfig',
-                      'CWSession'))
+                      'CWSource', 'CWSourceHostConfig', 'CWSession'))
 
 UNIQUE_CONSTRAINTS = ('SizeConstraint', 'FormatConstraint',
                       'StaticVocabularyConstraint',
--- a/cubicweb/schemas/base.py	Wed Oct 05 15:30:10 2016 +0200
+++ b/cubicweb/schemas/base.py	Thu Oct 06 12:11:23 2016 +0200
@@ -328,33 +328,6 @@
     composite = 'object'
 
 
-class CWSourceSchemaConfig(EntityType):
-    __permissions__ = ENTITY_MANAGERS_PERMISSIONS
-    cw_for_source = SubjectRelation(
-        'CWSource', inlined=True, cardinality='1*', composite='object',
-        __permissions__=RELATION_MANAGERS_PERMISSIONS)
-    options = String(description=_('allowed options depends on the source type'))
-
-
-class rtype_cw_schema(RelationDefinition):
-    __permissions__ = RELATION_MANAGERS_PERMISSIONS
-    name = 'cw_schema'
-    subject = 'CWSourceSchemaConfig'
-    object = ('CWEType', 'CWRType')
-    inlined = True
-    cardinality = '1*'
-    composite = 'object'
-    constraints = [RQLConstraint('NOT O final TRUE')]
-
-class rdef_cw_schema(RelationDefinition):
-    __permissions__ = RELATION_MANAGERS_PERMISSIONS
-    name = 'cw_schema'
-    subject = 'CWSourceSchemaConfig'
-    object = 'CWRelation'
-    inlined = True
-    cardinality = '1*'
-    composite = 'object'
-
 # "abtract" relation types, no definition in cubicweb itself ###################
 
 class identical_to(RelationType):
--- a/cubicweb/server/sources/__init__.py	Wed Oct 05 15:30:10 2016 +0200
+++ b/cubicweb/server/sources/__init__.py	Thu Oct 06 12:11:23 2016 +0200
@@ -244,33 +244,6 @@
         """clear potential caches for the given eid"""
         pass
 
-    # external source api ######################################################
-
-    def _load_mapping(self, cnx, **kwargs):
-        if not 'CWSourceSchemaConfig' in self.schema:
-            self.warning('instance is not mapping ready')
-            return
-        for schemacfg in cnx.execute(
-            'Any CFG,CFGO,S WHERE '
-            'CFG options CFGO, CFG cw_schema S, '
-            'CFG cw_for_source X, X eid %(x)s', {'x': self.eid}).entities():
-            self.add_schema_config(schemacfg, **kwargs)
-
-    def add_schema_config(self, schemacfg, checkonly=False):
-        """added CWSourceSchemaConfig, modify mapping accordingly"""
-        msg = schemacfg._cw._("this source doesn't use a mapping")
-        raise ValidationError(schemacfg.eid, {None: msg})
-
-    def del_schema_config(self, schemacfg, checkonly=False):
-        """deleted CWSourceSchemaConfig, modify mapping accordingly"""
-        msg = schemacfg._cw._("this source doesn't use a mapping")
-        raise ValidationError(schemacfg.eid, {None: msg})
-
-    def update_schema_config(self, schemacfg, checkonly=False):
-        """updated CWSourceSchemaConfig, modify mapping accordingly"""
-        self.del_schema_config(schemacfg, checkonly)
-        self.add_schema_config(schemacfg, checkonly)
-
     # user authentication api ##################################################
 
     def authenticate(self, cnx, login, **kwargs):
--- a/cubicweb/server/sources/datafeed.py	Wed Oct 05 15:30:10 2016 +0200
+++ b/cubicweb/server/sources/datafeed.py	Thu Oct 06 12:11:23 2016 +0200
@@ -130,7 +130,6 @@
     def init(self, activated, source_entity):
         super(DataFeedSource, self).init(activated, source_entity)
         self.parser_id = source_entity.parser
-        self.load_mapping(source_entity._cw)
 
     def _get_parser(self, cnx, **kwargs):
         if self.parser_id is None:
@@ -139,27 +138,6 @@
         return self.repo.vreg['parsers'].select(
             self.parser_id, cnx, source=self, **kwargs)
 
-    def load_mapping(self, cnx):
-        self.mapping = {}
-        self.mapping_idx = {}
-        try:
-            parser = self._get_parser(cnx)
-        except (RegistryNotFound, ObjectNotFound):
-            return # no parser yet, don't go further
-        self._load_mapping(cnx, parser=parser)
-
-    def add_schema_config(self, schemacfg, checkonly=False, parser=None):
-        """added CWSourceSchemaConfig, modify mapping accordingly"""
-        if parser is None:
-            parser = self._get_parser(schemacfg._cw)
-        parser.add_schema_config(schemacfg, checkonly)
-
-    def del_schema_config(self, schemacfg, checkonly=False, parser=None):
-        """deleted CWSourceSchemaConfig, modify mapping accordingly"""
-        if parser is None:
-            parser = self._get_parser(schemacfg._cw)
-        parser.del_schema_config(schemacfg, checkonly)
-
     def fresh(self):
         if self.latest_retrieval is None:
             return False
@@ -330,16 +308,6 @@
         # url is probably plain content
         return URLLibResponseAdapter(BytesIO(url.encode('ascii')), url)
 
-    def add_schema_config(self, schemacfg, checkonly=False):
-        """added CWSourceSchemaConfig, modify mapping accordingly"""
-        msg = schemacfg._cw._("this parser doesn't use a mapping")
-        raise ValidationError(schemacfg.eid, {None: msg})
-
-    def del_schema_config(self, schemacfg, checkonly=False):
-        """deleted CWSourceSchemaConfig, modify mapping accordingly"""
-        msg = schemacfg._cw._("this parser doesn't use a mapping")
-        raise ValidationError(schemacfg.eid, {None: msg})
-
     def process_urls(self, urls, raise_on_error=False):
         error = False
         for url in urls:
--- a/cubicweb/server/test/unittest_rql2sql.py	Wed Oct 05 15:30:10 2016 +0200
+++ b/cubicweb/server/test/unittest_rql2sql.py	Thu Oct 06 12:11:23 2016 +0200
@@ -593,13 +593,13 @@
 
     # Test for https://www.cubicweb.org/ticket/5503548
     ('''Any X
-        WHERE X is CWSourceSchemaConfig,
+        WHERE X is Card,
         EXISTS(X created_by U, U login L),
-        X cw_schema X_CW_SCHEMA,
+        X multisource_inlined_rel X_CW_SCHEMA,
         X owned_by X_OWNED_BY?
     ''', '''SELECT _X.cw_eid
-FROM cw_CWSourceSchemaConfig AS _X LEFT OUTER JOIN owned_by_relation AS rel_owned_by1 ON (rel_owned_by1.eid_from=_X.cw_eid)
-WHERE EXISTS(SELECT 1 FROM created_by_relation AS rel_created_by0, cw_CWUser AS _U WHERE rel_created_by0.eid_from=_X.cw_eid AND rel_created_by0.eid_to=_U.cw_eid) AND _X.cw_cw_schema IS NOT NULL
+FROM cw_Card AS _X LEFT OUTER JOIN owned_by_relation AS rel_owned_by1 ON (rel_owned_by1.eid_from=_X.cw_eid)
+WHERE EXISTS(SELECT 1 FROM created_by_relation AS rel_created_by0, cw_CWUser AS _U WHERE rel_created_by0.eid_from=_X.cw_eid AND rel_created_by0.eid_to=_U.cw_eid) AND _X.cw_multisource_inlined_rel IS NOT NULL
 '''),
 
     ('Any X WHERE EXISTS(X in_state S, S name "state name"), X is in (Affaire, Note)',
--- a/cubicweb/test/data_schemareader/schema.py	Wed Oct 05 15:30:10 2016 +0200
+++ b/cubicweb/test/data_schemareader/schema.py	Thu Oct 06 12:11:23 2016 +0200
@@ -1,8 +1,16 @@
-from cubicweb.schemas.base import in_group, CWSourceSchemaConfig
+from yams.buildobjs import EntityType, SubjectRelation
+from cubicweb.schemas.base import in_group, RELATION_MANAGERS_PERMISSIONS
+
 # copy __permissions__ to avoid modifying a shared dictionary
 in_group.__permissions__ = in_group.__permissions__.copy()
 in_group.__permissions__['read'] = ('managers',)
 
+
+class CWSourceSchemaConfig(EntityType):
+    cw_for_source = SubjectRelation(
+        'CWSource', inlined=True, cardinality='1*', composite='object',
+        __permissions__=RELATION_MANAGERS_PERMISSIONS)
+
 cw_for_source = CWSourceSchemaConfig.get_relation('cw_for_source')
 cw_for_source.__permissions__ = {'read': ('managers', 'users'),
                                  'add': ('managers',),
--- a/cubicweb/test/unittest_schema.py	Wed Oct 05 15:30:10 2016 +0200
+++ b/cubicweb/test/unittest_schema.py	Thu Oct 06 12:11:23 2016 +0200
@@ -175,7 +175,7 @@
             'CWConstraintType', 'CWDataImport', 'CWEType',
             'CWAttribute', 'CWGroup', 'EmailAddress',
             'CWRelation', 'CWPermission', 'CWProperty', 'CWRType', 'CWSession',
-            'CWSource', 'CWSourceHostConfig', 'CWSourceSchemaConfig',
+            'CWSource', 'CWSourceHostConfig',
             'CWUniqueTogetherConstraint', 'CWUser',
             'ExternalUri', 'FakeFile', 'Float', 'Int', 'Interval', 'Note',
             'Password', 'Personne', 'Produit',
@@ -196,8 +196,7 @@
             'constrained_by', 'constraint_of',
             'content', 'content_format', 'contrat_exclusif',
             'created_by', 'creation_date', 'cstrtype', 'custom_workflow',
-            'cwuri', 'cwsessiondata', 'cw_for_source', 'cw_import_of', 'cw_host_config_of',
-            'cw_schema', 'cw_source',
+            'cwuri', 'cwsessiondata', 'cw_import_of', 'cw_host_config_of', 'cw_source',
 
             'data', 'data_encoding', 'data_format', 'data_name', 'default_workflow', 'defaultval',
             'delete_permission', 'description', 'description_format', 'destination_state',
@@ -219,7 +218,7 @@
 
             'name', 'nom',
 
-            'options', 'ordernum', 'owned_by',
+            'ordernum', 'owned_by',
 
             'parser', 'path', 'pkey', 'prefered_form', 'prenom', 'primary_email',
 
@@ -492,7 +491,6 @@
                         ('update_permission', 'CWAttribute', 'RQLExpression', 'subject')],
         'CWEType': [('add_permission', 'CWEType', 'RQLExpression', 'subject'),
                     ('constraint_of', 'CWUniqueTogetherConstraint', 'CWEType', 'object'),
-                    ('cw_schema', 'CWSourceSchemaConfig', 'CWEType', 'object'),
                     ('delete_permission', 'CWEType', 'RQLExpression', 'subject'),
                     ('from_entity', 'CWAttribute', 'CWEType', 'object'),
                     ('from_entity', 'CWRelation', 'CWEType', 'object'),
@@ -500,17 +498,14 @@
                     ('to_entity', 'CWAttribute', 'CWEType', 'object'),
                     ('to_entity', 'CWRelation', 'CWEType', 'object'),
                     ('update_permission', 'CWEType', 'RQLExpression', 'subject')],
-        'CWRType': [('cw_schema', 'CWSourceSchemaConfig', 'CWRType', 'object'),
-                    ('relation_type', 'CWAttribute', 'CWRType', 'object'),
+        'CWRType': [('relation_type', 'CWAttribute', 'CWRType', 'object'),
                     ('relation_type', 'CWRelation', 'CWRType', 'object')],
         'CWRelation': [('add_permission', 'CWRelation', 'RQLExpression', 'subject'),
                        ('constrained_by', 'CWRelation', 'CWConstraint', 'subject'),
-                       ('cw_schema', 'CWSourceSchemaConfig', 'CWRelation', 'object'),
                        ('delete_permission', 'CWRelation', 'RQLExpression', 'subject'),
                        ('read_permission', 'CWRelation', 'RQLExpression', 'subject')],
         'CWComputedRType': [('read_permission', 'CWComputedRType', 'RQLExpression', 'subject')],
-        'CWSource': [('cw_for_source', 'CWSourceSchemaConfig', 'CWSource', 'object'),
-                     ('cw_host_config_of', 'CWSourceHostConfig', 'CWSource', 'object'),
+        'CWSource': [('cw_host_config_of', 'CWSourceHostConfig', 'CWSource', 'object'),
                      ('cw_import_of', 'CWDataImport', 'CWSource', 'object'),
                      ('cw_source', 'Ami', 'CWSource', 'object'),
                      ('cw_source', 'BaseTransition', 'CWSource', 'object'),
@@ -530,7 +525,6 @@
                      ('cw_source', 'CWSession', 'CWSource', 'object'),
                      ('cw_source', 'CWSource', 'CWSource', 'object'),
                      ('cw_source', 'CWSourceHostConfig', 'CWSource', 'object'),
-                     ('cw_source', 'CWSourceSchemaConfig', 'CWSource', 'object'),
                      ('cw_source', 'CWUniqueTogetherConstraint', 'CWSource', 'object'),
                      ('cw_source', 'CWUser', 'CWSource', 'object'),
                      ('cw_source', 'Card', 'CWSource', 'object'),
--- a/cubicweb/web/views/cwsources.py	Wed Oct 05 15:30:10 2016 +0200
+++ b/cubicweb/web/views/cwsources.py	Thu Oct 06 12:11:23 2016 +0200
@@ -16,7 +16,7 @@
 # You should have received a copy of the GNU Lesser General Public License along
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
 """Specific views for data sources and related entities (eg CWSource,
-CWSourceHostConfig, CWSourceSchemaConfig).
+CWSourceHostConfig).
 """
 
 import logging
@@ -39,15 +39,11 @@
 
 _abaa = uicfg.actionbox_appearsin_addmenu
 # there are explicit 'add' buttons for those
-_abaa.tag_object_of(('CWSourceSchemaConfig', 'cw_schema', '*'), False)
-_abaa.tag_object_of(('CWSourceSchemaConfig', 'cw_for_source', '*'), False)
-_abaa.tag_object_of(('CWSourceSchemaConfig', 'cw_host_config_of', '*'), False)
 _abaa.tag_object_of(('CWDataImport', 'cw_import_of', '*'), False)
 
 _afs = uicfg.autoform_section
 _afs.tag_attribute(('CWSource', 'latest_retrieval'), 'main', 'hidden')
 _afs.tag_attribute(('CWSource', 'in_synchronization'), 'main', 'hidden')
-_afs.tag_object_of(('*', 'cw_for_source', 'CWSource'), 'main', 'hidden')
 
 _affk = uicfg.autoform_field_kwargs
 _affk.tag_attribute(('CWSource', 'parser'), {'widget': wdgs.TextInput})
@@ -56,7 +52,6 @@
 
 _pvs = uicfg.primaryview_section
 _pvs.tag_attribute(('CWSource', 'name'), 'hidden')
-_pvs.tag_object_of(('*', 'cw_for_source', 'CWSource'), 'hidden')
 _pvs.tag_object_of(('*', 'cw_host_config_of', 'CWSource'), 'hidden')
 
 _pvdc = uicfg.primaryview_display_ctrl
@@ -65,12 +60,11 @@
 _rc = uicfg.reledit_ctrl
 _rc.tag_attribute(('CWSource', 'config'), {'rvid': 'verbatimattr'})
 _rc.tag_attribute(('CWSourceHostConfig', 'config'), {'rvid': 'verbatimattr'})
-_rc.tag_attribute(('CWSourceSchemaConfig', 'options'), {'rvid': 'verbatimattr'})
 
 
 class CWSourcePrimaryView(tabs.TabbedPrimaryView):
     __select__ = is_instance('CWSource')
-    tabs = [_('cwsource-main'), _('cwsource-mapping'), _('cwsource-imports')]
+    tabs = [_('cwsource-main'), _('cwsource-imports')]
     default_tab = 'cwsource-main'
 
 
@@ -97,108 +91,6 @@
                               cellvids={1: 'editable-final'})
 
 
-MAPPED_SOURCE_TYPES = set( ('datafeed',) )
-
-class CWSourceMappingTab(EntityView):
-    __regid__ = 'cwsource-mapping'
-    __select__ = (is_instance('CWSource')
-                  & match_user_groups('managers')
-                  & score_entity(lambda x:x.type in MAPPED_SOURCE_TYPES))
-
-    def entity_call(self, entity):
-        _ = self._cw._
-        self.w('<h3>%s</h3>' % _('Entity and relation supported by this source'))
-        self.w(add_etype_button(self._cw, 'CWSourceSchemaConfig',
-                                __linkto='cw_for_source:%s:subject' % entity.eid))
-        self.w(u'<div class="clear"></div>')
-        rset = self._cw.execute(
-            'Any X, SCH, XO ORDERBY ET WHERE X options XO, X cw_for_source S, S eid %(s)s, '
-            'X cw_schema SCH, SCH is ET', {'s': entity.eid})
-        self.wview('table', rset, 'noresult')
-        checker = MappingChecker(entity)
-        checker.check()
-        if (checker.errors or checker.warnings or checker.infos):
-            self.w('<h2>%s</h2>' % _('Detected problems'))
-            errors = zip(repeat(_('error')), checker.errors)
-            warnings = zip(repeat(_('warning')), checker.warnings)
-            infos = zip(repeat(_('warning')), checker.infos)
-            self.wview('pyvaltable', pyvalue=errors + warnings + infos)
-
-
-class MappingChecker(object):
-    def __init__(self, cwsource):
-        self.cwsource = cwsource
-        self.errors = []
-        self.warnings = []
-        self.infos = []
-        self.schema = cwsource._cw.vreg.schema
-
-    def init(self):
-        # supported entity types
-        self.sentities = set()
-        # supported relations
-        self.srelations = {}
-        # avoid duplicated messages
-        self.seen = set()
-        # first get mapping as dict/sets
-        for schemacfg in self.cwsource.reverse_cw_for_source:
-            self.init_schemacfg(schemacfg)
-
-    def init_schemacfg(self, schemacfg):
-        cwerschema = schemacfg.schema
-        if cwerschema.__regid__ == 'CWEType':
-            self.sentities.add(cwerschema.name)
-        elif cwerschema.__regid__ == 'CWRType':
-            assert not cwerschema.name in self.srelations
-            self.srelations[cwerschema.name] = None
-        else: # CWAttribute/CWRelation
-            self.srelations.setdefault(cwerschema.rtype.name, []).append(
-                (cwerschema.stype.name, cwerschema.otype.name) )
-            self.sentities.add(cwerschema.stype.name)
-            self.sentities.add(cwerschema.otype.name)
-
-    def check(self):
-        self.init()
-        error = self.errors.append
-        warning = self.warnings.append
-        info = self.infos.append
-        for etype in self.sentities:
-            eschema = self.schema[etype]
-            for rschema, ttypes, role in eschema.relation_definitions():
-                if rschema in META_RTYPES:
-                    continue
-                ttypes = [ttype for ttype in ttypes if ttype in self.sentities]
-                if not rschema in self.srelations:
-                    for ttype in ttypes:
-                        rdef = rschema.role_rdef(etype, ttype, role)
-                        self.seen.add(rdef)
-                        if rdef.role_cardinality(role) in '1+':
-                            error(_('relation %(type)s with %(etype)s as %(role)s '
-                                    'and target type %(target)s is mandatory but '
-                                    'not supported') %
-                                  {'rtype': rschema, 'etype': etype, 'role': role,
-                                   'target': ttype})
-                        elif ttype in self.sentities:
-                            warning(_('%s could be supported') % rdef)
-                elif not ttypes:
-                    warning(_('relation %(rtype)s with %(etype)s as %(role)s is '
-                              'supported but no target type supported') %
-                            {'rtype': rschema, 'role': role, 'etype': etype})
-        for rtype, rdefs in self.srelations.items():
-            if rdefs is None:
-                rschema = self.schema[rtype]
-                for subj, obj in rschema.rdefs:
-                    if subj in self.sentities and obj in self.sentities:
-                        break
-                else:
-                    error(_('relation %s is supported but none of its definitions '
-                            'matches supported entities') % rtype)
-        self.custom_check()
-
-    def custom_check(self):
-        pass
-
-
 class CWSourceImportsTab(EntityView):
     __regid__ = 'cwsource-imports'
     __select__ = (is_instance('CWSource')
@@ -500,7 +392,7 @@
 # breadcrumbs configuration ####################################################
 
 class CWsourceConfigIBreadCrumbsAdapter(ibreadcrumbs.IBreadCrumbsAdapter):
-    __select__ = is_instance('CWSourceHostConfig', 'CWSourceSchemaConfig')
+    __select__ = is_instance('CWSourceHostConfig')
     def parent_entity(self):
         return self.entity.cwsource