1.1 --- a/imiptools/handlers/scheduling/access.py Fri Apr 22 20:30:51 2016 +0200
1.2 +++ b/imiptools/handlers/scheduling/access.py Fri Apr 22 20:33:51 2016 +0200
1.3 @@ -108,7 +108,7 @@
1.4 if match:
1.5 response = result
1.6
1.7 - return response
1.8 + return standard_responses(handler, response)
1.9
1.10 def same_domain_only(handler, args):
1.11
1.12 @@ -123,7 +123,24 @@
1.13 organiser_domain = organiser.rsplit("@", 1)[-1]
1.14 user_domain = user.rsplit("@", 1)[-1]
1.15
1.16 - return organiser_domain == user_domain and "ACCEPTED" or "DECLINED"
1.17 + response = organiser_domain == user_domain and "ACCEPTED" or "DECLINED"
1.18 + return standard_responses(handler, response)
1.19 +
1.20 +def standard_responses(handler, response):
1.21 +
1.22 + """
1.23 + Using 'handler' to translate descriptions, return a tuple containing the
1.24 + 'response' and a suitable description.
1.25 + """
1.26 +
1.27 + _ = handler.get_translator()
1.28 +
1.29 + if response == "ACCEPTED":
1.30 + return response, _("The recipient has scheduled the requested period.")
1.31 + elif response == "DECLINED":
1.32 + return response, _("The recipient has refused to schedule the requested period.")
1.33 + else:
1.34 + return response, None
1.35
1.36 # Registry of scheduling functions.
1.37