34 from warnings import warn |
34 from warnings import warn |
35 from itertools import chain |
35 from itertools import chain |
36 from os.path import join |
36 from os.path import join |
37 from datetime import datetime |
37 from datetime import datetime |
38 from time import time, localtime, strftime |
38 from time import time, localtime, strftime |
|
39 from warnings import warn |
39 |
40 |
40 from logilab.common.decorators import cached, clear_cache |
41 from logilab.common.decorators import cached, clear_cache |
41 from logilab.common.compat import any |
42 from logilab.common.compat import any |
42 from logilab.common import flatten |
43 from logilab.common import flatten |
43 |
44 |
297 # needed (for instance looking for persistent configuration using an |
298 # needed (for instance looking for persistent configuration using an |
298 # internal session, which is not possible until connections sets have been |
299 # internal session, which is not possible until connections sets have been |
299 # initialized) |
300 # initialized) |
300 source.init(True, sourceent) |
301 source.init(True, sourceent) |
301 if not source.copy_based_source: |
302 if not source.copy_based_source: |
|
303 warn('[3.18] old multi-source system will go away in the next version', |
|
304 DeprecationWarning) |
302 self.sources.append(source) |
305 self.sources.append(source) |
303 self.querier.set_planner() |
306 self.querier.set_planner() |
304 if add_to_cnxsets: |
307 if add_to_cnxsets: |
305 for cnxset in self.cnxsets: |
308 for cnxset in self.cnxsets: |
306 cnxset.add_source(source) |
309 cnxset.add_source(source) |
1663 |
1666 |
1664 # multi-sources planner helpers ########################################### |
1667 # multi-sources planner helpers ########################################### |
1665 |
1668 |
1666 @cached |
1669 @cached |
1667 def rel_type_sources(self, rtype): |
1670 def rel_type_sources(self, rtype): |
|
1671 warn('[3.18] old multi-source system will go away in the next version', |
|
1672 DeprecationWarning) |
1668 return tuple([source for source in self.sources |
1673 return tuple([source for source in self.sources |
1669 if source.support_relation(rtype) |
1674 if source.support_relation(rtype) |
1670 or rtype in source.dont_cross_relations]) |
1675 or rtype in source.dont_cross_relations]) |
1671 |
1676 |
1672 @cached |
1677 @cached |
1673 def can_cross_relation(self, rtype): |
1678 def can_cross_relation(self, rtype): |
|
1679 warn('[3.18] old multi-source system will go away in the next version', |
|
1680 DeprecationWarning) |
1674 return tuple([source for source in self.sources |
1681 return tuple([source for source in self.sources |
1675 if source.support_relation(rtype) |
1682 if source.support_relation(rtype) |
1676 and rtype in source.cross_relations]) |
1683 and rtype in source.cross_relations]) |
1677 |
1684 |
1678 @cached |
1685 @cached |
1679 def is_multi_sources_relation(self, rtype): |
1686 def is_multi_sources_relation(self, rtype): |
|
1687 warn('[3.18] old multi-source system will go away in the next version', |
|
1688 DeprecationWarning) |
1680 return any(source for source in self.sources |
1689 return any(source for source in self.sources |
1681 if not source is self.system_source |
1690 if not source is self.system_source |
1682 and source.support_relation(rtype)) |
1691 and source.support_relation(rtype)) |
1683 |
1692 |
1684 # these are overridden by set_log_methods below |
1693 # these are overridden by set_log_methods below |