e80de7161239 — Malcolm Scott tip 2 months ago
Prefix messages with list name
1 files changed, 6 insertions(+), 6 deletions(-)

M listsdotcam.py
M listsdotcam.py +6 -6
@@ 87,17 87,17 @@ class ListsDotCam:
 		
 		for email in sorted(current_admins):
 			if email not in mladmins and email != self.username:
-				print(email + " is currently a list admin but should be removed")
+				print("%s: %s is currently a list admin but should be removed" % (ml, email))
 		
 		for email in sorted(mladmins):
 			if email not in current_admins:
-				print(email + " is not currently a list admin, and should be added")
+				print("%s: %s is not currently a list admin, and should be added" % (ml, email))
 
 
 
 	def sympa_subscribe_one(self, ml, address, name):
 		"Subscribe a single address to list 'ml'"
-		print("Adding: %s (%s)" % (address, name))
+		print("%s: adding: %s (%s)" % (ml, address, name))
 		try:
 			# Final parameter indicates that we don't send a welcome email to the new subscriber
 			result = self.zeep.service.add(ml, address, name, 'true')

          
@@ 105,7 105,7 @@ class ListsDotCam:
 			raise SympaActionFailedException(err)   # Typically "User is already a list member"
 
 		if result._raw_elements[0].text != "true":
-			raise SympaActionFailedException("Failed to add: " + address)
+			raise SympaActionFailedException("%s: failed to add: %s" % (ml, address))
 
 
 

          
@@ 128,11 128,11 @@ class ListsDotCam:
 			if email in addresses:
 				continue
 
-			print("Removing: " + email)
+			print("%s: removing: %s" % (ml, email))
 			# "del" reserved word in Python, hence shenanigans with getattr()
 			result = getattr(self.zeep.service, "del")(ml, email, 'true')
 			if result._raw_elements[0].text != "true":
-				raise SympaActionFailedException("Failed to remove: " + email)
+				raise SympaActionFailedException("%s: failed to remove: %s" % (ml, email))
 
 		for (email,name) in sorted(addresses.items()):
 			if email in existing: