Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Commit

Permalink
Fix flake8 E722 rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Maupetit committed Dec 1, 2017
1 parent 5490389 commit baffce9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
9 changes: 8 additions & 1 deletion td_biblio/models.py
Expand Up @@ -48,14 +48,21 @@ def get_formatted_name(self):
def _set_user(self):
"""Look for local django user based on human name"""

if '' in (self.last_name, self.first_name):
return

self._set_first_initial()

User = get_user_model()
try:
self.user = User.objects.get(
models.Q(last_name__iexact=self.last_name),
models.Q(first_name__iexact=self.first_name) |
models.Q(first_name__istartswith=self.first_initial[0])
)
except:
except User.DoesNotExist:
pass
except User.MultipleObjectsReturned:
pass


Expand Down
6 changes: 3 additions & 3 deletions td_biblio/utils/loaders.py
Expand Up @@ -181,7 +181,7 @@ def to_record(self, input):
# Check if month is numerical or not
try:
int(pub_date['month'])
except:
except ValueError:
pub_date['month'] = strptime(pub_date['month'], '%b').tm_mon
# Convert date fields to integers
pub_date = dict(
Expand Down Expand Up @@ -268,7 +268,7 @@ def load_records(self, PMIDs=None):
for entry in entries:
try:
record = self.to_record(entry)
except:
except Exception:
e, v, tb = sys.exc_info()
msg = _(
"An error occured while loading the following PMID: {}. "
Expand Down Expand Up @@ -344,7 +344,7 @@ def load_records(self, DOIs=None):
data = json.loads(r)
try:
record = self.to_record(data)
except:
except Exception:
e, v, tb = sys.exc_info()
msg = _(
"An error occured while loading the following DOI: {}. "
Expand Down
6 changes: 3 additions & 3 deletions td_biblio/views.py
Expand Up @@ -57,23 +57,23 @@ def get(self, request, *args, **kwargs):
# Is it an integer?
try:
self.current_publication_date = datetime.date(int(year), 1, 1)
except:
except TypeError:
self.current_publication_date = None

# -- Publication author
author = self.request.GET.get('author', None)
# Is it an integer?
try:
self.current_publication_author = int(author)
except:
except TypeError:
self.current_publication_author = None

# -- Publication collection
collection = self.request.GET.get('collection', None)
# Is it an integer?
try:
self.current_publication_collection = int(collection)
except:
except TypeError:
self.current_publication_collection = None

return super(EntryListView, self).get(request, *args, **kwargs)
Expand Down

0 comments on commit baffce9

Please sign in to comment.