server/sources/native.py
changeset 6945 28bf94d062a9
parent 6931 0af44a38fe41
child 6957 ffda12be2e9f
equal deleted inserted replaced
6944:0cf10429ad39 6945:28bf94d062a9
    43 from logilab.common.configuration import Method
    43 from logilab.common.configuration import Method
    44 from logilab.common.shellutils import getlogin
    44 from logilab.common.shellutils import getlogin
    45 from logilab.database import get_db_helper
    45 from logilab.database import get_db_helper
    46 
    46 
    47 from yams import schema2sql as y2sql
    47 from yams import schema2sql as y2sql
    48 
    48 from yams.schema import role_name
    49 from cubicweb import UnknownEid, AuthenticationError, ValidationError, Binary, UniqueTogetherError
    49 
       
    50 from cubicweb import (UnknownEid, AuthenticationError, ValidationError, Binary,
       
    51                       UniqueTogetherError)
    50 from cubicweb import transaction as tx, server, neg_role
    52 from cubicweb import transaction as tx, server, neg_role
    51 from cubicweb.schema import VIRTUAL_RTYPES
    53 from cubicweb.schema import VIRTUAL_RTYPES
    52 from cubicweb.cwconfig import CubicWebNoAppConfiguration
    54 from cubicweb.cwconfig import CubicWebNoAppConfiguration
    53 from cubicweb.server import hook
    55 from cubicweb.server import hook
    54 from cubicweb.server.utils import crypt_password, eschema_eid
    56 from cubicweb.server.utils import crypt_password, eschema_eid
   307     def _sqlcnx(self):
   309     def _sqlcnx(self):
   308         # XXX: sqlite connections can only be used in the same thread, so
   310         # XXX: sqlite connections can only be used in the same thread, so
   309         #      create a new one each time necessary. If it appears to be time
   311         #      create a new one each time necessary. If it appears to be time
   310         #      consuming, find another way
   312         #      consuming, find another way
   311         return SQLAdapterMixIn.get_connection(self)
   313         return SQLAdapterMixIn.get_connection(self)
       
   314 
       
   315     def check_config(self, source_entity):
       
   316         """check configuration of source entity"""
       
   317         if source_entity.host_config:
       
   318             msg = source_entity._cw._('the system source has its configuration '
       
   319                                       'stored on the file-system')
       
   320             raise ValidationError(source_entity.eid, {role_name('config', 'subject'): msg})
   312 
   321 
   313     def add_authentifier(self, authentifier):
   322     def add_authentifier(self, authentifier):
   314         self.authentifiers.append(authentifier)
   323         self.authentifiers.append(authentifier)
   315         authentifier.source = self
   324         authentifier.source = self
   316         authentifier.set_schema(self.schema)
   325         authentifier.set_schema(self.schema)