Skip to content

Commit

Permalink
get field error entries methods refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlaszczuk committed Feb 9, 2016
1 parent ada12a2 commit 2cb7128
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions rest_framework_friendly_errors/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,7 @@ def get_field_error_entry(self, error, field):
'message': error}

def get_field_error_entries(self, errors, field):
error_list = []
for error in errors:
error_list.append(self.get_field_error_entry(error, field))
return error_list
return [self.get_field_error_entry(error, field) for error in errors]

def get_non_field_error_entry(self, error):
if error in self.registered_errors:
Expand All @@ -176,12 +173,7 @@ def get_non_field_error_entry(self, error):
return {'code': code, 'field': None, 'message': error}

def get_non_field_error_entries(self, errors):
error_list = []
for error in errors:
error_entry = self.get_non_field_error_entry(error)
if error_entry is not None:
error_list.append(error_entry)
return error_list
return [self.get_non_field_error_entry(error) for error in errors]

def build_pretty_errors(self, errors):
pretty = []
Expand Down

0 comments on commit 2cb7128

Please sign in to comment.