Make condition look better
This commit is contained in:
		
							parent
							
								
									fd1673328f
								
							
						
					
					
						commit
						e62aa2f740
					
				
					 1 changed files with 5 additions and 7 deletions
				
			
		|  | @ -20,13 +20,11 @@ def required_fields(fields, forbid_whitespace=False): | ||||||
|         @functools.wraps(function) |         @functools.wraps(function) | ||||||
|         def wrapped(*args, **kwargs): |         def wrapped(*args, **kwargs): | ||||||
|             for requirement in fields: |             for requirement in fields: | ||||||
|                 if ( |                 missing = ( | ||||||
|                     requirement not in request.form or  |                     requirement not in request.form or  | ||||||
|                     ( |                     (forbid_whitespace and request.form[requirement].strip() == '') | ||||||
|                         forbid_whitespace and |                 ) | ||||||
|                         request.form[requirement].strip() == '' |                 if missing: | ||||||
|                     ) |  | ||||||
|                 ): |  | ||||||
|                     response = { |                     response = { | ||||||
|                         'error_type': 'MISSING_FIELDS', |                         'error_type': 'MISSING_FIELDS', | ||||||
|                         'error_message': 'Required fields: %s' % ', '.join(fields), |                         'error_message': 'Required fields: %s' % ', '.join(fields), | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue