[fedocal] master: No comma beetween css classes (084b507)
by Johan Cwiklinski
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 084b50797309486790c47361a9363ae6e3c26005
Author: Johan Cwiklinski <johan(a)x-tnd.be>
Date: Tue Nov 6 08:55:40 2012 +0100
No comma beetween css classes
>---------------------------------------------------------------
fedocal/fedocallib/fedora_calendar.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fedocal/fedocallib/fedora_calendar.py b/fedocal/fedocallib/fedora_calendar.py
index 8c7b981..932a142 100644
--- a/fedocal/fedocallib/fedora_calendar.py
+++ b/fedocal/fedocallib/fedora_calendar.py
@@ -52,7 +52,7 @@ class FedocalCalendar(HTMLCalendar):
if day == cur_date.day \
and self.month == cur_date.month \
and self.year == cur_date.year:
- return '<td class="%s, today">%s</td>' % (
+ return '<td class="%s today">%s</td>' % (
self.cssclasses[weekday], link_day)
else:
return '<td class="%s">%s</td>' % (
10 years, 10 months
[fedocal] master: Enable navigation in the monthly calendar (60472a3)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 60472a3cf58974d5ed873d9704ef9d2955d73655
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Tue Nov 6 08:48:42 2012 +0100
Enable navigation in the monthly calendar
The date can now be clicked and then bring you to the right week
>---------------------------------------------------------------
fedocal/__init__.py | 3 +-
fedocal/fedocallib/__init__.py | 13 +++++++----
fedocal/fedocallib/fedora_calendar.py | 35 +++++++++++++++++++++++---------
3 files changed, 35 insertions(+), 16 deletions(-)
diff --git a/fedocal/__init__.py b/fedocal/__init__.py
index 039a88a..6c2adfe 100644
--- a/fedocal/__init__.py
+++ b/fedocal/__init__.py
@@ -123,7 +123,8 @@ def calendar_fullday(calendar_name, year, month, day):
auth_form = forms.LoginForm()
admin = is_admin()
month_name = fedocallib.MONTH[week_start.month - 1]
- curmonth_cal = fedocallib.get_html_monthly_cal()
+ curmonth_cal = fedocallib.get_html_monthly_cal(year=year,
+ month=month, calendar_name=calendar_name)
return flask.render_template('agenda.html',
calendar=calendarobj,
month=month_name,
diff --git a/fedocal/fedocallib/__init__.py b/fedocal/fedocallib/__init__.py
index e0cb601..76db809 100644
--- a/fedocal/fedocallib/__init__.py
+++ b/fedocal/fedocallib/__init__.py
@@ -452,11 +452,13 @@ def add_meetings_to_vcal(ical, meetings):
for meeting in meetings:
add_meeting_to_vcal(ical, meeting)
-def get_html_monthly_cal(month = None, year = None):
+def get_html_monthly_cal(month=None, year=None, calendar_name=None):
""" Display a monthly calendar as HTML.
- :arg month: optionnal month. Defaults to current month
- :arg year: optionnal year. Defaults to current year.
+ :kwarg month: optionnal month. Defaults to current month
+ :kwarg year: optionnal year. Defaults to current year.
+ :kwarg calendar_name: the name of the calendar to which the links
+ should point.
"""
if year is None or month is None:
curdate = date.today()
@@ -466,7 +468,8 @@ def get_html_monthly_cal(month = None, year = None):
if month is None:
month = curdate.month
- htmlcal = FedocalCalendar()
- curmonth_cal_nf = htmlcal.formatmonth(year, month)
+ htmlcal = FedocalCalendar(year=year, month=month,
+ calendar_name=calendar_name)
+ curmonth_cal_nf = htmlcal.formatmonth()
return curmonth_cal_nf
diff --git a/fedocal/fedocallib/fedora_calendar.py b/fedocal/fedocallib/fedora_calendar.py
index 030d30b..8c7b981 100644
--- a/fedocal/fedocallib/fedora_calendar.py
+++ b/fedocal/fedocallib/fedora_calendar.py
@@ -24,6 +24,15 @@ class FedocalCalendar(HTMLCalendar):
html validation and some features 'locally required'
"""
+ def __init__(self, year, month, calendar_name=None):
+ """ Constructor.
+ Stores the year and the month asked.
+ """
+ super(FedocalCalendar, self).__init__()
+ self.year = year
+ self.month = month
+ self.calendar_name = calendar_name
+
def formatday(self, day, weekday):
"""
Return a day as a table cell.
@@ -34,16 +43,22 @@ class FedocalCalendar(HTMLCalendar):
if day == 0:
return '<td class="noday"> </td>' # day outside month
else:
- if day == cur_date.day:
- return '<td class="%s, today"><a href="%s">%d</a></td>' % (
- self.cssclasses[weekday], flask.url_for('index'),
- day)
+ link_day = day
+ if self.calendar_name:
+ link_day= '<a href="%s">%d</a>' % (flask.url_for(
+ 'calendar_fullday',
+ calendar_name=self.calendar_name, year=self.year,
+ month=self.month, day=day), day)
+ if day == cur_date.day \
+ and self.month == cur_date.month \
+ and self.year == cur_date.year:
+ return '<td class="%s, today">%s</td>' % (
+ self.cssclasses[weekday], link_day)
else:
- return '<td class="%s"><a href="%s">%d</a></td>' % (
- self.cssclasses[weekday], flask.url_for('index'),
- day)
+ return '<td class="%s">%s</td>' % (
+ self.cssclasses[weekday], link_day)
- def formatmonth(self, theyear, themonth, withyear=True):
+ def formatmonth(self, withyear=True):
"""
Return a formatted month as a html valid table.
"""
@@ -51,11 +66,11 @@ class FedocalCalendar(HTMLCalendar):
a = v.append
a('<table class="month">')
a('\n')
- a(self.formatmonthname(theyear, themonth, withyear=withyear))
+ a(self.formatmonthname(self.year, self.month, withyear=withyear))
a('\n')
#a(self.formatweekheader())
#a('\n')
- for week in self.monthdays2calendar(theyear, themonth):
+ for week in self.monthdays2calendar(self.year, self.month):
a(self.formatweek(week))
a('\n')
a('</table>')
10 years, 10 months
[fedocal] master: Add links to the month calendar (a2ddb00)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit a2ddb00d257ba4966b6ea11e9a0d3ffe4760cc1c
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Tue Nov 6 08:35:03 2012 +0100
Add links to the month calendar
>---------------------------------------------------------------
fedocal/fedocallib/fedora_calendar.py | 13 +++++++++----
fedocal/static/fedocal.css | 8 ++++++++
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/fedocal/fedocallib/fedora_calendar.py b/fedocal/fedocallib/fedora_calendar.py
index 43c1807..030d30b 100644
--- a/fedocal/fedocallib/fedora_calendar.py
+++ b/fedocal/fedocallib/fedora_calendar.py
@@ -16,6 +16,7 @@ license.
from datetime import date
from calendar import HTMLCalendar
+import flask
class FedocalCalendar(HTMLCalendar):
@@ -27,16 +28,20 @@ class FedocalCalendar(HTMLCalendar):
"""
Return a day as a table cell.
"""
+ ## TODO: Fix the links so that they point to something that
+ # makes sense
cur_date = date.today()
if day == 0:
return '<td class="noday"> </td>' # day outside month
else:
if day == cur_date.day:
- return '<td class="%s, today">%d</td>' % (
- self.cssclasses[weekday], day)
+ return '<td class="%s, today"><a href="%s">%d</a></td>' % (
+ self.cssclasses[weekday], flask.url_for('index'),
+ day)
else:
- return '<td class="%s">%d</td>' % (
- self.cssclasses[weekday], day)
+ return '<td class="%s"><a href="%s">%d</a></td>' % (
+ self.cssclasses[weekday], flask.url_for('index'),
+ day)
def formatmonth(self, theyear, themonth, withyear=True):
"""
diff --git a/fedocal/static/fedocal.css b/fedocal/static/fedocal.css
index 6050067..1601415 100644
--- a/fedocal/static/fedocal.css
+++ b/fedocal/static/fedocal.css
@@ -238,6 +238,14 @@ table.month td {
background-color: #fff;
}
+table.month a{
+ color: #808080;
+}
+
+table.month .today a{
+ color: #000;
+}
+
table.month td.noday {
background-color: #f9f9f9;
}
10 years, 10 months
[fedocal] master: Add the css to make the current day appear more clearly in the calendar (24b5261)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 24b5261cf7d684c9d4a9414161e4f10b671d9219
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Tue Nov 6 08:27:32 2012 +0100
Add the css to make the current day appear more clearly in the calendar
>---------------------------------------------------------------
fedocal/static/fedocal.css | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/fedocal/static/fedocal.css b/fedocal/static/fedocal.css
index ce8df93..6050067 100644
--- a/fedocal/static/fedocal.css
+++ b/fedocal/static/fedocal.css
@@ -241,3 +241,9 @@ table.month td {
table.month td.noday {
background-color: #f9f9f9;
}
+
+table.month td.today{
+ background-color: #fff7da;
+ border: 1px solid #000;
+ color: #000;
+}
10 years, 10 months
[fedocal] master: Overload the formatday method to allow giving a specific class to the current day (b75c9eb)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit b75c9ebc2d1a37222fce01592660d1a9d5636983
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Tue Nov 6 08:27:05 2012 +0100
Overload the formatday method to allow giving a specific class to the current day
>---------------------------------------------------------------
fedocal/fedocallib/fedora_calendar.py | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/fedocal/fedocallib/fedora_calendar.py b/fedocal/fedocallib/fedora_calendar.py
index 093a7ba..43c1807 100644
--- a/fedocal/fedocallib/fedora_calendar.py
+++ b/fedocal/fedocallib/fedora_calendar.py
@@ -14,13 +14,30 @@ See http://www.gnu.org/copyleft/gpl.html for the full text of the
license.
"""
+from datetime import date
from calendar import HTMLCalendar
+
class FedocalCalendar(HTMLCalendar):
""" Improve Python's HTMLCalendar object adding
html validation and some features 'locally required'
"""
+ def formatday(self, day, weekday):
+ """
+ Return a day as a table cell.
+ """
+ cur_date = date.today()
+ if day == 0:
+ return '<td class="noday"> </td>' # day outside month
+ else:
+ if day == cur_date.day:
+ return '<td class="%s, today">%d</td>' % (
+ self.cssclasses[weekday], day)
+ else:
+ return '<td class="%s">%d</td>' % (
+ self.cssclasses[weekday], day)
+
def formatmonth(self, theyear, themonth, withyear=True):
"""
Return a formatted month as a html valid table.
10 years, 10 months
[fedocal] master: Header and calendar colors as in mockup (53e3d70)
by trasher@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 53e3d70c7736e07afabf0daa34d5f8bd49085207
Author: Johan Cwiklinski <johan(a)x-tnd.be>
Date: Mon Nov 5 22:58:09 2012 +0100
Header and calendar colors as in mockup
>---------------------------------------------------------------
fedocal/fedocallib/__init__.py | 2 +-
fedocal/fedocallib/fedora_calendar.py | 4 ++--
fedocal/static/fedocal.css | 26 ++++++++++++++++++++++++++
fedocal/templates/agenda.html | 5 +----
fedocal/tests/test_fedocallib.py | 17 ++++++++---------
5 files changed, 38 insertions(+), 16 deletions(-)
diff --git a/fedocal/fedocallib/__init__.py b/fedocal/fedocallib/__init__.py
index c63eafe..e0cb601 100644
--- a/fedocal/fedocallib/__init__.py
+++ b/fedocal/fedocallib/__init__.py
@@ -208,7 +208,7 @@ def get_meetings(session, calendar, year=None, month=None, day=None):
start_time = '0%i' % start_time
if len(str(stop_time)) == 1:
stop_time = '0%i' % stop_time
- key = '%s:%s' % (start_time, stop_time)
+ key = '%sh - %sh' % (start_time, stop_time)
day = meeting.meeting_date.weekday()
if key in meetings:
if meetings[key][day]:
diff --git a/fedocal/fedocallib/fedora_calendar.py b/fedocal/fedocallib/fedora_calendar.py
index 7d0ad83..093a7ba 100644
--- a/fedocal/fedocallib/fedora_calendar.py
+++ b/fedocal/fedocallib/fedora_calendar.py
@@ -31,8 +31,8 @@ class FedocalCalendar(HTMLCalendar):
a('\n')
a(self.formatmonthname(theyear, themonth, withyear=withyear))
a('\n')
- a(self.formatweekheader())
- a('\n')
+ #a(self.formatweekheader())
+ #a('\n')
for week in self.monthdays2calendar(theyear, themonth):
a(self.formatweek(week))
a('\n')
diff --git a/fedocal/static/fedocal.css b/fedocal/static/fedocal.css
index d0d40ad..ce8df93 100644
--- a/fedocal/static/fedocal.css
+++ b/fedocal/static/fedocal.css
@@ -77,6 +77,13 @@ section nav {
#content section > header {
margin-left: -200px; /* Left align with menu */
margin-bottom: .5em;
+ background: url(calendar.png) 0 50% no-repeat;
+ padding-left: 40px;
+ color: #666;
+}
+
+#content section > header p {
+ font-style: italic;
}
#content {
@@ -215,3 +222,22 @@ section nav {
#home:hover a {
color: #fff;
}
+
+table.month {
+ margin: 0 auto;
+ border-collapse: collapse;
+ margin-bottom: .5em;
+}
+
+table.month td {
+ text-align: center;
+ border: 1px solid #e6e6e6;
+ color: #808080;
+ font-weight: bold;
+ padding: .2em;
+ background-color: #fff;
+}
+
+table.month td.noday {
+ background-color: #f9f9f9;
+}
diff --git a/fedocal/templates/agenda.html b/fedocal/templates/agenda.html
index 60b1bac..fec9462 100644
--- a/fedocal/templates/agenda.html
+++ b/fedocal/templates/agenda.html
@@ -11,9 +11,6 @@
<h2>
<a href="{{url_for('ical_out',
calendar_name=calendar.calendar_name)}}">
- <img src="{{url_for('static', filename='calendar.png')}}"
- alt="iCal feed"
- title="Add this calendar to your agenda"/>
</a>
{{ calendar.calendar_name }}
</h2>
@@ -38,7 +35,7 @@
<div id='agenda'>
<table>
<tr>
- <th class="time">{{ month }}</th>
+ <th></th>
{% for day in weekdays %}
<th> {{ day }}</th>
{% endfor %}
diff --git a/fedocal/tests/test_fedocallib.py b/fedocal/tests/test_fedocallib.py
index b813371..8451add 100644
--- a/fedocal/tests/test_fedocallib.py
+++ b/fedocal/tests/test_fedocallib.py
@@ -51,7 +51,6 @@ from tests import Modeltests, TODAY
RESULT_201211_HTML = """
<table class="month">
<tr><th colspan="7" class="month">November 2012</th></tr>
-<tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr>
<tr><td class="noday"> </td><td class="noday"> </td><td class="noday"> </td><td class="thu">1</td><td class="fri">2</td><td class="sat">3</td><td class="sun">4</td></tr>
<tr><td class="mon">5</td><td class="tue">6</td><td class="wed">7</td><td class="thu">8</td><td class="fri">9</td><td class="sat">10</td><td class="sun">11</td></tr>
<tr><td class="mon">12</td><td class="tue">13</td><td class="wed">14</td><td class="thu">15</td><td class="fri">16</td><td class="sat">17</td><td class="sun">18</td></tr>
@@ -184,7 +183,7 @@ class Fedocallibtests(Modeltests):
meetings = fedocallib.get_meetings(self.session, calendar)
self.assertNotEqual(meetings, None)
cnt = 0
- for meeting in meetings['19:20']:
+ for meeting in meetings['19h - 20h']:
if meeting is not None:
for meet in meeting:
self.assertTrue(meet.meeting_name in
@@ -193,14 +192,14 @@ class Fedocallibtests(Modeltests):
else:
cnt = cnt + 1
self.assertEqual(cnt, 6)
- self.assertEqual(meetings['15:16'][0], None)
+ self.assertEqual(meetings['15h - 16h'][0], None)
new_day = TODAY + timedelta(days=10)
meetings = fedocallib.get_meetings(self.session, calendar,
new_day.year, new_day.month, new_day.day)
self.assertNotEqual(meetings, None)
cnt = 0
- for meeting in meetings['14:15']:
+ for meeting in meetings['14h - 15h']:
if meeting is not None:
for meet in meeting:
self.assertEqual(meet.meeting_name, 'test-meeting2')
@@ -208,7 +207,7 @@ class Fedocallibtests(Modeltests):
cnt = cnt + 1
self.assertEqual(cnt, 6)
cnt = 0
- for meeting in meetings['15:16']:
+ for meeting in meetings['15h - 16h']:
if meeting is not None:
for meet in meeting:
self.assertEqual(meet.meeting_name, 'test-meeting2')
@@ -216,7 +215,7 @@ class Fedocallibtests(Modeltests):
cnt = cnt + 1
self.assertEqual(cnt, 6)
cnt = 0
- for meeting in meetings['02:03']:
+ for meeting in meetings['02h - 03h']:
if meeting is not None:
for meet in meeting:
self.assertEqual(meet.meeting_name,
@@ -224,7 +223,7 @@ class Fedocallibtests(Modeltests):
else:
cnt = cnt + 1
self.assertEqual(cnt, 6)
- self.assertEqual(meetings['19:20'][0], None)
+ self.assertEqual(meetings['19h - 20h'][0], None)
def test_get_meetings_with_multiple_same_time(self):
""" Test the get_meetings function when there are several
@@ -233,7 +232,7 @@ class Fedocallibtests(Modeltests):
calendar = model.Calendar.by_id(self.session, 'test_calendar4')
meetings = fedocallib.get_meetings(self.session, calendar)
cnt = 0
- for meeting in meetings['14:15']:
+ for meeting in meetings['14h - 15h']:
if meeting is not None:
for meet in meeting:
self.assertTrue(meet.meeting_name in
@@ -242,7 +241,7 @@ class Fedocallibtests(Modeltests):
cnt = cnt + 1
self.assertEqual(cnt, 6)
cnt = 0
- for meeting in meetings['15:16']:
+ for meeting in meetings['15h - 16h']:
if meeting is not None:
for meet in meeting:
self.assertTrue(meet.meeting_name in
10 years, 10 months
[fedocal] master: More comprehensive display for hours list (5e6e6d0)
by trasher@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 5e6e6d09feaac6e8201aa3022b56585a8ec91491
Author: Johan Cwiklinski <johan(a)x-tnd.be>
Date: Mon Nov 5 22:57:10 2012 +0100
More comprehensive display for hours list
>---------------------------------------------------------------
fedocal/fedocallib/__init__.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fedocal/fedocallib/__init__.py b/fedocal/fedocallib/__init__.py
index 825d505..c63eafe 100644
--- a/fedocal/fedocallib/__init__.py
+++ b/fedocal/fedocallib/__init__.py
@@ -191,7 +191,7 @@ def get_meetings(session, calendar, year=None, month=None, day=None):
meetings = {}
cnt = 1
for hour in HOURS[:-1]:
- key = '%s:%s' % (hour, HOURS[cnt])
+ key = '%sh - %sh' % (hour, HOURS[cnt])
meetings[key] = [None for cnt2 in range(0, 7)]
cnt = cnt + 1
for meeting in week.meetings:
10 years, 10 months
[fedocal] master: Title should not be included from ajax calls (7ae7dce)
by trasher@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 7ae7dcee4c3f15c060bd48e23f057ec116e9a429
Author: Johan Cwiklinski <johan(a)x-tnd.be>
Date: Mon Nov 5 22:31:53 2012 +0100
Title should not be included from ajax calls
>---------------------------------------------------------------
fedocal/templates/view_meeting.html | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fedocal/templates/view_meeting.html b/fedocal/templates/view_meeting.html
index 35e857e..c4ef4e1 100644
--- a/fedocal/templates/view_meeting.html
+++ b/fedocal/templates/view_meeting.html
@@ -1,10 +1,10 @@
{% if full %}
{% extends "master.html" %}
-{% endif %}
{% block title %} {{ title }} {% endblock %}
{% set title_extent = 'Fedora meeting' %}
+{% endif %}
{% block content %}
<section>
10 years, 10 months
[fedocal] master: Fix the Flask unit-tests now that the session is a global attribute of fedocal (91ac0c8)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 91ac0c8b46c037e39872d1982dc93cec2708bf24
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Mon Nov 5 20:20:17 2012 +0100
Fix the Flask unit-tests now that the session is a global attribute of fedocal
>---------------------------------------------------------------
fedocal/tests/test_flask.py | 2 +-
fedocal/tests/test_flask_api.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fedocal/tests/test_flask.py b/fedocal/tests/test_flask.py
index d63625a..571e35b 100644
--- a/fedocal/tests/test_flask.py
+++ b/fedocal/tests/test_flask.py
@@ -64,7 +64,7 @@ class Flasktests(Modeltests):
super(Flasktests, self).setUp()
fedocal.APP.config['TESTING'] = True
- fedocal.CONFIG.set('fedocal', 'db_url',
+ fedocal.SESSION = fedocallib.create_session(
'sqlite:///%s' % DB_PATH)
self.app = fedocal.APP.test_client()
diff --git a/fedocal/tests/test_flask_api.py b/fedocal/tests/test_flask_api.py
index 26129da..c4cd00b 100644
--- a/fedocal/tests/test_flask_api.py
+++ b/fedocal/tests/test_flask_api.py
@@ -64,7 +64,7 @@ class FlaskApitests(Modeltests):
super(FlaskApitests, self).setUp()
fedocal.APP.config['TESTING'] = True
- fedocal.CONFIG.set('fedocal', 'db_url',
+ fedocal.SESSION = fedocallib.create_session(
'sqlite:///%s' % DB_PATH)
self.app = fedocal.APP.test_client()
10 years, 10 months
[fedocal] master: Use scopedsession rather than plain session (89a2fcf)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 89a2fcfe3dc0d0a842bdac3c93df24593d28ea16
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Mon Nov 5 20:17:59 2012 +0100
Use scopedsession rather than plain session
>---------------------------------------------------------------
fedocal/fedocallib/__init__.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/fedocal/fedocallib/__init__.py b/fedocal/fedocallib/__init__.py
index 841e6b8..825d505 100644
--- a/fedocal/fedocallib/__init__.py
+++ b/fedocal/fedocallib/__init__.py
@@ -23,6 +23,7 @@ from datetime import timedelta
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
+from sqlalchemy.orm import scoped_session
from week import Week
from model import Calendar, Reminder, Meeting
@@ -53,7 +54,8 @@ def create_session(db_url, debug=False, pool_recycle=3600):
"""
engine = create_engine(db_url, echo=debug, pool_recycle=pool_recycle)
session = sessionmaker(bind=engine)
- return session()
+ scopedsession = scoped_session(session)
+ return scopedsession()
def get_calendars(session):
10 years, 10 months