diff --git a/core/goodreads.py b/core/goodreads.py index bcafcdae..96f64e75 100644 --- a/core/goodreads.py +++ b/core/goodreads.py @@ -38,7 +38,7 @@ class GoodreadsAuthorizationRequired(GoodreadsException): def filter_none(d): d2 = {} - for (k,v) in d.iteritems(): + for (k,v) in d.items(): if v is not None: d2[k] = v return d2 diff --git a/core/loaders/routledge.py b/core/loaders/routledge.py index 81fd5fa9..808c7a65 100644 --- a/core/loaders/routledge.py +++ b/core/loaders/routledge.py @@ -108,7 +108,7 @@ def load_routledge(): books[book_url] = new_book else: 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()) return books \ No newline at end of file diff --git a/core/models/__init__.py b/core/models/__init__.py index 4341d8bc..68772bfe 100755 --- a/core/models/__init__.py +++ b/core/models/__init__.py @@ -878,9 +878,9 @@ class Campaign(models.Model): if time_remaining.days: countdown = "%s days" % str(time_remaining.days + 1) 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: - countdown = "%s minutes" % str(time_remaining.seconds/60 + 1) + countdown = "%s minutes" % str(time_remaining.seconds // 60 + 1) else: countdown = "Seconds" @@ -1249,7 +1249,7 @@ class UserProfile(models.Model): if member['status'] == 'subscribed': return 'True' 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)) except ValueError as e: logger.error("bad email address %s" % (self.user.email)) @@ -1275,7 +1275,7 @@ class UserProfile(models.Model): ) return True 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)) except Exception as e: logger.error("error unsubscribing from mailchimp list %s" % (e)) diff --git a/core/models/bibmodels.py b/core/models/bibmodels.py index a121d913..7ee3be3f 100644 --- a/core/models/bibmodels.py +++ b/core/models/bibmodels.py @@ -404,9 +404,9 @@ class Work(models.Model): status = 6 else: if campaign.type == BUY2UNGLUE: - status = int(6 - 6*campaign.left/campaign.target) + status = int(6 - 6 * campaign.left / campaign.target) else: - status = int(float(campaign.current_total)*6/target) + status = int(float(campaign.current_total) * 6 / target) if status >= 6: status = 6 return status diff --git a/frontend/views/__init__.py b/frontend/views/__init__.py index 77913d6a..319d2dd8 100755 --- a/frontend/views/__init__.py +++ b/frontend/views/__init__.py @@ -1302,7 +1302,7 @@ class GiftCredit(TemplateView): return context except CreditLog.DoesNotExist: #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']) ts = Transaction.objects.filter(user=user, campaign=campaign, status=TRANSACTION_STATUS_NONE).order_by('-pk') if ts.count()==0: @@ -2763,7 +2763,7 @@ class DownloadView(PurchaseView): 'action': "Contribution", 'user_license': self.user_license, '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, 'source': self.request.GET.get('source', self.request.POST.get('source', '')),