Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 9b0c55116425f055f1f58469d483fbb2cfebfa2e
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Mon Nov 26 21:33:45 2012 +0100
When retrieving the meetings for a week, specify the calendar for all the meetings.
>---------------------------------------------------------------
fedocal/fedocallib/week.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fedocal/fedocallib/week.py b/fedocal/fedocallib/week.py
index 60b218a..2d24291 100644
--- a/fedocal/fedocallib/week.py
+++ b/fedocal/fedocallib/week.py
@@ -43,7 +43,7 @@ class Week(object):
self.start_date, self.stop_date)
for meeting in Meeting.get_active_regular_meeting(self.session,
- self.stop_date):
+ self.calendar, self.stop_date):
for delta in range(0, 7):
day = self.start_date + timedelta(days=delta)
if ((meeting.meeting_date - day).days %
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 34c8d46daff330cba61af5ed389770953919475b
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Mon Nov 26 21:33:11 2012 +0100
When retrieving the active regular meeting, we need to restrict them for a given calendar
>---------------------------------------------------------------
fedocal/fedocallib/model.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fedocal/fedocallib/model.py b/fedocal/fedocallib/model.py
index f942ca3..8f6b74a 100644
--- a/fedocal/fedocallib/model.py
+++ b/fedocal/fedocallib/model.py
@@ -277,7 +277,7 @@ class Meeting(BASE):
(Meeting.meeting_date < stop_date)).all()
@classmethod
- def get_active_regular_meeting(cls, session, end_date):
+ def get_active_regular_meeting(cls, session, calendar, end_date):
""" Retrieve the list of meetings with a recursion which
end_date is not past the provided end_date and starting before
the end of the time considered.
@@ -285,6 +285,7 @@ class Meeting(BASE):
meetings = session.query(cls).filter(and_
(Meeting.meeting_date <= end_date),
(Meeting.recursion_ends >= end_date),
+ (Meeting.calendar == calendar),
(Meeting.recursion_frequency != None)
).order_by(Meeting.meeting_date).all()
return meetings
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 0c04702d1f7bf8b04c9849f3ada59fcf5247660d
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Mon Nov 26 21:35:12 2012 +0100
The CRON_FREQUENCY is an integer not a string
>---------------------------------------------------------------
fedocal.cfg.sample | 4 ++--
fedocal/default_config.py | 2 +-
fedocal_cron.py | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fedocal.cfg.sample b/fedocal.cfg.sample
index cc22847..3747a02 100644
--- a/fedocal.cfg.sample
+++ b/fedocal.cfg.sample
@@ -19,5 +19,5 @@ SMTP_SERVER='localhost'
### The cron job can be set with any frequency but fedocal_cron needs
### this information to accurately retrieve the meetings to remind and
### avoid sending multiple reminders for a single meeting.
-### Default: '30'
-CRON_FREQUENCY='30'
+### Default: 30
+CRON_FREQUENCY=30
diff --git a/fedocal/default_config.py b/fedocal/default_config.py
index ffc30d1..55f306a 100644
--- a/fedocal/default_config.py
+++ b/fedocal/default_config.py
@@ -38,4 +38,4 @@ SMTP_SERVER = 'localhost'
# The cron job can be set with any frequency but fedocal_cron
-CRON_FREQUENCY='30'
+CRON_FREQUENCY=30
diff --git a/fedocal_cron.py b/fedocal_cron.py
index ea6945d..9370677 100644
--- a/fedocal_cron.py
+++ b/fedocal_cron.py
@@ -80,7 +80,7 @@ def send_reminder():
db_url = fedocal.APP.config['DB_URL']
session = fedocallib.create_session(db_url)
meetings = fedocallib.retrieve_meeting_to_remind(session,
- offset=fedocal.APP.config['CRON_FREQUENCY'])
+ offset=int(fedocal.APP.config['CRON_FREQUENCY']))
for meeting in meetings:
send_reminder_meeting(meeting)
#19: Add to the configuration file option regarding to the frequency of the cron
-------------------------+-------------------------
Reporter: pingou | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 0.1.0
Component: fedocal | Version: development
Keywords: |
-------------------------+-------------------------
To retrieve the list of meetings to send the reminder of, we use a time
period. However, the time interval changes according on the frequency set
for the cron job. We should make as configuration item the cron frequency
to be sure we retrieve the correct meetings.
--
Ticket URL: <https://fedorahosted.org/fedocal/ticket/19>
fedocal <https://fedorahosted.org/fedocal>
A web-based calendar application for Fedora
#20: Document the setting up of the cron job
-------------------------+-------------------------
Reporter: pingou | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 0.1.0
Component: fedocal | Version: development
Keywords: |
-------------------------+-------------------------
Reminders are sent via a cron job for the moment (might be worth looking
at http://packages.python.org/APScheduler/ ), we should document this as
it is not yet part of our documentation.
--
Ticket URL: <https://fedorahosted.org/fedocal/ticket/20>
fedocal <https://fedorahosted.org/fedocal>
A web-based calendar application for Fedora
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit f770bb89a693f6108c31298ab3057ec13f12761a
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Mon Nov 26 21:02:27 2012 +0100
Add a CRON_FREQUENCY item in the configuration file
We need to know at which frequency the cron job is set to retrieve the meetings to
remind correctly. This is now set in the configuration file.
Fixes #19
>---------------------------------------------------------------
doc/configuration.rst | 16 +++++++++++++++-
fedocal.cfg.sample | 6 ++++++
fedocal/default_config.py | 4 ++++
fedocal_cron.py | 3 ++-
4 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/doc/configuration.rst b/doc/configuration.rst
index ee4437c..63678bb 100644
--- a/doc/configuration.rst
+++ b/doc/configuration.rst
@@ -51,10 +51,24 @@ The SMTP server address
-----------------------
Fedocal sends reminder emails for the meeting for which it has been asked.
-This tasks is performed by an hourly cron job.
+This tasks is performed by a cron job.
The ``SMTP_SERVER`` field in the configuration file refers to the address
of the `SMTP <http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol>`
server to use to send these reminders.
This field defaults to ``SMTP_SERVER='localhost'``.
+
+
+The cron job frequency
+----------------------
+
+Fedocal sends reminder emails for the meeting for which it has been asked.
+This tasks is performed by a cron job.
+The ``CRON_FREQUENCY`` field in the configuration file refers to the
+time (in minute) spent between two consecutive run of the cron job. This
+information is essentiel to accurately retrieve the meetings to remind
+and avoid sending multiple reminder for one meeting.
+
+
+This field defaults to ``CRON_FREQUENCY='30'``.
diff --git a/fedocal.cfg.sample b/fedocal.cfg.sample
index 535ce59..cc22847 100644
--- a/fedocal.cfg.sample
+++ b/fedocal.cfg.sample
@@ -15,3 +15,9 @@ ADMIN_GROUP='fedocal_admin'
### via the cron job.
### Default: 'localhost'
SMTP_SERVER='localhost'
+
+### The cron job can be set with any frequency but fedocal_cron needs
+### this information to accurately retrieve the meetings to remind and
+### avoid sending multiple reminders for a single meeting.
+### Default: '30'
+CRON_FREQUENCY='30'
diff --git a/fedocal/default_config.py b/fedocal/default_config.py
index c225879..ffc30d1 100644
--- a/fedocal/default_config.py
+++ b/fedocal/default_config.py
@@ -35,3 +35,7 @@ ADMIN_GROUP = 'fedocal_admin'
# The address of the SMTP server used to send the reminders emails
# via the cron job.
SMTP_SERVER = 'localhost'
+
+
+# The cron job can be set with any frequency but fedocal_cron
+CRON_FREQUENCY='30'
diff --git a/fedocal_cron.py b/fedocal_cron.py
index 3c577e5..ea6945d 100644
--- a/fedocal_cron.py
+++ b/fedocal_cron.py
@@ -79,7 +79,8 @@ def send_reminder():
"""
db_url = fedocal.APP.config['DB_URL']
session = fedocallib.create_session(db_url)
- meetings = fedocallib.retrieve_meeting_to_remind(session)
+ meetings = fedocallib.retrieve_meeting_to_remind(session,
+ offset=fedocal.APP.config['CRON_FREQUENCY'])
for meeting in meetings:
send_reminder_meeting(meeting)
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit cef2f1a49dd6546f840324faae4d00a6df076e7f
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Mon Nov 26 20:59:53 2012 +0100
Add information on how to set up the cron job
Fixes #20
>---------------------------------------------------------------
doc/deployment.rst | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/doc/deployment.rst b/doc/deployment.rst
index c73ea1a..511a5dc 100644
--- a/doc/deployment.rst
+++ b/doc/deployment.rst
@@ -101,6 +101,30 @@ http://localhost/fedocal
<http://flask.pocoo.org/docs/deploying/mod_wsgi/>`_.
+Set-up the cron job
+-------------------
+
+Reminders are sent by a cron job which is provided with the source under
+the name ``fedocal_cron.py``.
+
+You will need to specified the ``FEDOCAL_CONFIG`` environment variable
+when running the cron job as the specified configuration file contains
+information required by the cron job (ie: SMTP_SERVER or CRON_FREQUENCY,
+see :doc:`configuration`).
+
+The only tricky part is that the configuration file will need to be
+adjusted according to how the cron job is set-up. See :doc:`configuration`
+on how to set-up the configuration file.
+
+Example of the cron job:
+
+::
+
+ */30 * * * * FEDOCAL_CONFIG=/etc/fedocal.cfg python /path/to/fedocal_cron.py
+
+
+
+
For testing
-----------