Repository :
http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
---------------------------------------------------------------
commit 7da8f3b93b57134d77e5a3f84fa1ed084a3b9bed
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Mon Nov 5 18:43:53 2012 +0100
Add a from_date to the get_future* and get_past* functions
This allows to provide a starting point from which the future/past
meetings should be retrieved.
Used in the unit-tests among others to prevent problem between
start/end of the week
---------------------------------------------------------------
fedocal/fedocallib/__init__.py | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/fedocal/fedocallib/__init__.py b/fedocal/fedocallib/__init__.py
index 351edf0..841e6b8 100644
--- a/fedocal/fedocallib/__init__.py
+++ b/fedocal/fedocallib/__init__.py
@@ -268,41 +268,49 @@ def is_date_in_future(indate, start_time):
return True
-def get_past_meeting_of_user(session, username):
+def get_past_meeting_of_user(session, username, from_date=date.today()):
""" Return all past meeting which specified username is among the
managers.
:arg session: the database session to use
:arg username: the FAS user name that you would like to have the
past meetings for.
+ :arg from_date: the date from which the futur meetings should be
+ retrieved. Defaults to today
"""
meetings = Meeting.get_past_meeting_of_user(session, username,
- date.today())
+ from_date)
return meetings
-def get_future_single_meeting_of_user(session, username):
+def get_future_single_meeting_of_user(session, username,
+ from_date=date.today()):
""" Return all future meeting which specified username is among the
managers.
:arg session: the database session to use
:arg username: the FAS user name that you would like to have the
past meetings for.
+ :arg from_date: the date from which the futur meetings should be
+ retrieved. Defaults to today
"""
meetings = Meeting.get_future_single_meeting_of_user(session,
- username, date.today())
+ username, from_date)
return meetings
-def get_future_regular_meeting_of_user(session, username):
+def get_future_regular_meeting_of_user(session, username,
+ from_date=date.today()):
""" Return all future recursive meeting which specified username is
among the managers.
:arg session: the database session to use
:arg username: the FAS user name that you would like to have the
past meetings for.
+ :arg from_date: the date from which the futur meetings should be
+ retrieved. Defaults to today
"""
meetings = Meeting.get_future_regular_meeting_of_user(session,
- username, date.today())
+ username, from_date)
return meetings