server/sources/datafeed.py
changeset 7527 ef1e9bc38137
parent 7461 cb25b62074cc
child 7533 43835fbdf97d
equal deleted inserted replaced
7514:32081892850e 7527:ef1e9bc38137
    76             raise ValidationError(source_entity.eid, {'config': msg})
    76             raise ValidationError(source_entity.eid, {'config': msg})
    77         return typedconfig
    77         return typedconfig
    78 
    78 
    79     def _entity_update(self, source_entity):
    79     def _entity_update(self, source_entity):
    80         source_entity.complete()
    80         source_entity.complete()
    81         self.parser = source_entity.parser
    81         self.parser_id = source_entity.parser
    82         self.latest_retrieval = source_entity.latest_retrieval
    82         self.latest_retrieval = source_entity.latest_retrieval
    83         self.urls = [url.strip() for url in source_entity.url.splitlines()
    83         self.urls = [url.strip() for url in source_entity.url.splitlines()
    84                      if url.strip()]
    84                      if url.strip()]
    85 
    85 
    86     def update_config(self, source_entity, typedconfig):
    86     def update_config(self, source_entity, typedconfig):
    93         self.config = typedconfig
    93         self.config = typedconfig
    94 
    94 
    95     def init(self, activated, source_entity):
    95     def init(self, activated, source_entity):
    96         if activated:
    96         if activated:
    97             self._entity_update(source_entity)
    97             self._entity_update(source_entity)
    98         self.parser = source_entity.parser
    98         self.parser_id = source_entity.parser
    99         self.load_mapping(source_entity._cw)
    99         self.load_mapping(source_entity._cw)
   100 
   100 
   101     def _get_parser(self, session, **kwargs):
   101     def _get_parser(self, session, **kwargs):
   102         return self.repo.vreg['parsers'].select(
   102         return self.repo.vreg['parsers'].select(
   103             self.parser, session, source=self, **kwargs)
   103             self.parser_id, session, source=self, **kwargs)
   104 
   104 
   105     def load_mapping(self, session):
   105     def load_mapping(self, session):
   106         self.mapping = {}
   106         self.mapping = {}
   107         self.mapping_idx = {}
   107         self.mapping_idx = {}
   108         try:
   108         try: