|
@@ -91,23 +91,23 @@ class Command(BaseCommand):
|
|
|
number_of_new_payments = len(new_payments)
|
|
|
|
|
|
if (number_of_new_payments > 0) :
|
|
|
- print "======================================================"
|
|
|
- print " > New payments found"
|
|
|
- print json.dumps(new_payments, indent=4, separators=(',', ': '))
|
|
|
- print "======================================================"
|
|
|
- print "Number of already known payments found : " + str(number_of_already_known_payments)
|
|
|
- print "Number of new payments found : " + str(number_of_new_payments)
|
|
|
- print "Number of new payments matched : " + str(len([p for p in new_payments if p["member_matched"]]))
|
|
|
- print "Number of payments not matched : " + str(len([p for p in new_payments if not p["member_matched"]]))
|
|
|
- print "======================================================"
|
|
|
+ print("======================================================")
|
|
|
+ print(" > New payments found")
|
|
|
+ print(json.dumps(new_payments, indent=4, separators=(',', ': ')))
|
|
|
+ print("======================================================")
|
|
|
+ print("Number of already known payments found : " + str(number_of_already_known_payments))
|
|
|
+ print("Number of new payments found : " + str(number_of_new_payments))
|
|
|
+ print("Number of new payments matched : " + str(len([p for p in new_payments if p["member_matched"]])))
|
|
|
+ print("Number of payments not matched : " + str(len([p for p in new_payments if not p["member_matched"]])))
|
|
|
+ print("======================================================")
|
|
|
|
|
|
if number_of_new_payments == 0:
|
|
|
- print "Nothing to do, everything looks up to date !"
|
|
|
+ print("Nothing to do, everything looks up to date !")
|
|
|
return
|
|
|
|
|
|
if not options["commit"]:
|
|
|
- print "Please carefully review the matches, then if everything \n" \
|
|
|
- "looks alright, use --commit to register these new payments."
|
|
|
+ print("Please carefully review the matches, then if everything \n" \
|
|
|
+ "looks alright, use --commit to register these new payments.")
|
|
|
else:
|
|
|
self.add_new_payments(new_payments)
|
|
|
|
|
@@ -205,7 +205,7 @@ class Command(BaseCommand):
|
|
|
member_matches = [ member.username for member in members if member.pk==i ]
|
|
|
if len(member_matches) == 1:
|
|
|
payment["member_matched"] = member_matches[0]
|
|
|
- #print "Matched by ID to "+member_matches[0]
|
|
|
+ #print("Matched by ID to "+member_matches[0])
|
|
|
continue
|
|
|
|
|
|
|
|
@@ -227,7 +227,7 @@ class Command(BaseCommand):
|
|
|
|
|
|
if usernamematch != None:
|
|
|
payment["member_matched"] = usernamematch
|
|
|
- #print "Matched by username to "+usernamematch
|
|
|
+ #print("Matched by username to "+usernamematch)
|
|
|
continue
|
|
|
|
|
|
|
|
@@ -253,10 +253,10 @@ class Command(BaseCommand):
|
|
|
|
|
|
if familynamematch != None:
|
|
|
payment["member_matched"] = familynamematch
|
|
|
- #print "Matched by familyname to "+familynamematch
|
|
|
+ #print("Matched by familyname to "+familynamematch)
|
|
|
continue
|
|
|
|
|
|
- #print "Could not match"
|
|
|
+ #print("Could not match")
|
|
|
payment["member_matched"] = None
|
|
|
|
|
|
return payments
|
|
@@ -281,9 +281,9 @@ class Command(BaseCommand):
|
|
|
if len(matches) == 0:
|
|
|
continue
|
|
|
|
|
|
- print "Ignoring possible match for payment '%s' because " \
|
|
|
+ print("Ignoring possible match for payment '%s' because " \
|
|
|
"it contains the keyword %s" \
|
|
|
- % (payment["label"], keyword)
|
|
|
+ % (payment["label"], keyword))
|
|
|
payments[i]["member_matched"] = None
|
|
|
|
|
|
break
|
|
@@ -324,8 +324,8 @@ class Command(BaseCommand):
|
|
|
assert len(member) == 1
|
|
|
member = member[0]
|
|
|
|
|
|
- print "Adding new payment : "
|
|
|
- print new_payment
|
|
|
+ print("Adding new payment : ")
|
|
|
+ print(new_payment)
|
|
|
# Create the payment
|
|
|
payment = Payment.objects.create(amount=float(new_payment["amount"]),
|
|
|
label=new_payment["label"].encode('utf-8'),
|