[fedocal] master: When creating the database add the alembic version of the database (1d8511b)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 1d8511b957582b169992c1cdc8e1fa27f3a3bc6c
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Mon Dec 17 19:08:57 2012 +0100
When creating the database add the alembic version of the database
This allows to use correctly `alembic upgrade head` after.
>---------------------------------------------------------------
createdb.py | 3 ++-
fedocal.cfg.sample | 6 ++++++
fedocal/fedocallib/model.py | 13 +++++++++++--
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/createdb.py b/createdb.py
index bccd5ac..482e4e0 100644
--- a/createdb.py
+++ b/createdb.py
@@ -3,4 +3,5 @@
from fedocal import APP
from fedocal.fedocallib import model
-model.create_tables(APP.config['DB_URL'], True)
+model.create_tables(APP.config['DB_URL'],
+ APP.config['PATH_ALEMBIC_INI'], True)
diff --git a/fedocal.cfg.sample b/fedocal.cfg.sample
index 3747a02..7d3cc39 100644
--- a/fedocal.cfg.sample
+++ b/fedocal.cfg.sample
@@ -21,3 +21,9 @@ SMTP_SERVER='localhost'
### avoid sending multiple reminders for a single meeting.
### Default: 30
CRON_FREQUENCY=30
+
+### Path to the alembic configuration file
+### When creating the database, we need to tell the database which
+### revision of alembic we are at and to do this we need access to the
+### alembic.ini file.
+PATH_ALEMBIC_INI='/path/to/alembic.ini'
diff --git a/fedocal/fedocallib/model.py b/fedocal/fedocallib/model.py
index 087b047..2c6283c 100644
--- a/fedocal/fedocallib/model.py
+++ b/fedocal/fedocallib/model.py
@@ -42,7 +42,7 @@ from sqlalchemy.sql import and_
BASE = declarative_base()
-def create_tables(db_url, debug=False):
+def create_tables(db_url, alembic_ini, debug=False):
""" Create the tables in the database using the information from the
url obtained.
@@ -50,12 +50,21 @@ def create_tables(db_url, debug=False):
information with regards to the database engine, the host to connect
to, the user and password and the database name.
ie: <engine>://<user>:<password>@<host>/<dbname>
- :arg debug, a boolean specifying wether we should have the verbose
+ :arg alembic_ini, path to the alembic ini file.
+ :kwarg debug, a boolean specifying wether we should have the verbose
output of sqlalchemy or not.
:return a session that can be used to query the database.
"""
engine = create_engine(db_url, echo=debug)
BASE.metadata.create_all(engine)
+
+ # then, load the Alembic configuration and generate the
+ # version table, "stamping" it with the most recent rev:
+ from alembic.config import Config
+ from alembic import command
+ alembic_cfg = Config(alembic_ini)
+ command.stamp(alembic_cfg, "head")
+
sessionmak = sessionmaker(bind=engine)
return sessionmak()
11 years, 4 months
[fedocal] master: pep8 run on fedocallib/model.py (9cf1140)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 9cf1140a3469e20660079698f79f7cae521f8504
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Dec 13 18:56:53 2012 +0100
pep8 run on fedocallib/model.py
>---------------------------------------------------------------
fedocal/fedocallib/model.py | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/fedocal/fedocallib/model.py b/fedocal/fedocallib/model.py
index 109f52f..087b047 100644
--- a/fedocal/fedocallib/model.py
+++ b/fedocal/fedocallib/model.py
@@ -347,7 +347,6 @@ class Meeting(BASE):
).order_by(Meeting.meeting_date).all()
return meetings
-
@classmethod
def get_regular_meeting_by_date(cls, session, calendar, start_date,
end_date, full_day=False):
@@ -467,7 +466,6 @@ class Meeting(BASE):
days=meeting.recursion_frequency)
return meetings
-
@classmethod
def expand_regular_meetings(cls, meetings_in, end_date=None,
start_date=None):
@@ -518,6 +516,7 @@ class Meeting(BASE):
meetings.sort(key=operator.attrgetter('meeting_date'))
return meetings
+
class Reminder(BASE):
""" Reminders table.
11 years, 4 months
[fedocal] master: Fix the agenda_is_free_in_future (392f02c)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 392f02c91bbea634c64b2cb14fd3aecaae7f4d9d
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Dec 13 13:12:54 2012 +0100
Fix the agenda_is_free_in_future
The goal of this function is to make sure the agenda is free for all
recursion of a recursive meeting.
>---------------------------------------------------------------
fedocal/fedocallib/__init__.py | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/fedocal/fedocallib/__init__.py b/fedocal/fedocallib/__init__.py
index 0c31269..e4a6542 100644
--- a/fedocal/fedocallib/__init__.py
+++ b/fedocal/fedocallib/__init__.py
@@ -462,7 +462,7 @@ def agenda_is_free(session, calendarobj, meeting_date,
def agenda_is_free_in_future(session, calendarobj, meeting_date,
- time_start, time_stop):
+ recursion_ends, time_start, time_stop):
"""For recursive meeting, check for meetings happening at the
specified time between the specified date and to the end of the
recursion.
@@ -475,7 +475,7 @@ def agenda_is_free_in_future(session, calendarobj, meeting_date,
:arg time_stop: the time at which the meeting stops (as int)
"""
meetings = get_by_date(session, calendarobj, meeting_date,
- meeting_date + timedelta(days=1))
+ recursion_ends)
agenda_free = True
for meeting in set(meetings):
if meeting.meeting_date != meeting_date:
@@ -714,7 +714,7 @@ def add_meeting(session, calendarobj, fas_user,
if frequency and end_repeats:
futur_meeting_at_time = agenda_is_free_in_future(session, calendarobj,
- meeting_date, meeting_time_start.time(),
+ meeting_date, end_repeats, meeting_time_start.time(),
meeting_time_stop.time())
if not bool(calendarobj.calendar_multiple_meetings) and \
@@ -804,8 +804,8 @@ def edit_meeting(session, meeting, calendarobj, fas_user,
if recursion_frequency and recursion_ends:
futur_meeting_at_time = agenda_is_free_in_future(session,
- calendarobj, meeting_date, meeting_time_start.time(),
- meeting_time_stop.time())
+ calendarobj, meeting_date, recursion_ends,
+ meeting_time_start.time(), meeting_time_stop.time())
if not bool(calendarobj.calendar_multiple_meetings) and \
not(futur_meeting_at_time):
11 years, 4 months
[fedocal] master: Sometime (like when there are no agenda in) there are no meetings (8f29624)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 8f296243d051ace14e5e5bdde684068d4931c914
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Dec 13 12:15:35 2012 +0100
Sometime (like when there are no agenda in) there are no meetings
So the dictionnary is None and accessing its content will fail.
>---------------------------------------------------------------
fedocal/templates/agenda.html | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fedocal/templates/agenda.html b/fedocal/templates/agenda.html
index 298cf4f..53616e8 100644
--- a/fedocal/templates/agenda.html
+++ b/fedocal/templates/agenda.html
@@ -79,9 +79,11 @@
{% endfor %}
<tr>
<th rowspan="2" class="time">00h00</th>
+ {% if meetings %}
{% for meeting_list in meetings['23h30'] %}
{{ render_meetings(meeting_list, loop.index) }}
{% endfor %}
+ {% endif %}
</tr>
<tr>
<td colspan="7" class="empty"></td>
11 years, 4 months
[fedocal] master: Remove unused argument (d62a948)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit d62a948814d4fde87ebe0aee0ed1403658b23d87
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Dec 13 12:09:30 2012 +0100
Remove unused argument
>---------------------------------------------------------------
fedocal/fedocallib/model.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fedocal/fedocallib/model.py b/fedocal/fedocallib/model.py
index 645138f..109f52f 100644
--- a/fedocal/fedocallib/model.py
+++ b/fedocal/fedocallib/model.py
@@ -335,7 +335,7 @@ class Meeting(BASE):
@classmethod
def get_active_regular_meeting_by_date(cls, session, calendar,
- start_date, end_date, full_day=False):
+ start_date, full_day=False):
""" Retrieve the list of recursive meetings occuring after the
start_date in the specified calendar.
"""
11 years, 4 months
[fedocal] master: Remove unused imports (2f5ee72)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 2f5ee726117df3a05909ed7eb19c510e73bbad58
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Dec 13 12:08:38 2012 +0100
Remove unused imports
>---------------------------------------------------------------
fedocal/__init__.py | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/fedocal/__init__.py b/fedocal/__init__.py
index ebc3163..ce049e8 100644
--- a/fedocal/__init__.py
+++ b/fedocal/__init__.py
@@ -29,11 +29,8 @@ __requires__ = ['SQLAlchemy >= 0.7', 'jinja2 >= 2.4']
import pkg_resources
-import ConfigParser
-import os
import datetime
from dateutil.relativedelta import relativedelta
-from urlparse import urljoin, urlparse
import vobject
from sqlalchemy.exc import SQLAlchemyError
@@ -44,7 +41,7 @@ import forms as forms
import fedocal.fedocallib as fedocallib
import fedocallib.dbaction
from fedocal.fedocallib.exceptions import FedocalException
-from fedocal.fedocallib.model import (Calendar, Meeting, Reminder)
+from fedocal.fedocallib.model import (Calendar, Meeting)
# Create the application.
APP = flask.Flask(__name__)
11 years, 4 months
[fedocal] master: Rename one of the two functions that had the same name (0b02d57)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 0b02d5701fb54aef186aa2ce006d0b3ebbb2dd86
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Dec 13 12:08:26 2012 +0100
Rename one of the two functions that had the same name
>---------------------------------------------------------------
fedocal/tests/test_week.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fedocal/tests/test_week.py b/fedocal/tests/test_week.py
index 2f8ca1f..e605a68 100644
--- a/fedocal/tests/test_week.py
+++ b/fedocal/tests/test_week.py
@@ -111,7 +111,7 @@ class Weektests(Modeltests):
self.assertEqual(weekobj.meetings[1].meeting_information,
'This is a test meeting with recursion2')
- def test_meeting_in_week(self):
+ def test_meeting_in_week_full_day(self):
""" Test that the meetings in the week are correct function. """
calendar = model.Calendar.by_id(self.session, 'test_calendar')
weekobj = week.Week(self.session, calendar, TODAY)
11 years, 4 months
[fedocal] master: Remove unused import (85981ce)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 85981ce947e02eefc8552227a779a9ea613f73ad
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Dec 13 12:08:06 2012 +0100
Remove unused import
>---------------------------------------------------------------
fedocal/tests/__init__.py | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/fedocal/tests/__init__.py b/fedocal/tests/__init__.py
index b3b31b9..2c9a3ab 100644
--- a/fedocal/tests/__init__.py
+++ b/fedocal/tests/__init__.py
@@ -35,7 +35,6 @@ import sys
import os
from datetime import date
-from datetime import time
from datetime import timedelta
from sqlalchemy import create_engine
11 years, 4 months
[fedocal] master: Remove unused variable (9b9a50b)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 9b9a50bc052d90ae04c16aacba59e6ae0be4b47a
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Dec 13 12:02:12 2012 +0100
Remove unused variable
>---------------------------------------------------------------
fedocal/__init__.py | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/fedocal/__init__.py b/fedocal/__init__.py
index bae9c9b..ebc3163 100644
--- a/fedocal/__init__.py
+++ b/fedocal/__init__.py
@@ -216,8 +216,6 @@ def calendar_list(calendar_name, year, month, day):
auth_form = forms.LoginForm()
admin = is_admin()
- today = datetime.date.today()
-
curmonth_cal = fedocallib.get_html_monthly_cal(year=year,
month=month, day=day, calendar_name=calendar_name)
return flask.render_template('meeting_list.html',
11 years, 4 months
[fedocal] master: Save the provided reminder_text to the database (c9c19e1)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit c9c19e111ed9d5c1f2a747db918e5a9cebd87cfd
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Dec 13 12:00:50 2012 +0100
Save the provided reminder_text to the database
>---------------------------------------------------------------
fedocal/fedocallib/dbaction.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fedocal/fedocallib/dbaction.py b/fedocal/fedocallib/dbaction.py
index 543911c..736864d 100644
--- a/fedocal/fedocallib/dbaction.py
+++ b/fedocal/fedocallib/dbaction.py
@@ -25,7 +25,7 @@ def add_reminder(session, remind_when, remind_who, reminder_text=None):
reminder = model.Reminder(
reminder_offset=remind_when,
reminder_to=remind_who,
- reminder_text=None)
+ reminder_text=reminder_text)
reminder.save(session)
session.flush()
return reminder
11 years, 4 months