cubicweb/server/sources/__init__.py
branch3.25
changeset 12144 f54286c1cef5
parent 12143 a446124bcf3c
child 12148 79160d54662e
equal deleted inserted replaced
12143:a446124bcf3c 12144:f54286c1cef5
   174     def check_config(cls, source_entity):
   174     def check_config(cls, source_entity):
   175         """check configuration of source entity"""
   175         """check configuration of source entity"""
   176         return cls.check_conf_dict(source_entity.eid, source_entity.host_config,
   176         return cls.check_conf_dict(source_entity.eid, source_entity.host_config,
   177                                     _=source_entity._cw._)
   177                                     _=source_entity._cw._)
   178 
   178 
   179     def _entity_update(self, source_entity):
   179     # source initialization / finalization #####################################
       
   180 
       
   181     def set_schema(self, schema):
       
   182         """set the instance'schema"""
       
   183         self.schema = schema
       
   184 
       
   185     def init_creating(self):
       
   186         """method called by the repository once ready to create a new instance"""
       
   187         pass
       
   188 
       
   189     def init(self, activated, source_entity):
       
   190         """method called by the repository once ready to handle request.
       
   191         `activated` is a boolean flag telling if the source is activated or not.
       
   192         """
       
   193         if not activated:
       
   194             return
   180         source_entity.complete()
   195         source_entity.complete()
   181         if source_entity.url:
   196         if source_entity.url:
   182             self.urls = [url.strip() for url in source_entity.url.splitlines()
   197             self.urls = [url.strip() for url in source_entity.url.splitlines()
   183                          if url.strip()]
   198                          if url.strip()]
   184         else:
   199         else:
   185             self.urls = []
   200             self.urls = []
   186 
   201 
   187     # source initialization / finalization #####################################
       
   188 
       
   189     def set_schema(self, schema):
       
   190         """set the instance'schema"""
       
   191         self.schema = schema
       
   192 
       
   193     def init_creating(self):
       
   194         """method called by the repository once ready to create a new instance"""
       
   195         pass
       
   196 
       
   197     def init(self, activated, source_entity):
       
   198         """method called by the repository once ready to handle request.
       
   199         `activated` is a boolean flag telling if the source is activated or not.
       
   200         """
       
   201         if activated:
       
   202             self._entity_update(source_entity)
       
   203 
       
   204     PUBLIC_KEYS = ('type', 'uri', 'use-cwuri-as-url')
   202     PUBLIC_KEYS = ('type', 'uri', 'use-cwuri-as-url')
   205     def remove_sensitive_information(self, sourcedef):
   203     def remove_sensitive_information(self, sourcedef):
   206         """remove sensitive information such as login / password from source
   204         """remove sensitive information such as login / password from source
   207         definition
   205         definition
   208         """
   206         """