# HG changeset patch # User Paul Boddie # Date 1507842846 -7200 # Node ID 5a8ef235ec4dbf117d6c3b4e1bd10d4ce5677965 # Parent f9c72bcdde7a34ab3831d88a485d48da800d739a Added methods to obtain recurrence counter-proposal identifiers. diff -r f9c72bcdde7a -r 5a8ef235ec4d imiptools/stores/common.py --- a/imiptools/stores/common.py Sat Oct 07 22:38:01 2017 +0200 +++ b/imiptools/stores/common.py Thu Oct 12 23:14:06 2017 +0200 @@ -3,7 +3,7 @@ """ General support for calendar data storage. -Copyright (C) 2014, 2015, 2016 Paul Boddie +Copyright (C) 2014, 2015, 2016, 2017 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -484,6 +484,15 @@ pass + def get_counter_recurrences(self, user, uid): + + """ + For the given 'user', return a list of recurrence identifiers describing + counter-proposals for the parent event with the given 'uid'. + """ + + pass + def get_counter(self, user, other, uid, recurrenceid=None): """ diff -r f9c72bcdde7a -r 5a8ef235ec4d imiptools/stores/database/common.py --- a/imiptools/stores/database/common.py Sat Oct 07 22:38:01 2017 +0200 +++ b/imiptools/stores/database/common.py Thu Oct 12 23:14:06 2017 +0200 @@ -662,6 +662,27 @@ self.cursor.execute(query, values) return self.get_single_values() + def get_counter_recurrences(self, user, uid): + + """ + For the given 'user', return a list of recurrence identifiers describing + counter-proposals for the parent event with the given 'uid'. + """ + + table = self.get_recurrence_table("counters") + + columns = ["store_user", "object_uid"] + values = [user, uid] + + query, values = self.get_query( + "select object_recurrenceid from %(table)s :condition" % { + "table" : table + }, + columns, values) + + self.cursor.execute(query, values) + return self.get_single_values() + def get_counter(self, user, other, uid, recurrenceid=None): """ diff -r f9c72bcdde7a -r 5a8ef235ec4d imiptools/stores/file.py --- a/imiptools/stores/file.py Sat Oct 07 22:38:01 2017 +0200 +++ b/imiptools/stores/file.py Thu Oct 12 23:14:06 2017 +0200 @@ -568,6 +568,19 @@ return [name for name in listdir(filename) if isfile(join(filename, name))] + def get_counter_recurrences(self, user, uid): + + """ + For the given 'user', return a list of recurrence identifiers describing + counter-proposals for the parent event with the given 'uid'. + """ + + filename = self.get_object_in_store(user, "counters", "recurrences", uid) + if not filename or not isdir(filename): + return [] + + return listdir(filename) + def get_counter(self, user, other, uid, recurrenceid=None): """