# HG changeset patch # User Adrien Di Mascio <Adrien.DiMascio@logilab.fr> # Date 1477649878 -7200 # Fri Oct 28 12:17:58 2016 +0200 # Node ID 4f4f42c7bebf11e499662543b15e75d3159fd567 # Parent 7eebe9f503ee5c9e9f9bfbfab9882650ec6b0b89 [ccplugin] change --etype option to --etypes same thing for --except_etype diff --git a/ccplugin.py b/ccplugin.py --- a/ccplugin.py +++ b/ccplugin.py @@ -39,12 +39,12 @@ ('debug', {'type': 'yn', 'default': False, 'help': 'set to True if you want to print' 'out debug info and progress'}), - ('etype', {'type': 'string', 'default': '', - 'help': 'only index a given etype' - '[default:all indexable types]'}), - ('except-etype', {'type': 'string', 'default': '', - 'help': 'all indexable types except given etype' - '[default:None]'}), + ('etypes', {'type': 'csv', 'default': '', + 'help': 'only index given etypes ' + '[default:all indexable types]'}), + ('except-etypes', {'type': 'string', 'default': '', + 'help': 'all indexable types except given etypes' + '[default: []]'}), ] def run(self, args): @@ -56,13 +56,13 @@ es = indexer.get_connection() indexer.create_index() if es: - if self.config.etype: - etypes = (self.config.etype,) + if self.config.etypes: + etypes = self.config.etypes else: etypes = indexable_types(schema, - custom_skip_list=((self.config.except_etype,))) - assert self.config.except_etype not in etypes - if self.config.debug and not self.config.etype: + custom_skip_list=self.config.except_etypes) + assert self.config.except_etypes not in etypes + if self.config.debug and not self.config.etypes: print(u'found indexable_types {}'.format( ','.join(etypes))) for _ in parallel_bulk(es, diff --git a/es.py b/es.py --- a/es.py +++ b/es.py @@ -41,10 +41,9 @@ if INDEXABLE_TYPES is not None: return INDEXABLE_TYPES indexable_types = [] - skip_list = ('TrInfo', 'EmailAddress') + skip_list = ['TrInfo', 'EmailAddress'] if custom_skip_list: skip_list = skip_list + custom_skip_list - print skip_list for eschema in schema.entities(): if eschema.type in skip_list: continue