p3 lint
parent
9130d9228e
commit
373df95927
|
@ -38,7 +38,7 @@ class GoodreadsAuthorizationRequired(GoodreadsException):
|
||||||
|
|
||||||
def filter_none(d):
|
def filter_none(d):
|
||||||
d2 = {}
|
d2 = {}
|
||||||
for (k,v) in d.iteritems():
|
for (k,v) in d.items():
|
||||||
if v is not None:
|
if v is not None:
|
||||||
d2[k] = v
|
d2[k] = v
|
||||||
return d2
|
return d2
|
||||||
|
|
|
@ -108,7 +108,7 @@ def load_routledge():
|
||||||
books[book_url] = new_book
|
books[book_url] = new_book
|
||||||
else:
|
else:
|
||||||
books[book_url].metadata['subjects'].append(subject)
|
books[book_url].metadata['subjects'].append(subject)
|
||||||
print("Harvesting %s books" % len(books.values()))
|
print("Harvesting %s books" % len(list[books.values()]))
|
||||||
add_from_bookdatas(books.values())
|
add_from_bookdatas(books.values())
|
||||||
return books
|
return books
|
||||||
|
|
|
@ -878,9 +878,9 @@ class Campaign(models.Model):
|
||||||
if time_remaining.days:
|
if time_remaining.days:
|
||||||
countdown = "%s days" % str(time_remaining.days + 1)
|
countdown = "%s days" % str(time_remaining.days + 1)
|
||||||
elif time_remaining.seconds > 3600:
|
elif time_remaining.seconds > 3600:
|
||||||
countdown = "%s hours" % str(time_remaining.seconds/3600 + 1)
|
countdown = "%s hours" % str(time_remaining.seconds // 3600 + 1)
|
||||||
elif time_remaining.seconds > 60:
|
elif time_remaining.seconds > 60:
|
||||||
countdown = "%s minutes" % str(time_remaining.seconds/60 + 1)
|
countdown = "%s minutes" % str(time_remaining.seconds // 60 + 1)
|
||||||
else:
|
else:
|
||||||
countdown = "Seconds"
|
countdown = "Seconds"
|
||||||
|
|
||||||
|
@ -1249,7 +1249,7 @@ class UserProfile(models.Model):
|
||||||
if member['status'] == 'subscribed':
|
if member['status'] == 'subscribed':
|
||||||
return 'True'
|
return 'True'
|
||||||
except MailChimpError as e:
|
except MailChimpError as e:
|
||||||
if e[0]['status'] != 404: # don't log case where user is not on a list
|
if e.args[0]['status'] != 404: # don't log case where user is not on a list
|
||||||
logger.error("error getting mailchimp status %s" % (e))
|
logger.error("error getting mailchimp status %s" % (e))
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
logger.error("bad email address %s" % (self.user.email))
|
logger.error("bad email address %s" % (self.user.email))
|
||||||
|
@ -1275,7 +1275,7 @@ class UserProfile(models.Model):
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
except MailChimpError as e:
|
except MailChimpError as e:
|
||||||
if e[0]['status'] != 404: # don't log case where user is not on a list
|
if e.args[0]['status'] != 404: # don't log case where user is not on a list
|
||||||
logger.error("error getting mailchimp status %s" % (e))
|
logger.error("error getting mailchimp status %s" % (e))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("error unsubscribing from mailchimp list %s" % (e))
|
logger.error("error unsubscribing from mailchimp list %s" % (e))
|
||||||
|
|
|
@ -404,9 +404,9 @@ class Work(models.Model):
|
||||||
status = 6
|
status = 6
|
||||||
else:
|
else:
|
||||||
if campaign.type == BUY2UNGLUE:
|
if campaign.type == BUY2UNGLUE:
|
||||||
status = int(6 - 6*campaign.left/campaign.target)
|
status = int(6 - 6 * campaign.left / campaign.target)
|
||||||
else:
|
else:
|
||||||
status = int(float(campaign.current_total)*6/target)
|
status = int(float(campaign.current_total) * 6 / target)
|
||||||
if status >= 6:
|
if status >= 6:
|
||||||
status = 6
|
status = 6
|
||||||
return status
|
return status
|
||||||
|
|
|
@ -1302,7 +1302,7 @@ class GiftCredit(TemplateView):
|
||||||
return context
|
return context
|
||||||
except CreditLog.DoesNotExist:
|
except CreditLog.DoesNotExist:
|
||||||
#not used yet!
|
#not used yet!
|
||||||
amount = envelope['amount']+envelope['cents']/D(100)
|
amount = envelope['amount'] + envelope['cents'] // D(100)
|
||||||
CreditLog.objects.create(user=user, amount=amount, action='deposit', sent=envelope['sent'])
|
CreditLog.objects.create(user=user, amount=amount, action='deposit', sent=envelope['sent'])
|
||||||
ts = Transaction.objects.filter(user=user, campaign=campaign, status=TRANSACTION_STATUS_NONE).order_by('-pk')
|
ts = Transaction.objects.filter(user=user, campaign=campaign, status=TRANSACTION_STATUS_NONE).order_by('-pk')
|
||||||
if ts.count()==0:
|
if ts.count()==0:
|
||||||
|
@ -2763,7 +2763,7 @@ class DownloadView(PurchaseView):
|
||||||
'action': "Contribution",
|
'action': "Contribution",
|
||||||
'user_license': self.user_license,
|
'user_license': self.user_license,
|
||||||
'lib_thanked': self.lib_thanked,
|
'lib_thanked': self.lib_thanked,
|
||||||
'amount': D(self.request.session.pop('amount')/100) if 'amount' in self.request.session else None,
|
'amount': D(self.request.session.pop('amount') // 100) if 'amount' in self.request.session else None,
|
||||||
'testmode': 'testmode' in self.request.GET or 'testmode' in self.request.POST,
|
'testmode': 'testmode' in self.request.GET or 'testmode' in self.request.POST,
|
||||||
'source': self.request.GET.get('source', self.request.POST.get('source', '')),
|
'source': self.request.GET.get('source', self.request.POST.get('source', '')),
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue