Skip to content

Commit

Permalink
Merge pull request #2524 from liberapay/various
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco authored Jan 10, 2025
2 parents 555c5d0 + 09001b1 commit cc272ce
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion liberapay/billing/payday.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def resolve_takes(tips, takes, ref_currency, payday_id):
# members who have now left the team or have zeroed takes.
transfers = list(transfers.values())
leftover = total_income - MoneyBasket(t.amount for t in transfers)
assert leftover >= 0
assert leftover >= 0, "leftover is negative"
if leftover and leftover_takes:
leftover_takes.sort(key=lambda t: t.member)
leftover_takes_fuzzy_sum = MoneyBasket(
Expand Down
4 changes: 2 additions & 2 deletions liberapay/i18n/currencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ def __ne__(self, other):

def _compare(self, op, other):
if isinstance(other, self.__class__):
return self.amounts == other.amounts
return self.amounts.items() == other.amounts.items()
elif other == 0:
return any(op(v, 0) for v in self.amounts.values())
return all(op(v, 0) for v in self.amounts.values())
else:
raise TypeError(
"can't compare %r and %r" % (self.__class__, other.__class__)
Expand Down
11 changes: 1 addition & 10 deletions liberapay/utils/state_chain.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from urllib.parse import quote as urlquote, urlsplit, urlunsplit
from urllib.parse import quote as urlquote

from pando import Response
from pando.http.request import Line
import pando.state_chain
from requests.exceptions import ConnectionError, Timeout

Expand Down Expand Up @@ -54,14 +53,6 @@ def canonize(request, response, website):
"""
if request.path.raw.startswith('/callbacks/'):
# Don't redirect callbacks
if request.path.raw[-1] == '/':
# Remove trailing slash
l = request.line
scheme, netloc, path, query, fragment = urlsplit(l.uri)
assert path[-1] == '/' # sanity check
path = path[:-1]
new_uri = urlunsplit((scheme, netloc, path, query, fragment))
request.line = Line(l.method.raw, new_uri, l.version.raw)
return
canonical_host = website.canonical_host
canonical_scheme = website.canonical_scheme
Expand Down

0 comments on commit cc272ce

Please sign in to comment.