# HG changeset patch # User Paul Boddie # Date 1422821155 -3600 # Node ID bbe8073c82d39c18195226fee61af2c03dc9d4b2 # Parent 9a293696e570fa68d941ed8f7c808680f7b8b1df Moved can_schedule into the period module. diff -r 9a293696e570 -r bbe8073c82d3 imiptools/content.py --- a/imiptools/content.py Sun Feb 01 21:02:53 2015 +0100 +++ b/imiptools/content.py Sun Feb 01 21:05:55 2015 +0100 @@ -27,7 +27,7 @@ get_address, get_fragments, get_uri, get_value, \ is_new_object, uri_dict, uri_item from imiptools.dates import * -from imiptools.period import have_conflict, insert_period, remove_period +from imiptools.period import can_schedule, insert_period, remove_period from pytz import timezone from socket import gethostname from vRecurrence import get_parameters, get_rule @@ -131,20 +131,6 @@ _update_freebusy(freebusy, periods, transp, uid) store.set_freebusy_for_other(user, freebusy, other) -def can_schedule(freebusy, periods, uid): - - """ - Return whether the 'freebusy' list can accommodate the given 'periods' - employing the specified 'uid'. - """ - - for conflict in have_conflict(freebusy, periods, True): - start, end, found_uid, found_transp = conflict - if found_uid != uid: - return False - - return True - # Handler mechanism objects. def handle_itip_part(part, senders, recipient, handlers, messenger): diff -r 9a293696e570 -r bbe8073c82d3 imiptools/period.py --- a/imiptools/period.py Sun Feb 01 21:02:53 2015 +0100 +++ b/imiptools/period.py Sun Feb 01 21:05:55 2015 +0100 @@ -24,6 +24,20 @@ # Time management. +def can_schedule(freebusy, periods, uid): + + """ + Return whether the 'freebusy' list can accommodate the given 'periods' + employing the specified 'uid'. + """ + + for conflict in have_conflict(freebusy, periods, True): + start, end, found_uid, found_transp = conflict + if found_uid != uid: + return False + + return True + def have_conflict(freebusy, periods, get_conflicts=False): """