示例#1
0
文件: module.py 项目: x0rzkov/fame
    def update_config(self, new_info):
        if self['type'] == 'Processing':
            self['generates'] = new_info['generates']
            self._update_diffed_value('queue', new_info['queue'])
            self._update_diffed_value('acts_on', new_info['acts_on'])
            self._update_diffed_value('triggered_by', new_info['triggered_by'])

        elif self['type'] == 'Preloading':
            self._update_diffed_value('queue', new_info['queue'])
            self._update_diffed_value('priority', new_info['priority'])

        elif self['type'] == 'Filetype':
            self._update_diffed_value('acts_on', new_info['acts_on'])

        self['description'] = new_info['description']
        self['config'] = apply_config_update(self['config'], new_info['config'])

        if self['enabled'] and incomplete_config(self['config']):
            self['enabled'] = False

        self.save()
示例#2
0
    def update_config(self, new_info):
        if self['type'] == 'Processing':
            self['generates'] = new_info['generates']

            self['queue'] = new_info['queue']
            if 'queue' in self['diffs']:
                if self['diffs']['queue'] == new_info['queue']:
                    del self['diffs']['queue']
                else:
                    self['queue'] = self['diffs']['queue']

            self._update_diffed_value('acts_on', new_info['acts_on'])
            self._update_diffed_value('triggered_by', new_info['triggered_by'])

        self['description'] = new_info['description']
        self['config'] = apply_config_update(self['config'],
                                             new_info['config'])

        if self['enabled'] and incomplete_config(self['config']):
            self['enabled'] = False

        self.save()