[fedocal] master: pylint run on test_flask_api (bbff881)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit bbff8813b881efa823f7878a903dacd0960e70b9
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Nov 8 21:51:04 2012 +0100
pylint run on test_flask_api
>---------------------------------------------------------------
fedocal/tests/test_flask_api.py | 168 +++++++++++++++++++--------------------
1 files changed, 82 insertions(+), 86 deletions(-)
diff --git a/fedocal/tests/test_flask_api.py b/fedocal/tests/test_flask_api.py
index c4cd00b..8ffee8f 100644
--- a/fedocal/tests/test_flask_api.py
+++ b/fedocal/tests/test_flask_api.py
@@ -34,9 +34,6 @@ import unittest
import sys
import os
-from datetime import date
-from datetime import time
-from datetime import datetime
from datetime import timedelta
sys.path.insert(0, os.path.join(os.path.dirname(
@@ -45,7 +42,6 @@ sys.path.insert(0, os.path.join(os.path.dirname(
import fedocal
import fedocal.fedocallib as fedocallib
from fedocal.tests import Modeltests, DB_PATH, TODAY
-from test_fedocallib import FakeUser
class FlaskApitests(Modeltests):
@@ -70,159 +66,159 @@ class FlaskApitests(Modeltests):
def test_api(self):
""" Test the index function. """
- rv = self.app.get('/api')
- self.assertEqual(rv.status_code, 301)
+ output = self.app.get('/api')
+ self.assertEqual(output.status_code, 301)
- rv = self.app.get('/api/')
- self.assertEqual(rv.status_code, 200)
- self.assertTrue('<title> API - Fedocal</title>' in rv.data)
- self.assertTrue('<h1>API documentation</h1>' in rv.data)
+ output = self.app.get('/api/')
+ self.assertEqual(output.status_code, 200)
+ self.assertTrue('<title> API - Fedocal</title>' in output.data)
+ self.assertTrue('<h1>API documentation</h1>' in output.data)
self.assertTrue('<code>/api/date/calendar_name/</code>' \
- in rv.data)
+ in output.data)
self.assertTrue('<code>/api/place/region/calendar_name/</code>' \
- in rv.data)
+ in output.data)
def test_api_date_default(self):
""" Test the api_date_default function. """
- rv = self.app.get('/api/date/foobar')
- self.assertEqual(rv.status_code, 301)
+ output = self.app.get('/api/date/foobar')
+ self.assertEqual(output.status_code, 301)
- rv = self.app.get('/api/date/foobar/')
- self.assertEqual(rv.status_code, 200)
- self.assertEqual(rv.data,
+ output = self.app.get('/api/date/foobar/')
+ self.assertEqual(output.status_code, 200)
+ self.assertEqual(output.data,
'{ "retrieval": "notok", "meeting": []}')
self.__setup_db()
- rv = self.app.get('/api/date/test_calendar/')
- self.assertEqual(rv.status_code, 200)
- self.assertTrue('"retrieval": "ok"' in rv.data)
+ output = self.app.get('/api/date/test_calendar/')
+ self.assertEqual(output.status_code, 200)
+ self.assertTrue('"retrieval": "ok"' in output.data)
self.assertTrue(' "meeting_manager": "pingou, shaiton",' in \
- rv.data)
- self.assertTrue('"meeting_name": "test-meeting2"' in rv.data)
- self.assertEqual(rv.data.count('meeting_name'), 6)
+ output.data)
+ self.assertTrue('"meeting_name": "test-meeting2"' in output.data)
+ self.assertEqual(output.data.count('meeting_name'), 6)
- rv = self.app.get('/api/date/test_calendar4/')
- self.assertEqual(rv.status_code, 200)
- self.assertTrue('"retrieval": "ok"' in rv.data)
- self.assertEqual(rv.data.count('meeting_name'), 2)
+ output = self.app.get('/api/date/test_calendar4/')
+ self.assertEqual(output.status_code, 200)
+ self.assertTrue('"retrieval": "ok"' in output.data)
+ self.assertEqual(output.data.count('meeting_name'), 2)
def test_api_date(self):
""" Test the api_date function. """
end_date = TODAY + timedelta(days=11)
- rv = self.app.get('/api/date/foobar/%s/%s' %(TODAY, end_date))
- self.assertEqual(rv.status_code, 301)
+ output = self.app.get('/api/date/foobar/%s/%s' %(TODAY, end_date))
+ self.assertEqual(output.status_code, 301)
- rv = self.app.get('/api/date/foobar/%s/%s/' %(TODAY, end_date))
- self.assertEqual(rv.status_code, 200)
- self.assertEqual(rv.data,
+ output = self.app.get('/api/date/foobar/%s/%s/' %(TODAY, end_date))
+ self.assertEqual(output.status_code, 200)
+ self.assertEqual(output.data,
'{ "retrieval": "notok", "meeting": []}')
self.__setup_db()
- rv = self.app.get('/api/date/test_calendar/%s/%s/' %(TODAY,
+ output = self.app.get('/api/date/test_calendar/%s/%s/' %(TODAY,
end_date))
- self.assertEqual(rv.status_code, 200)
- self.assertTrue('"retrieval": "ok"' in rv.data)
+ self.assertEqual(output.status_code, 200)
+ self.assertTrue('"retrieval": "ok"' in output.data)
self.assertTrue(' "meeting_manager": "pingou, shaiton",' in \
- rv.data)
+ output.data)
self.assertTrue('"meeting_name": "Another test meeting2",' in \
- rv.data)
- self.assertEqual(rv.data.count('meeting_name'), 4)
+ output.data)
+ self.assertEqual(output.data.count('meeting_name'), 4)
end_date = TODAY + timedelta(days=2)
- rv = self.app.get('/api/date/test_calendar4/%s/%s/' %(TODAY,
+ output = self.app.get('/api/date/test_calendar4/%s/%s/' %(TODAY,
end_date))
- self.assertEqual(rv.status_code, 200)
- self.assertTrue('"retrieval": "ok"' in rv.data)
- self.assertEqual(rv.data.count('meeting_name'), 2)
+ self.assertEqual(output.status_code, 200)
+ self.assertTrue('"retrieval": "ok"' in output.data)
+ self.assertEqual(output.data.count('meeting_name'), 2)
def test_api_place_default(self):
""" Test the api_place_default function. """
- rv = self.app.get('/api/place/EMEA/foobar')
- self.assertEqual(rv.status_code, 301)
+ output = self.app.get('/api/place/EMEA/foobar')
+ self.assertEqual(output.status_code, 301)
- rv = self.app.get('/api/place/EMEA/foobar/')
- self.assertEqual(rv.status_code, 200)
- self.assertEqual(rv.data,
+ output = self.app.get('/api/place/EMEA/foobar/')
+ self.assertEqual(output.status_code, 200)
+ self.assertEqual(output.data,
'{ "retrieval": "notok", "meeting": []}')
self.__setup_db()
- rv = self.app.get('/api/place/APAC/test_calendar4/')
- self.assertEqual(rv.status_code, 200)
- self.assertEqual(rv.data,
+ output = self.app.get('/api/place/APAC/test_calendar4/')
+ self.assertEqual(output.status_code, 200)
+ self.assertEqual(output.data,
'{ "retrieval": "notok", "meeting": []}')
- rv = self.app.get('/api/place/NA/test_calendar4/')
- self.assertEqual(rv.status_code, 200)
- self.assertTrue('"retrieval": "ok"' in rv.data)
- self.assertEqual(rv.data.count('meeting_name'), 1)
+ output = self.app.get('/api/place/NA/test_calendar4/')
+ self.assertEqual(output.status_code, 200)
+ self.assertTrue('"retrieval": "ok"' in output.data)
+ self.assertEqual(output.data.count('meeting_name'), 1)
- rv = self.app.get('/api/place/EMEA/test_calendar4/')
- self.assertEqual(rv.status_code, 200)
- self.assertTrue('"retrieval": "ok"' in rv.data)
- self.assertEqual(rv.data.count('meeting_name'), 1)
+ output = self.app.get('/api/place/EMEA/test_calendar4/')
+ self.assertEqual(output.status_code, 200)
+ self.assertTrue('"retrieval": "ok"' in output.data)
+ self.assertEqual(output.data.count('meeting_name'), 1)
def test_api_place(self):
""" Test the api_place function. """
end_date = TODAY + timedelta(days=2)
- rv = self.app.get('/api/place/EMEA/foobar/%s/%s' %(TODAY,
+ output = self.app.get('/api/place/EMEA/foobar/%s/%s' %(TODAY,
end_date))
- self.assertEqual(rv.status_code, 301)
+ self.assertEqual(output.status_code, 301)
- rv = self.app.get('/api/place/EMEA/foobar/%s/%s/' %(TODAY,
+ output = self.app.get('/api/place/EMEA/foobar/%s/%s/' %(TODAY,
end_date))
- self.assertEqual(rv.status_code, 200)
- self.assertEqual(rv.data,
+ self.assertEqual(output.status_code, 200)
+ self.assertEqual(output.data,
'{ "retrieval": "notok", "meeting": []}')
self.__setup_db()
- rv = self.app.get('/api/place/APAC/test_calendar4/%s/%s/' %(
+ output = self.app.get('/api/place/APAC/test_calendar4/%s/%s/' %(
TODAY, end_date))
- self.assertEqual(rv.status_code, 200)
- self.assertEqual(rv.data,
+ self.assertEqual(output.status_code, 200)
+ self.assertEqual(output.data,
'{ "retrieval": "notok", "meeting": []}')
- rv = self.app.get('/api/place/NA/test_calendar4/%s/%s/' %(
+ output = self.app.get('/api/place/NA/test_calendar4/%s/%s/' %(
TODAY, end_date))
- self.assertEqual(rv.status_code, 200)
- self.assertTrue('"retrieval": "ok"' in rv.data)
- self.assertEqual(rv.data.count('meeting_name'), 1)
+ self.assertEqual(output.status_code, 200)
+ self.assertTrue('"retrieval": "ok"' in output.data)
+ self.assertEqual(output.data.count('meeting_name'), 1)
- rv = self.app.get('/api/place/EMEA/test_calendar4/%s/%s/' %(
+ output = self.app.get('/api/place/EMEA/test_calendar4/%s/%s/' %(
TODAY, end_date))
- self.assertEqual(rv.status_code, 200)
- self.assertTrue('"retrieval": "ok"' in rv.data)
- self.assertEqual(rv.data.count('meeting_name'), 1)
+ self.assertEqual(output.status_code, 200)
+ self.assertTrue('"retrieval": "ok"' in output.data)
+ self.assertEqual(output.data.count('meeting_name'), 1)
end_date = TODAY + timedelta(days=1)
- rv = self.app.get('/api/place/NA/test_calendar4/%s/%s/' %(
+ output = self.app.get('/api/place/NA/test_calendar4/%s/%s/' %(
TODAY, end_date))
- self.assertEqual(rv.status_code, 200)
- self.assertEqual(rv.data,
+ self.assertEqual(output.status_code, 200)
+ self.assertEqual(output.data,
'{ "retrieval": "notok", "meeting": []}')
- rv = self.app.get('/api/place/EMEA/test_calendar4/%s/%s/' %(
+ output = self.app.get('/api/place/EMEA/test_calendar4/%s/%s/' %(
TODAY, end_date))
- self.assertEqual(rv.status_code, 200)
- self.assertEqual(rv.data,
+ self.assertEqual(output.status_code, 200)
+ self.assertEqual(output.data,
'{ "retrieval": "notok", "meeting": []}')
def test_api_date_place_error(self):
""" Test the api_date and api_place functions with wrongly
formated input. """
- rv = self.app.get('/api/date/foobar/2000-01/2000-02/')
- self.assertEqual(rv.status_code, 200)
- self.assertEqual(rv.data,
+ output = self.app.get('/api/date/foobar/2000-01/2000-02/')
+ self.assertEqual(output.status_code, 200)
+ self.assertEqual(output.data,
'{ "retrieval": "notok", "meeting": [], "error": '\
'"Date format invalid"}')
- rv = self.app.get('/api/place/EMEA/foobar/2000-01/2000-02/')
- self.assertEqual(rv.status_code, 200)
- self.assertEqual(rv.data,
+ output = self.app.get('/api/place/EMEA/foobar/2000-01/2000-02/')
+ self.assertEqual(output.status_code, 200)
+ self.assertEqual(output.data,
'{ "retrieval": "notok", "meeting": [], "error": '\
'"Date format invalid"}')
11 years, 1 month
[fedocal] master: We droped the start_date from the get_active_regular_meeting, we should drop it from the method call as well (bb108aa)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit bb108aa58a65f8b2a5eddedc68226c5d55a49e99
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Nov 8 21:43:26 2012 +0100
We droped the start_date from the get_active_regular_meeting, we should drop it from the method call as well
>---------------------------------------------------------------
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 5447557..60b218a 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.start_date, self.stop_date):
+ self.stop_date):
for delta in range(0, 7):
day = self.start_date + timedelta(days=delta)
if ((meeting.meeting_date - day).days %
11 years, 1 month
[fedocal] master: Having the __init__ was a good idea but let's keep it on the side for the moment (ac3dafd)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit ac3dafd3749125075f3ce3033fdc970e1d86afc0
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Nov 8 21:38:24 2012 +0100
Having the __init__ was a good idea but let's keep it on the side for the moment
>---------------------------------------------------------------
fedocal/tests/test_meeting.py | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/fedocal/tests/test_meeting.py b/fedocal/tests/test_meeting.py
index 0c3e329..790ed93 100644
--- a/fedocal/tests/test_meeting.py
+++ b/fedocal/tests/test_meeting.py
@@ -47,13 +47,11 @@ from tests import Modeltests, TODAY
from test_calendar import Calendartests
+# pylint: disable=R0904
class Meetingtests(Modeltests):
""" Meeting tests. """
- def __init__(self):
- """ Constructor. """
- super(Meetingtests, self).__init__()
- self.session = None
+ session = None
def test_init_meeting(self):
""" Test the Meeting init function. """
11 years, 1 month
[fedocal] master: pep8/Pylint pass (de15156)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit de15156ca3ab67d63df6f29a1fb1a200a0f54598
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Nov 8 21:28:30 2012 +0100
pep8/Pylint pass
>---------------------------------------------------------------
fedocal/__init__.py | 22 ++++++++++++++++++++--
fedocal/fedocallib/__init__.py | 5 +++++
fedocal/fedocallib/model.py | 11 +++++++----
fedocal/fedocallib/week.py | 2 +-
fedocal/tests/__init__.py | 4 +++-
fedocal/tests/test_meeting.py | 18 +++++++++++++++---
6 files changed, 51 insertions(+), 11 deletions(-)
diff --git a/fedocal/__init__.py b/fedocal/__init__.py
index 5347f54..75e1e90 100644
--- a/fedocal/__init__.py
+++ b/fedocal/__init__.py
@@ -57,6 +57,7 @@ FAS = FAS(APP)
APP.secret_key = CONFIG.get('fedocal', 'secret_key')
SESSION = fedocallib.create_session(CONFIG.get('fedocal', 'db_url'))
+
@APP.context_processor
def inject_calendars():
""" With this decorator we add the list of all the calendars
@@ -77,6 +78,7 @@ def reverse_filter(weekdays):
weekdays[-1].strftime('%d %b %Y'))
+# pylint: disable=W0613
@APP.teardown_request
def shutdown_session(exception=None):
""" Remove the DB session at the end of each request. """
@@ -132,6 +134,7 @@ def calendar(calendar_name):
day=None)
+# pylint: disable=R0914
@APP.route('/<calendar_name>/<int:year>/<int:month>/<int:day>/')
def calendar_fullday(calendar_name, year, month, day):
""" Display the week of a specific date for a specified calendar.
@@ -221,6 +224,7 @@ def auth_login():
if flask.g.fas_user:
return flask.redirect(flask.url_for('index'))
form = forms.LoginForm()
+ # pylint: disable=E1101
if form.validate_on_submit():
if FAS.login(form.username.data, form.password.data):
flask.flash('Welcome, %s' % flask.g.fas_user.username)
@@ -250,6 +254,7 @@ def add_calendar():
if not flask.g.fas_user or not is_admin():
return flask.redirect(flask.url_for('index'))
form = forms.AddCalendarForm()
+ # pylint: disable=E1101
if form.validate_on_submit():
calendarobj = Calendar(
form.calendar_name.data,
@@ -261,6 +266,7 @@ def add_calendar():
try:
calendarobj.save(SESSION)
SESSION.commit()
+ # pylint: disable=W0703
except Exception, err:
print err
flask.flash('Could not add this calendar to the database')
@@ -271,6 +277,7 @@ def add_calendar():
return flask.render_template('add_calendar.html', form=form)
+# pylint: disable=R0915,R0912,R0911
# CLA + 1
@APP.route('/<calendar_name>/add/', methods=('GET', 'POST'))
@cla_plus_one_required
@@ -286,6 +293,7 @@ def add_meeting(calendar_name):
form = forms.AddMeetingForm()
tzone = get_timezone()
calendarobj = Calendar.by_id(SESSION, calendar_name)
+ # pylint: disable=E1101
if form.validate_on_submit():
if not fedocallib.is_user_managing_in_calendar(SESSION,
calendarobj.calendar_name, flask.g.fas_user):
@@ -352,6 +360,7 @@ def add_meeting(calendar_name):
meeting.save(SESSION)
try:
SESSION.flush()
+ # pylint: disable=W0703
except Exception, err:
print 'add_meeting:', err
flask.flash('Could not add this meeting to this calendar')
@@ -367,6 +376,7 @@ def add_meeting(calendar_name):
SESSION.flush()
meeting.reminder = reminder
SESSION.flush()
+ # pylint: disable=W0703
except Exception, err:
print 'add_meeting:', err
flask.flash('Could not add this reminder to this meeting')
@@ -375,6 +385,7 @@ def add_meeting(calendar_name):
try:
SESSION.commit()
+ # pylint: disable=W0703
except Exception, err:
flask.flash(
'Something went wrong while commiting to the DB.')
@@ -393,6 +404,7 @@ def add_meeting(calendar_name):
calendar=calendarobj, form=form, tzone=tzone)
+# pylint: disable=R0915,R0912,R0911
# CLA + 1
@APP.route('/meeting/edit/<int:meeting_id>/', methods=('GET', 'POST'))
@cla_plus_one_required
@@ -416,6 +428,7 @@ def edit_meeting(meeting_id):
'change it anymore')
return flask.redirect(flask.url_for('index'))
form = forms.AddMeetingForm()
+ # pylint: disable=E1101
if form.validate_on_submit():
try:
meeting.meeting_name = form.meeting_name.data
@@ -428,14 +441,14 @@ def edit_meeting(meeting_id):
meeting.meeting_end_date = meeting_end_date
meeting.meeting_time_start = datetime.time(int(
form.meeting_time_start.data))
- meeting_time_stop=datetime.time(int(
+ meeting.meeting_time_stop = datetime.time(int(
form.meeting_time_stop.data))
meeting.meeting_information = form.information.data
region = form.meeting_region.data
if not region:
region = None
- meeting.meeting_region=region
+ meeting.meeting_region = region
frequency = form.frequency.data
if not frequency:
@@ -461,6 +474,7 @@ def edit_meeting(meeting_id):
SESSION.flush()
meeting.reminder = reminder
SESSION.flush()
+ # pylint: disable=W0703
except Exception, err:
print 'edit_meeting:', err
flask.flash('Could not edit the reminder of '\
@@ -471,11 +485,13 @@ def edit_meeting(meeting_id):
elif meeting.reminder_id:
try:
meeting.reminder.delete(SESSION)
+ # pylint: disable=W0703
except Exception, err:
print 'edit_meeting:', err
meeting.save(SESSION)
SESSION.commit()
+ # pylint: disable=W0703
except Exception, err:
print 'edit_meeting:', err
flask.flash('Could not update this meeting.')
@@ -527,6 +543,7 @@ def delete_meeting(meeting_id):
meeting = Meeting.by_id(SESSION, meeting_id)
calendars = Calendar.get_all(SESSION)
deleteform = forms.DeleteMeetingForm()
+ # pylint: disable=E1101
if deleteform.validate_on_submit():
if deleteform.confirm_delete.data:
if deleteform.confirm_futher_delete.data:
@@ -535,6 +552,7 @@ def delete_meeting(meeting_id):
meeting.delete(SESSION)
try:
SESSION.commit()
+ # pylint: disable=W0703
except Exception, err:
print 'edit_meeting:', err
flask.flash('Could not update this meeting.')
diff --git a/fedocal/fedocallib/__init__.py b/fedocal/fedocallib/__init__.py
index d69cbe0..a23d52d 100644
--- a/fedocal/fedocallib/__init__.py
+++ b/fedocal/fedocallib/__init__.py
@@ -209,6 +209,7 @@ def get_week_day_index(year=None, month=None, day=None):
return date(year, month, day).isoweekday()
+# pylint: disable=R0913,R0914
def get_meetings(session, calendar, year=None, month=None, day=None,
tzone='UTC'):
""" Return a hash of {time: [meeting]} for the asked week. The week
@@ -228,6 +229,7 @@ def get_meetings(session, calendar, year=None, month=None, day=None,
fmt = '%Hh%M'
for hour in HOURS[:-1]:
key = '%sh00' % (hour)
+ # pylint: disable=W0612
meetings[key] = [None for cnt2 in range(0, 7)]
for meeting in week.meetings:
start = meeting.meeting_time_start.hour
@@ -317,6 +319,7 @@ def get_past_meeting_of_user(session, username, from_date=date.today()):
return meetings
+# pylint: disable=C0103
def get_future_single_meeting_of_user(session, username,
from_date=date.today()):
""" Return all future meeting which specified username is among the
@@ -333,6 +336,7 @@ def get_future_single_meeting_of_user(session, username,
return meetings
+# pylint: disable=C0103
def get_future_regular_meeting_of_user(session, username,
from_date=date.today()):
""" Return all future recursive meeting which specified username is
@@ -406,6 +410,7 @@ def delete_recursive_meeting(session, meeting):
session.commit()
+# pylint: disable=C0103
def _generate_date_rounded_to_the_hour(meetingdate, offset):
""" For a given date, return a new date to which the given offset in
hours has been added and the time rounded to the hour.
diff --git a/fedocal/fedocallib/model.py b/fedocal/fedocallib/model.py
index c437de1..a11baf7 100644
--- a/fedocal/fedocallib/model.py
+++ b/fedocal/fedocallib/model.py
@@ -19,14 +19,12 @@ import pkg_resources
from datetime import datetime
from datetime import date
-from datetime import timedelta
from sqlalchemy import (
Boolean,
create_engine,
Column,
Date,
- distinct,
Enum,
ForeignKey,
Integer,
@@ -37,7 +35,6 @@ from sqlalchemy import (
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm import relation as relationship
-from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.sql import and_
BASE = declarative_base()
@@ -74,6 +71,7 @@ class Calendar(BASE):
calendar_multiple_meetings = Column(Boolean, default=False)
calendar_regional_meetings = Column(Boolean, default=False)
+ # pylint: disable=R0913
def __init__(self, calendar_name, calendar_description,
calendar_manager_group, calendar_multiple_meetings=False,
calendar_regional_meetings=False):
@@ -119,6 +117,7 @@ class Calendar(BASE):
return session.query(cls).all()
+# pylint: disable=R0902
class Meeting(BASE):
""" Meetings table.
@@ -145,6 +144,7 @@ class Meeting(BASE):
recursion_frequency = Column(Integer, nullable=True, default=None)
recursion_ends = Column(Date, nullable=True, default=None)
+ # pylint: disable=R0913
def __init__(self, meeting_name, meeting_manager,
meeting_date, meeting_date_end,
meeting_time_start, meeting_time_stop,
@@ -272,7 +272,7 @@ class Meeting(BASE):
(Meeting.meeting_date < stop_date)).all()
@classmethod
- def get_active_regular_meeting(cls, session, start_date, end_date):
+ def get_active_regular_meeting(cls, session, 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.
@@ -284,6 +284,7 @@ class Meeting(BASE):
).order_by(Meeting.meeting_date).all()
return meetings
+ # pylint: disable=R0913
@classmethod
def get_by_date_and_region(cls, session, calendar, start_date,
stop_date, region):
@@ -318,6 +319,7 @@ class Meeting(BASE):
(Meeting.meeting_date < start_date),
(Meeting.meeting_manager.like('%%%s%%' % username))).all()
+ # pylint: disable=C0103
@classmethod
def get_future_single_meeting_of_user(cls, session, username,
start_date=date.today()):
@@ -330,6 +332,7 @@ class Meeting(BASE):
(Meeting.recursion_frequency == None),
(Meeting.meeting_manager.like('%%%s%%' % username))).all()
+ # pylint: disable=C0103
@classmethod
def get_future_regular_meeting_of_user(cls, session, username,
start_date=date.today()):
diff --git a/fedocal/fedocallib/week.py b/fedocal/fedocallib/week.py
index 399e6d1..5447557 100644
--- a/fedocal/fedocallib/week.py
+++ b/fedocal/fedocallib/week.py
@@ -14,11 +14,11 @@ See http://www.gnu.org/copyleft/gpl.html for the full text of the
license.
"""
-from datetime import date
from datetime import timedelta
from model import Meeting
+# pylint: disable=R0903
class Week(object):
""" This class represents a week for in a specific calendar with
all its meetings.
diff --git a/fedocal/tests/__init__.py b/fedocal/tests/__init__.py
index fd12e4a..16c1972 100644
--- a/fedocal/tests/__init__.py
+++ b/fedocal/tests/__init__.py
@@ -45,7 +45,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(
from fedocallib import model, get_start_week
-DB_PATH = '%s/test.db' %(os.path.dirname(
+DB_PATH = '%s/test.db' % (os.path.dirname(
os.path.abspath(__file__)))
TODAY = get_start_week(date.today().year, date.today().month,
@@ -59,10 +59,12 @@ class Modeltests(unittest.TestCase):
unittest.TestCase.__init__(self, method_name)
self.session = None
+ # pylint: disable=C0103
def setUp(self):
""" Set up the environnment, ran before every tests. """
self.session = model.create_tables('sqlite:///%s' % DB_PATH)
+ # pylint: disable=C0103
def tearDown(self):
""" Remove the test.db database if there is one. """
if os.path.exists(DB_PATH):
diff --git a/fedocal/tests/test_meeting.py b/fedocal/tests/test_meeting.py
index 82cde15..0c3e329 100644
--- a/fedocal/tests/test_meeting.py
+++ b/fedocal/tests/test_meeting.py
@@ -34,7 +34,6 @@ import unittest
import sys
import os
-from datetime import date
from datetime import time
from datetime import timedelta
@@ -51,6 +50,11 @@ from test_calendar import Calendartests
class Meetingtests(Modeltests):
""" Meeting tests. """
+ def __init__(self):
+ """ Constructor. """
+ super(Meetingtests, self).__init__()
+ self.session = None
+
def test_init_meeting(self):
""" Test the Meeting init function. """
caltest = Calendartests('test_init_calendar')
@@ -120,7 +124,8 @@ class Meetingtests(Modeltests):
meeting_date_end=TODAY + timedelta(days=1),
meeting_time_start=time(14, 00),
meeting_time_stop=time(16, 00),
- meeting_information='This is a second test meeting at the same time',
+ meeting_information='This is a second test meeting at the'\
+ ' same time',
calendar_name='test_calendar4',
meeting_region='EMEA')
obj.save(self.session)
@@ -187,7 +192,8 @@ class Meetingtests(Modeltests):
meeting_date_end=TODAY + timedelta(days=12),
meeting_time_start=time(10, 00),
meeting_time_stop=time(11, 00),
- meeting_information='This is a test meeting with recursion and reminder',
+ meeting_information='This is a test meeting with recursion'\
+ ' and reminder',
calendar_name='test_calendar',
reminder_id=remobj.reminder_id,
recursion_frequency=7,
@@ -425,6 +431,7 @@ class Meetingtests(Modeltests):
self.assertEqual(meetings[0].meeting_name,
'Fedora-fr-test-meeting')
+ # pylint: disable=C0103
def test_get_past_meeting_of_user_fail(self):
""" Test the Meeting get_past_meeting_of_user function when
the user does not exists or there is nothing on that day. """
@@ -441,6 +448,7 @@ class Meetingtests(Modeltests):
self.assertEqual(len(meetings), 0)
self.assertEqual(meetings, [])
+ # pylint: disable=C0103
def test_get_future_single_meeting_of_user(self):
""" Test the Meeting get_future_single_meeting_of_user function.
"""
@@ -456,6 +464,7 @@ class Meetingtests(Modeltests):
self.assertEqual(meetings[2].meeting_name,
'Test meeting with reminder')
+ # pylint: disable=C0103
def test_get_future_single_meeting_of_user_fail(self):
""" Test the Meeting get_future_single_meeting_of_user function
when there is no such user or the date has simply nothing
@@ -473,6 +482,7 @@ class Meetingtests(Modeltests):
self.assertEqual(len(meetings), 0)
self.assertEqual(meetings, [])
+ # pylint: disable=C0103
def test_get_future_regular_meeting_of_user(self):
""" Test the Meeting get_future_regular_meeting_of_user function.
"""
@@ -488,6 +498,7 @@ class Meetingtests(Modeltests):
self.assertEqual(meetings[2].meeting_name,
'Test meeting with reminder and recursion')
+ # pylint: disable=C0103
def test_get_future_regular_meeting_of_user_fail(self):
""" Test the Meeting get_future_regular_meeting_of_user function
when the user does not exist or the date has simply nothing
@@ -505,6 +516,7 @@ class Meetingtests(Modeltests):
self.assertEqual(len(meetings), 0)
self.assertEqual(meetings, [])
+ # pylint: disable=C0103
def test_get_meeting_with_reminder(self):
""" Test the Meeting get_meeting_with_reminder function. """
self.test_init_meeting()
11 years, 1 month
[fedocal] master: Show today class today only :) (bb348e4)
by trasher@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit bb348e4ce0b130f9290b2ee2dff1837752c4686a
Author: Johan Cwiklinski <johan(a)x-tnd.be>
Date: Thu Nov 8 20:55:43 2012 +0100
Show today class today only :)
>---------------------------------------------------------------
fedocal/__init__.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/fedocal/__init__.py b/fedocal/__init__.py
index c73b9db..5347f54 100644
--- a/fedocal/__init__.py
+++ b/fedocal/__init__.py
@@ -145,7 +145,6 @@ def calendar_fullday(calendar_name, year, month, day):
calendarobj = Calendar.by_id(SESSION, calendar_name)
week_start = fedocallib.get_start_week(year, month, day)
weekdays = fedocallib.get_week_days(year, month, day)
- day_index = fedocallib.get_week_day_index(year, month, day)
tzone = get_timezone()
meetings = fedocallib.get_meetings(SESSION, calendarobj, year,
month, day, tzone=tzone)
@@ -156,6 +155,12 @@ def calendar_fullday(calendar_name, year, month, day):
auth_form = forms.LoginForm()
admin = is_admin()
month_name = week_start.strftime('%B')
+
+ day_index = None
+ today=datetime.date.today()
+ if today > week_start and today < week_start + datetime.timedelta(days=7):
+ day_index = fedocallib.get_week_day_index(today.year, today.month, today.day)
+
curmonth_cal = fedocallib.get_html_monthly_cal(year=year,
month=month, calendar_name=calendar_name)
return flask.render_template('agenda.html',
11 years, 1 month
[fedocal] master: Ignore config files (8a6e3c2)
by Johan Cwiklinski
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 8a6e3c2a7aac79d4e78f2076cd2f391133952510
Author: Johan Cwiklinski <johan(a)x-tnd.be>
Date: Thu Nov 8 20:41:48 2012 +0100
Ignore config files
>---------------------------------------------------------------
.gitignore | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 7d2d53b..9fd5698 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,5 @@ build
.project
.pydevproject
.coverage
+fedocal/fedocal.cfg
+alembic.ini
11 years, 1 month
[fedocal] master: Move config file to sample config file, to avoid passwords commits :p (d473ded)
by trasher@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit d473ded72d85517d6b068add8097de49721f89c0
Author: Johan Cwiklinski <johan(a)x-tnd.be>
Date: Thu Nov 8 20:38:52 2012 +0100
Move config file to sample config file, to avoid passwords commits :p
>---------------------------------------------------------------
README.rst | 3 ++-
alembic.ini => alembic.ini.sample | 0
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/README.rst b/README.rst
index 8121773..3895891 100644
--- a/README.rst
+++ b/README.rst
@@ -158,7 +158,8 @@ is not up to date, then you will have to run::
alembic upgrade head
.. note:: If this is the first time you are running ``alembic``, you will
- need to setup the ``sqlalchemy.url`` variable in the tile ``alembic.ini``.
+ need to copy file ``elembic.ini.smaple`` to ``alembic.ini`` and setup
+ the ``sqlalchemy.url`` variable in the latest
If you are a developer, you probably want to have a look at the `alembic tutorial`_
diff --git a/alembic.ini b/alembic.ini.sample
similarity index 100%
rename from alembic.ini
rename to alembic.ini.sample
11 years, 1 month
[fedocal] master: Align hours at top in agenda view (d13dd13)
by trasher@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit d13dd134c740bd0ef49282a67e1020195951f5b6
Author: Johan Cwiklinski <johan(a)x-tnd.be>
Date: Thu Nov 8 20:36:17 2012 +0100
Align hours at top in agenda view
>---------------------------------------------------------------
fedocal/static/fedocal.css | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fedocal/static/fedocal.css b/fedocal/static/fedocal.css
index da1591f..4595f2d 100644
--- a/fedocal/static/fedocal.css
+++ b/fedocal/static/fedocal.css
@@ -132,6 +132,7 @@ section nav {
padding-right: .2em;
text-align: right;
width: 7em;
+ vertical-align: top;
}
#agenda .today {
11 years, 1 month
[fedocal] master: python-alembic is the rpm name not the pypi one (65f9d79)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 65f9d79c71aedb98da5ab53fa564dd192e16ea9a
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Nov 8 19:42:36 2012 +0100
python-alembic is the rpm name not the pypi one
>---------------------------------------------------------------
requirements.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index 931f320..385570c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -8,4 +8,4 @@ vobject
kitchen
python-fedora
pytz
-python-alembic
+alembic
11 years, 1 month
[fedocal] master: Typo in the pytz deps (b544943)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit b5449433c108f124b0a9fc0e0753a012e17a64a0
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Nov 8 19:27:54 2012 +0100
Typo in the pytz deps
>---------------------------------------------------------------
requirements.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index 56e8a6e..931f320 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -7,5 +7,5 @@ Flask-wtf
vobject
kitchen
python-fedora
-pyzt
+pytz
python-alembic
11 years, 1 month