Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various #2524

Merged
merged 3 commits into from
Jan 10, 2025
Merged

Various #2524

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading