1.1 --- a/imiptools/handlers/scheduling/quota.py Fri Apr 22 20:30:51 2016 +0200
1.2 +++ b/imiptools/handlers/scheduling/quota.py Fri Apr 22 20:33:51 2016 +0200
1.3 @@ -33,6 +33,8 @@
1.4 quota.
1.5 """
1.6
1.7 + _ = handler.get_translator()
1.8 +
1.9 quota, group = _get_quota_and_group(handler, args)
1.10
1.11 # Obtain the journal entries and check the balance.
1.12 @@ -46,21 +48,21 @@
1.13
1.14 limit = limits.get(group) or limits.get("*")
1.15 if not limit:
1.16 - return "DECLINED"
1.17 + return "DECLINED", _("You have no quota allocation for the recipient.")
1.18
1.19 # Decline events whose durations exceed the balance.
1.20
1.21 total = _get_duration(handler)
1.22
1.23 if total == Endless():
1.24 - return "DECLINED"
1.25 + return "DECLINED", _("The event period exceeds your quota allocation for the recipient.")
1.26
1.27 balance = get_duration(limit) - _get_usage(entries)
1.28
1.29 if total > balance:
1.30 - return "DECLINED"
1.31 + return "DECLINED", _("The event period exceeds your quota allocation for the recipient.")
1.32 else:
1.33 - return "ACCEPTED"
1.34 + return "ACCEPTED", _("The recipient has scheduled the requested period.")
1.35
1.36 def add_to_quota(handler, args):
1.37
1.38 @@ -188,6 +190,8 @@
1.39 managed by the quota.
1.40 """
1.41
1.42 + _ = handler.get_translator()
1.43 +
1.44 quota, organiser = _get_quota_and_identity(handler, args)
1.45
1.46 # If newer than any old version, discard old details from the
1.47 @@ -197,7 +201,10 @@
1.48 freebusy = handler.get_journal().get_freebusy(quota, organiser)
1.49 scheduled = handler.can_schedule(freebusy, periods)
1.50
1.51 - return scheduled and "ACCEPTED" or "DECLINED"
1.52 + if scheduled:
1.53 + return "ACCEPTED", _("The recipient has scheduled the requested period.")
1.54 + else:
1.55 + return "DECLINED", _("The requested period cannot be scheduled.")
1.56
1.57 def add_to_quota_freebusy(handler, args):
1.58