def configure(self): PropertiesRequest.configure(self) argcheck = None if self.args.get('dump'): argcheck = '--dump' elif self.args.get('edit'): argcheck = '--edit' if argcheck: if len(self.args.get('prop_pairs') or []) != 1: raise ArgumentError( 'argument {0} must be accompanied by exactly one ' 'property name'.format(argcheck)) if self.args.get('prop_pairs')[0][1]: raise ArgumentError( 'argument {0}: a value may not accompany the ' 'property name'.format(argcheck))
def configure(self): PropertiesRequest.configure(self) argcheck = None if self.args.get('dump'): argcheck = '--dump' elif self.args.get('edit'): argcheck = '--edit' if self.args.get('format') == 'raw': raise ArgumentError( 'argument --format: "raw" is only allowed with --dump') if argcheck: if len(self.args.get('prop_pairs') or []) != 1: raise ArgumentError( 'argument {0} must be accompanied by exactly one ' 'variable name'.format(argcheck)) if self.args.get('prop_pairs')[0][1]: raise ArgumentError( 'argument {0}: a value may not accompany the ' 'variable name'.format(argcheck)) if self.args.get('prop_pairs')[0][0] not in PROPERTY_TYPES: raise ArgumentError( 'argument {0} may not be used with variable {1}' .format(argcheck, self.args['prop_pairs'][0][0]))