1.1 --- a/imiptools/__init__.py Thu Sep 17 18:08:40 2015 +0200
1.2 +++ b/imiptools/__init__.py Fri Sep 18 00:52:31 2015 +0200
1.3 @@ -20,6 +20,7 @@
1.4 """
1.5
1.6 from email import message_from_file
1.7 +from imiptools import config
1.8 from imiptools.client import Client
1.9 from imiptools.content import handle_itip_part
1.10 from imiptools.data import get_address, get_addresses, get_uri
1.11 @@ -311,7 +312,7 @@
1.12 # Determine whether to wrap, accompany or replace the message.
1.13
1.14 prefs = self.get_preferences()
1.15 - incoming = prefs.get("incoming")
1.16 + incoming = prefs.get("incoming", config.INCOMING_DEFAULT)
1.17
1.18 if incoming == "message-only":
1.19 messages = [msg]
2.1 --- a/imiptools/client.py Thu Sep 17 18:08:40 2015 +0200
2.2 +++ b/imiptools/client.py Fri Sep 18 00:52:31 2015 +0200
2.3 @@ -20,7 +20,7 @@
2.4 """
2.5
2.6 from datetime import datetime, timedelta
2.7 -from imiptools.config import MANAGER_INTERFACE
2.8 +from imiptools import config
2.9 from imiptools.data import Object, get_address, get_uri, get_window_end, \
2.10 is_new_object, make_freebusy, to_part, \
2.11 uri_dict, uri_items, uri_values
2.12 @@ -93,49 +93,49 @@
2.13 "Return participation in the calendar system."
2.14
2.15 prefs = self.get_preferences()
2.16 - return prefs and prefs.get("participating", "participate") != "no" or False
2.17 + return prefs and prefs.get("participating", config.PARTICIPATING_DEFAULT) != "no" or False
2.18
2.19 def is_sharing(self):
2.20
2.21 "Return whether free/busy information is being generally shared."
2.22
2.23 prefs = self.get_preferences()
2.24 - return prefs and prefs.get("freebusy_sharing") == "share" or False
2.25 + return prefs and prefs.get("freebusy_sharing", config.SHARING_DEFAULT) == "share" or False
2.26
2.27 def is_bundling(self):
2.28
2.29 "Return whether free/busy information is being bundled in messages."
2.30
2.31 prefs = self.get_preferences()
2.32 - return prefs and prefs.get("freebusy_bundling") == "always" or False
2.33 + return prefs and prefs.get("freebusy_bundling", config.BUNDLING_DEFAULT) == "always" or False
2.34
2.35 def is_notifying(self):
2.36
2.37 "Return whether recipients are notified about free/busy payloads."
2.38
2.39 prefs = self.get_preferences()
2.40 - return prefs and prefs.get("freebusy_messages") == "notify" or False
2.41 + return prefs and prefs.get("freebusy_messages", config.NOTIFYING_DEFAULT) == "notify" or False
2.42
2.43 def is_publishing(self):
2.44
2.45 "Return whether free/busy information is being published as Web resources."
2.46
2.47 prefs = self.get_preferences()
2.48 - return prefs and prefs.get("freebusy_publishing") == "publish" or False
2.49 + return prefs and prefs.get("freebusy_publishing", config.PUBLISHING_DEFAULT) == "publish" or False
2.50
2.51 def is_refreshing(self):
2.52
2.53 "Return whether a recipient supports requests to refresh event details."
2.54
2.55 prefs = self.get_preferences()
2.56 - return prefs and prefs.get("event_refreshing") == "always" or False
2.57 + return prefs and prefs.get("event_refreshing", config.REFRESHING_DEFAULT) == "always" or False
2.58
2.59 def allow_add(self):
2.60 return self.get_add_method_response() in ("add", "refresh")
2.61
2.62 def get_add_method_response(self):
2.63 prefs = self.get_preferences()
2.64 - return prefs and prefs.get("add_method_response", "refresh") or "refresh"
2.65 + return prefs and prefs.get("add_method_response", config.ADD_RESPONSE_DEFAULT) or "refresh"
2.66
2.67 def get_offer_period(self):
2.68
2.69 @@ -147,7 +147,7 @@
2.70 """
2.71
2.72 prefs = self.get_preferences()
2.73 - duration = prefs and prefs.get("freebusy_offers")
2.74 + duration = prefs and prefs.get("freebusy_offers", config.FREEBUSY_OFFER_DEFAULT)
2.75 if duration:
2.76 try:
2.77 if duration.endswith("d"):
2.78 @@ -164,10 +164,10 @@
2.79
2.80 def get_organiser_replacement(self):
2.81 prefs = self.get_preferences()
2.82 - return prefs and prefs.get("organiser_replacement", "attendee") or "attendee"
2.83 + return prefs and prefs.get("organiser_replacement", config.ORGANISER_REPLACEMENT_DEFAULT) or "attendee"
2.84
2.85 def have_manager(self):
2.86 - return MANAGER_INTERFACE
2.87 + return config.MANAGER_INTERFACE
2.88
2.89 def get_permitted_values(self):
2.90
3.1 --- a/imiptools/config.py Thu Sep 17 18:08:40 2015 +0200
3.2 +++ b/imiptools/config.py Fri Sep 18 00:52:31 2015 +0200
3.3 @@ -32,6 +32,8 @@
3.4
3.5 DEFAULT_DIR_PERMISSIONS = 02770
3.6
3.7 +
3.8 +
3.9 # The availability of a management interface for calendar information.
3.10 # True: provide links in notifications to the interface described below.
3.11 # False: omit links in notifications.
3.12 @@ -48,4 +50,54 @@
3.13
3.14 MANAGER_URL = None
3.15
3.16 +
3.17 +
3.18 +# Preferences defaults applicable unless overridden by the user.
3.19 +# Changing these allows organisational policy to be defined while still
3.20 +# allowing users to choose more appropriate settings themselves.
3.21 +# See: docs/preferences.txt
3.22 +
3.23 +# Do users participate in the calendar system by default?
3.24 +
3.25 +PARTICIPATING_DEFAULT = "participate"
3.26 +
3.27 +# How should incoming messages be presented to a user by default?
3.28 +
3.29 +INCOMING_DEFAULT = "summary-wraps-message"
3.30 +
3.31 +# Do users share free/busy information by default? This affects the bundling and
3.32 +# publishing settings.
3.33 +
3.34 +SHARING_DEFAULT = "no"
3.35 +
3.36 +# Are free/busy details published on the Web by default?
3.37 +
3.38 +PUBLISHING_DEFAULT = "no"
3.39 +
3.40 +# Are free/busy details bundled with other objects in messages by default?
3.41 +
3.42 +BUNDLING_DEFAULT = "never"
3.43 +
3.44 +# What notifications do users get about incoming free/busy messages by default?
3.45 +
3.46 +NOTIFYING_DEFAULT = "none"
3.47 +
3.48 +# Are REFRESH messages automatically handled by default?
3.49 +
3.50 +REFRESHING_DEFAULT = "never"
3.51 +
3.52 +# How are ADD messages responded to by default?
3.53 +
3.54 +ADD_RESPONSE_DEFAULT = "refresh"
3.55 +
3.56 +# Who can replace an organiser in an event by default?
3.57 +
3.58 +ORGANISER_REPLACEMENT_DEFAULT = "attendee"
3.59 +
3.60 +# How long are free/busy offers valid for by default?
3.61 +# (None means that no offers are maintained for counter-proposals and thus any
3.62 +# periods in the counter-proposal are not held in anticipation of a response.)
3.63 +
3.64 +FREEBUSY_OFFER_DEFAULT = None
3.65 +
3.66 # vim: tabstop=4 expandtab shiftwidth=4