1.1 --- a/tests/test_handle.py Fri Nov 06 13:53:32 2015 +0100
1.2 +++ b/tests/test_handle.py Fri Nov 06 13:54:34 2015 +0100
1.3 @@ -94,19 +94,19 @@
1.4
1.5 if __name__ == "__main__":
1.6 try:
1.7 - action, store_dir, user = sys.argv[1:4]
1.8 + action, store_dir, preferences_dir, user = sys.argv[1:5]
1.9 if action == "counter":
1.10 - start, end = sys.argv[4:6]
1.11 - i = 6
1.12 + start, end = sys.argv[5:7]
1.13 + i = 7
1.14 else:
1.15 start, end = None, None
1.16 - i = 4
1.17 + i = 5
1.18 uid, recurrenceid = (sys.argv[i:i+2] + [None] * 2)[:2]
1.19 except ValueError:
1.20 print >>sys.stderr, """\
1.21 -Need 'accept', 'counter' or 'decline', a store directory, user URI, any
1.22 -counter-proposal datetimes (see below), plus the appropriate event UID and
1.23 -RECURRENCE-ID (if a recurrence is involved).
1.24 +Need 'accept', 'counter' or 'decline', a store directory, a preferences
1.25 +directory, user URI, any counter-proposal datetimes (see below), plus the
1.26 +appropriate event UID and RECURRENCE-ID (if a recurrence is involved).
1.27
1.28 The RECURRENCE-ID must be in exactly the form employed by the store, not a
1.29 different but equivalent representation.
1.30 @@ -132,7 +132,7 @@
1.31 fragment = parse_object(sys.stdin, "utf-8")
1.32
1.33 obj = Object(fragment)
1.34 - handler = TestClient(obj, user, Messenger(), store)
1.35 + handler = TestClient(obj, user, Messenger(), store, None, preferences_dir)
1.36 response = handler.handle_request(action, start, end)
1.37
1.38 if response:
2.1 --- a/tests/test_person_invitation.sh Fri Nov 06 13:53:32 2015 +0100
2.2 +++ b/tests/test_person_invitation.sh Fri Nov 06 13:54:34 2015 +0100
2.3 @@ -21,10 +21,10 @@
2.4 export PYTHONPATH
2.5
2.6 ACCEPT_SCRIPT="$THIS_DIR/test_handle.py"
2.7 -ACCEPT_ARGS="accept $STORE"
2.8 +ACCEPT_ARGS="accept $STORE $PREFS"
2.9
2.10 DECLINE_SCRIPT="$THIS_DIR/test_handle.py"
2.11 -DECLINE_ARGS="decline $STORE"
2.12 +DECLINE_ARGS="decline $STORE $PREFS"
2.13
2.14 ERROR=err.tmp
2.15
3.1 --- a/tests/test_person_invitation_add.sh Fri Nov 06 13:53:32 2015 +0100
3.2 +++ b/tests/test_person_invitation_add.sh Fri Nov 06 13:54:34 2015 +0100
3.3 @@ -23,10 +23,10 @@
3.4 export PYTHONPATH
3.5
3.6 ACCEPT_SCRIPT="$THIS_DIR/test_handle.py"
3.7 -ACCEPT_ARGS="accept $STORE"
3.8 +ACCEPT_ARGS="accept $STORE $PREFS"
3.9
3.10 DECLINE_SCRIPT="$THIS_DIR/test_handle.py"
3.11 -DECLINE_ARGS="decline $STORE"
3.12 +DECLINE_ARGS="decline $STORE $PREFS"
3.13
3.14 ERROR=err.tmp
3.15
4.1 --- a/tests/test_person_invitation_counter.sh Fri Nov 06 13:53:32 2015 +0100
4.2 +++ b/tests/test_person_invitation_counter.sh Fri Nov 06 13:54:34 2015 +0100
4.3 @@ -24,13 +24,13 @@
4.4 export PYTHONPATH
4.5
4.6 ACCEPT_SCRIPT="$THIS_DIR/test_handle.py"
4.7 -ACCEPT_ARGS="accept $STORE"
4.8 +ACCEPT_ARGS="accept $STORE $PREFS"
4.9
4.10 COUNTER_SCRIPT="$THIS_DIR/test_handle.py"
4.11 -COUNTER_ARGS="counter $STORE"
4.12 +COUNTER_ARGS="counter $STORE $PREFS"
4.13
4.14 DECLINE_SCRIPT="$THIS_DIR/test_handle.py"
4.15 -DECLINE_ARGS="decline $STORE"
4.16 +DECLINE_ARGS="decline $STORE $PREFS"
4.17
4.18 ERROR=err.tmp
4.19
5.1 --- a/tests/test_person_invitation_recurring.sh Fri Nov 06 13:53:32 2015 +0100
5.2 +++ b/tests/test_person_invitation_recurring.sh Fri Nov 06 13:54:34 2015 +0100
5.3 @@ -22,10 +22,10 @@
5.4 export PYTHONPATH
5.5
5.6 ACCEPT_SCRIPT="$THIS_DIR/test_handle.py"
5.7 -ACCEPT_ARGS="accept $STORE"
5.8 +ACCEPT_ARGS="accept $STORE $PREFS"
5.9
5.10 DECLINE_SCRIPT="$THIS_DIR/test_handle.py"
5.11 -DECLINE_ARGS="decline $STORE"
5.12 +DECLINE_ARGS="decline $STORE $PREFS"
5.13
5.14 ERROR=err.tmp
5.15
6.1 --- a/tests/test_person_invitation_refresh.sh Fri Nov 06 13:53:32 2015 +0100
6.2 +++ b/tests/test_person_invitation_refresh.sh Fri Nov 06 13:54:34 2015 +0100
6.3 @@ -22,10 +22,10 @@
6.4 export PYTHONPATH
6.5
6.6 ACCEPT_SCRIPT="$THIS_DIR/test_handle.py"
6.7 -ACCEPT_ARGS="accept $STORE"
6.8 +ACCEPT_ARGS="accept $STORE $PREFS"
6.9
6.10 DECLINE_SCRIPT="$THIS_DIR/test_handle.py"
6.11 -DECLINE_ARGS="decline $STORE"
6.12 +DECLINE_ARGS="decline $STORE $PREFS"
6.13
6.14 ERROR=err.tmp
6.15
7.1 --- a/tests/test_person_non_participation.sh Fri Nov 06 13:53:32 2015 +0100
7.2 +++ b/tests/test_person_non_participation.sh Fri Nov 06 13:54:34 2015 +0100
7.3 @@ -23,10 +23,10 @@
7.4 export PYTHONPATH
7.5
7.6 ACCEPT_SCRIPT="$THIS_DIR/test_handle.py"
7.7 -ACCEPT_ARGS="accept $STORE"
7.8 +ACCEPT_ARGS="accept $STORE $PREFS"
7.9
7.10 DECLINE_SCRIPT="$THIS_DIR/test_handle.py"
7.11 -DECLINE_ARGS="decline $STORE"
7.12 +DECLINE_ARGS="decline $STORE $PREFS"
7.13
7.14 ERROR=err.tmp
7.15
8.1 --- a/tools/make_freebusy.py Fri Nov 06 13:53:32 2015 +0100
8.2 +++ b/tools/make_freebusy.py Fri Nov 06 13:54:34 2015 +0100
8.3 @@ -38,17 +38,15 @@
8.4 from imiptools.data import get_window_end, Object
8.5 from imiptools.dates import get_default_timezone, to_utc_datetime
8.6 from imiptools.period import insert_period
8.7 -from imiptools.profile import Preferences
8.8 from imip_store import FileStore, FilePublisher
8.9
8.10 -def make_freebusy(store, publisher, preferences, user, participant,
8.11 - store_and_publish, include_needs_action, reset_updated_list, verbose):
8.12 +def make_freebusy(client, participant, store_and_publish, include_needs_action,
8.13 + reset_updated_list, verbose):
8.14
8.15 """
8.16 - Using the given 'store', 'publisher' and 'preferences', make free/busy
8.17 - details for the records of the given 'user', generating details for
8.18 - 'participant' if not indicated as None; otherwise, generating free/busy
8.19 - details concerning the given user.
8.20 + Using the given 'client' representing a user, make free/busy details for the
8.21 + records of the user, generating details for 'participant' if not indicated
8.22 + as None; otherwise, generating free/busy details concerning the given user.
8.23
8.24 If 'store_and_publish' is set, the stored details will be updated;
8.25 otherwise, the details will be written to standard output.
8.26 @@ -64,6 +62,11 @@
8.27 If 'verbose' is set, messages will be written to standard error.
8.28 """
8.29
8.30 + user = client.user
8.31 + store = client.get_store()
8.32 + publisher = client.get_publisher()
8.33 + preferences = client.get_preferences()
8.34 +
8.35 participant = participant or user
8.36 tzid = preferences.get("TZID") or get_default_timezone()
8.37
8.38 @@ -120,7 +123,7 @@
8.39 if user == participant:
8.40 store.set_freebusy(user, fb)
8.41
8.42 - if Client(user).is_sharing() and Client(user).is_publishing():
8.43 + if client.is_sharing() and client.is_publishing():
8.44 publisher.set_freebusy(user, fb)
8.45
8.46 # Update the list of objects providing periods on future occasions.
8.47 @@ -179,6 +182,12 @@
8.48 Specify -n to include objects with PARTSTAT of NEEDS-ACTION.
8.49 Specify -r to inspect all objects, not just those expected to provide details.
8.50 Specify -v for additional messages on standard error.
8.51 +
8.52 +General options:
8.53 +
8.54 +-S indicate the store directory location
8.55 +-P indicate the publishing directory location
8.56 +-p indicate the preferences directory location
8.57 """ % split(sys.argv[0])[1]
8.58 sys.exit(1)
8.59
8.60 @@ -200,7 +209,6 @@
8.61
8.62 store = FileStore(store_dir)
8.63 publisher = FilePublisher(publishing_dir)
8.64 - preferences = Preferences(user, preferences_dir)
8.65
8.66 # Obtain a list of users for processing.
8.67
8.68 @@ -214,7 +222,8 @@
8.69 for user in users:
8.70 if verbose:
8.71 print >>sys.stderr, user
8.72 - make_freebusy(store, publisher, preferences, user, participant,
8.73 + make_freebusy(
8.74 + Client(user, None, store, publisher, preferences_dir), participant,
8.75 store_and_publish, include_needs_action, reset_updated_list, verbose)
8.76
8.77 # vim: tabstop=4 expandtab shiftwidth=4