~andrewsomething/bzr/bts794146

« back to all changes in this revision

Viewing changes to bzrlib/gpg.py

(vila) Fix command line override handling for acceptable_keys (Vincent
 Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
336
336
                                command line
337
337
        :return: nothing
338
338
        """
339
 
        key_patterns = None
 
339
        patterns = None
340
340
        acceptable_keys_config = self._config_stack.get('acceptable_keys')
341
 
        try:
342
 
            if isinstance(acceptable_keys_config, unicode):
343
 
                acceptable_keys_config = str(acceptable_keys_config)
344
 
        except UnicodeEncodeError:
345
 
            # gpg Context.keylist(pattern) does not like unicode
346
 
            raise errors.BzrCommandError(
347
 
                gettext('Only ASCII permitted in option names'))
348
 
 
349
341
        if acceptable_keys_config is not None:
350
 
            key_patterns = acceptable_keys_config
 
342
            patterns = acceptable_keys_config
351
343
        if command_line_input is not None: # command line overrides config
352
 
            key_patterns = command_line_input
353
 
        if key_patterns is not None:
354
 
            patterns = key_patterns.split(",")
 
344
            patterns = command_line_input.split(',')
355
345
 
 
346
        if patterns:
356
347
            self.acceptable_keys = []
357
348
            for pattern in patterns:
358
349
                result = self.context.keylist(pattern)