[fedocal] master: Oupsy, I had forgot to fix that tests (3df7cc3)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 3df7cc3ec941b661508d1e38609f985bff727f2c
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Nov 8 08:52:46 2012 +0100
Oupsy, I had forgot to fix that tests
>---------------------------------------------------------------
fedocal/tests/test_meeting.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fedocal/tests/test_meeting.py b/fedocal/tests/test_meeting.py
index 5a72354..82cde15 100644
--- a/fedocal/tests/test_meeting.py
+++ b/fedocal/tests/test_meeting.py
@@ -284,12 +284,13 @@ class Meetingtests(Modeltests):
'"meeting_name": "Fedora-fr-test-meeting",\n '\
'"meeting_manager": "pingou, shaiton",\n '\
'"meeting_date": "%s",\n '\
+ '"meeting_date_end": "%s",\n '\
'"meeting_time_start": "19:00:00",\n '\
'"meeting_time_stop": "20:00:00",\n '\
'"meeting_information": "This is a test meeting",\n '\
'"meeting_region": "None",\n '\
'"calendar_name": "test_calendar"\n'\
- '}' % TODAY
+ '}' % (TODAY, TODAY)
self.assertEqual(obj.to_json(), exp)
def test_get_by_date(self):
10 years, 10 months
[fedocal] master: Add documentation about alembic: dependencies and usage (155c023)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 155c02331e8d3d83c7b50c5e9690f68ce556f62c
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Nov 8 08:49:43 2012 +0100
Add documentation about alembic: dependencies and usage
>---------------------------------------------------------------
README.rst | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/README.rst b/README.rst
index 784234d..dbd9550 100644
--- a/README.rst
+++ b/README.rst
@@ -25,11 +25,14 @@ Dependencies:
.. _python-vobject: http://vobject.skyhouseconsulting.com/
.. _iCal: http://en.wikipedia.org/wiki/ICalendar
.. _python-kitchen: http://packages.python.org/kitchen/
+.. _alembic: https://bitbucket.org/zzzeek/alembic
+.. _python-alembic: http://pypi.python.org/pypi/alembic
This project is a `Flask`_ application. The calendars and meetings are
stored into a relational database using `SQLAlchemy`_ as Object Relational
-Mapper (ORM). fedocal provides an `iCal`_ feed for each calendar and relies
-on `python-vobject`_ for this.
+Mapper (ORM) and `alembic`_ to handle database scheme changes.
+fedocal provides an `iCal`_ feed for each calendar and relies on
+`python-vobject`_ for this.
The dependency list is therefore:
@@ -41,6 +44,7 @@ The dependency list is therefore:
- `python-sqlalchemy`_
- `python-vobject`_
- `python-kitchen`_
+- `python-alembic`_
Running a development instance:
@@ -136,6 +140,27 @@ To run them::
./run_tests.sh
+Database changes:
+-----------------
+.. _alembic tutorial: http://alembic.readthedocs.org/en/latest/tutorial.html
+
+The database changes are handled via `alembic`.
+
+
+If you are deploying fedocal for the first time, you will not need this,
+however, if you already have a running fedocal but the database scheme
+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``.
+
+
+If you are a developer, you probably want to have a look at the `alembic tutorial`_
+
+
License:
--------
10 years, 10 months
[fedocal] master: Let's not keep twice the documentation (b11c3b9)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit b11c3b951cd311e5677cf68144741eb9da2e3d56
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Nov 8 08:49:14 2012 +0100
Let's not keep twice the documentation
>---------------------------------------------------------------
README.html | 431 -----------------------------------------------------------
1 files changed, 0 insertions(+), 431 deletions(-)
diff --git a/README.html b/README.html
deleted file mode 100644
index f44ff09..0000000
--- a/README.html
+++ /dev/null
@@ -1,431 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.8.1: http://docutils.sourceforge.net/" />
-<title>fedocal</title>
-<meta name="author" content="Pierre-Yves Chibon <pingou@pingoured.fr>" />
-<style type="text/css">
-
-/*
-:Author: David Goodger (goodger(a)python.org)
-:Id: $Id: html4css1.css 7056 2011-06-17 10:50:48Z milde $
-:Copyright: This stylesheet has been placed in the public domain.
-
-Default cascading style sheet for the HTML output of Docutils.
-
-See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
-customize this style sheet.
-*/
-
-/* used to remove borders from tables and images */
-.borderless, table.borderless td, table.borderless th {
- border: 0 }
-
-table.borderless td, table.borderless th {
- /* Override padding for "table.docutils td" with "! important".
- The right padding separates the table cells. */
- padding: 0 0.5em 0 0 ! important }
-
-.first {
- /* Override more specific margin styles with "! important". */
- margin-top: 0 ! important }
-
-.last, .with-subtitle {
- margin-bottom: 0 ! important }
-
-.hidden {
- display: none }
-
-a.toc-backref {
- text-decoration: none ;
- color: black }
-
-blockquote.epigraph {
- margin: 2em 5em ; }
-
-dl.docutils dd {
- margin-bottom: 0.5em }
-
-object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
- overflow: hidden;
-}
-
-/* Uncomment (and remove this text!) to get bold-faced definition list terms
-dl.docutils dt {
- font-weight: bold }
-*/
-
-div.abstract {
- margin: 2em 5em }
-
-div.abstract p.topic-title {
- font-weight: bold ;
- text-align: center }
-
-div.admonition, div.attention, div.caution, div.danger, div.error,
-div.hint, div.important, div.note, div.tip, div.warning {
- margin: 2em ;
- border: medium outset ;
- padding: 1em }
-
-div.admonition p.admonition-title, div.hint p.admonition-title,
-div.important p.admonition-title, div.note p.admonition-title,
-div.tip p.admonition-title {
- font-weight: bold ;
- font-family: sans-serif }
-
-div.attention p.admonition-title, div.caution p.admonition-title,
-div.danger p.admonition-title, div.error p.admonition-title,
-div.warning p.admonition-title {
- color: red ;
- font-weight: bold ;
- font-family: sans-serif }
-
-/* Uncomment (and remove this text!) to get reduced vertical space in
- compound paragraphs.
-div.compound .compound-first, div.compound .compound-middle {
- margin-bottom: 0.5em }
-
-div.compound .compound-last, div.compound .compound-middle {
- margin-top: 0.5em }
-*/
-
-div.dedication {
- margin: 2em 5em ;
- text-align: center ;
- font-style: italic }
-
-div.dedication p.topic-title {
- font-weight: bold ;
- font-style: normal }
-
-div.figure {
- margin-left: 2em ;
- margin-right: 2em }
-
-div.footer, div.header {
- clear: both;
- font-size: smaller }
-
-div.line-block {
- display: block ;
- margin-top: 1em ;
- margin-bottom: 1em }
-
-div.line-block div.line-block {
- margin-top: 0 ;
- margin-bottom: 0 ;
- margin-left: 1.5em }
-
-div.sidebar {
- margin: 0 0 0.5em 1em ;
- border: medium outset ;
- padding: 1em ;
- background-color: #ffffee ;
- width: 40% ;
- float: right ;
- clear: right }
-
-div.sidebar p.rubric {
- font-family: sans-serif ;
- font-size: medium }
-
-div.system-messages {
- margin: 5em }
-
-div.system-messages h1 {
- color: red }
-
-div.system-message {
- border: medium outset ;
- padding: 1em }
-
-div.system-message p.system-message-title {
- color: red ;
- font-weight: bold }
-
-div.topic {
- margin: 2em }
-
-h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
-h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
- margin-top: 0.4em }
-
-h1.title {
- text-align: center }
-
-h2.subtitle {
- text-align: center }
-
-hr.docutils {
- width: 75% }
-
-img.align-left, .figure.align-left, object.align-left {
- clear: left ;
- float: left ;
- margin-right: 1em }
-
-img.align-right, .figure.align-right, object.align-right {
- clear: right ;
- float: right ;
- margin-left: 1em }
-
-img.align-center, .figure.align-center, object.align-center {
- display: block;
- margin-left: auto;
- margin-right: auto;
-}
-
-.align-left {
- text-align: left }
-
-.align-center {
- clear: both ;
- text-align: center }
-
-.align-right {
- text-align: right }
-
-/* reset inner alignment in figures */
-div.align-right {
- text-align: inherit }
-
-/* div.align-center * { */
-/* text-align: left } */
-
-ol.simple, ul.simple {
- margin-bottom: 1em }
-
-ol.arabic {
- list-style: decimal }
-
-ol.loweralpha {
- list-style: lower-alpha }
-
-ol.upperalpha {
- list-style: upper-alpha }
-
-ol.lowerroman {
- list-style: lower-roman }
-
-ol.upperroman {
- list-style: upper-roman }
-
-p.attribution {
- text-align: right ;
- margin-left: 50% }
-
-p.caption {
- font-style: italic }
-
-p.credits {
- font-style: italic ;
- font-size: smaller }
-
-p.label {
- white-space: nowrap }
-
-p.rubric {
- font-weight: bold ;
- font-size: larger ;
- color: maroon ;
- text-align: center }
-
-p.sidebar-title {
- font-family: sans-serif ;
- font-weight: bold ;
- font-size: larger }
-
-p.sidebar-subtitle {
- font-family: sans-serif ;
- font-weight: bold }
-
-p.topic-title {
- font-weight: bold }
-
-pre.address {
- margin-bottom: 0 ;
- margin-top: 0 ;
- font: inherit }
-
-pre.literal-block, pre.doctest-block, pre.math {
- margin-left: 2em ;
- margin-right: 2em }
-
-span.classifier {
- font-family: sans-serif ;
- font-style: oblique }
-
-span.classifier-delimiter {
- font-family: sans-serif ;
- font-weight: bold }
-
-span.interpreted {
- font-family: sans-serif }
-
-span.option {
- white-space: nowrap }
-
-span.pre {
- white-space: pre }
-
-span.problematic {
- color: red }
-
-span.section-subtitle {
- /* font-size relative to parent (h1..h6 element) */
- font-size: 80% }
-
-table.citation {
- border-left: solid 1px gray;
- margin-left: 1px }
-
-table.docinfo {
- margin: 2em 4em }
-
-table.docutils {
- margin-top: 0.5em ;
- margin-bottom: 0.5em }
-
-table.footnote {
- border-left: solid 1px black;
- margin-left: 1px }
-
-table.docutils td, table.docutils th,
-table.docinfo td, table.docinfo th {
- padding-left: 0.5em ;
- padding-right: 0.5em ;
- vertical-align: top }
-
-table.docutils th.field-name, table.docinfo th.docinfo-name {
- font-weight: bold ;
- text-align: left ;
- white-space: nowrap ;
- padding-left: 0 }
-
-h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
-h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
- font-size: 100% }
-
-ul.auto-toc {
- list-style-type: none }
-
-</style>
-</head>
-<body>
-<div class="document" id="fedocal">
-<h1 class="title">fedocal</h1>
-<table class="docinfo" frame="void" rules="none">
-<col class="docinfo-name" />
-<col class="docinfo-content" />
-<tbody valign="top">
-<tr><th class="docinfo-name">Author:</th>
-<td>Pierre-Yves Chibon <<a class="reference external" href="mailto:pingou@pingoured.fr">pingou@pingoured.fr</a>></td></tr>
-</tbody>
-</table>
-<p>fedocal is a web based calendar application.</p>
-<div class="section" id="get-this-project">
-<h1>Get this project:</h1>
-<p>Source: <a class="reference external" href="https://github.com/pypingou/fedocal">https://github.com/pypingou/fedocal</a></p>
-</div>
-<div class="section" id="dependencies">
-<h1>Dependencies:</h1>
-<p>This project is a <a class="reference external" href="http://flask.pocoo.org/">Flask</a> application. The calendars and meetings are
-stored into a relational database using <a class="reference external" href="http://www.sqlalchemy.org/">SQLAlchemy</a> as Object Relational
-Mapper (ORM). fedocal provides an <a class="reference external" href="http://en.wikipedia.org/wiki/ICalendar">iCal</a> feed for each calendar and relies
-on <a class="reference external" href="http://vobject.skyhouseconsulting.com/">python-vobject</a> for this.</p>
-<p>The dependency list is therefore:</p>
-<ul class="simple">
-<li><a class="reference external" href="http://www.python.org">python</a> (2.5 minimum)</li>
-<li><a class="reference external" href="http://flask.pocoo.org/">python-flask</a></li>
-<li><a class="reference external" href="http://packages.python.org/Flask-WTF/">python-flask-wtf</a></li>
-<li><a class="reference external" href="http://wtforms.simplecodes.com/docs/1.0.1/">python-wtforms</a></li>
-<li><a class="reference external" href="http://www.sqlalchemy.org/">python-sqlalchemy</a></li>
-<li><a class="reference external" href="http://vobject.skyhouseconsulting.com/">python-vobject</a></li>
-<li><a class="reference external" href="http://packages.python.org/kitchen/">python-kitchen</a></li>
-</ul>
-</div>
-<div class="section" id="running-a-development-instance">
-<h1>Running a development instance:</h1>
-<p>Clone the source:</p>
-<pre class="literal-block">
-git clone https://github.com/pypingou/fedocal.git
-</pre>
-<p>Copy the configuration file:</p>
-<pre class="literal-block">
-cp fedocal.cfg.sample fedocal.cfg
-</pre>
-<p>Adjust the configuration file (secret key, database URL, admin group...)</p>
-<p>Create the database scheme:</p>
-<pre class="literal-block">
-python fedocal/fedocallib/model.py
-</pre>
-<dl class="docutils">
-<dt>Run the server::</dt>
-<dd>python fedocal/__init__.py</dd>
-</dl>
-<p>You should be able to access the server at <a class="reference external" href="http://localhost:5000">http://localhost:5000</a></p>
-</div>
-<div class="section" id="deploying-this-project">
-<h1>Deploying this project:</h1>
-<p>Instruction to deploy this application is available on the
-<a class="reference external" href="http://flask.pocoo.org/docs/deploying/">Flask deployment documentation</a> page.</p>
-<blockquote>
-<strong>My approach.</strong></blockquote>
-<p>Below is the approach I took to deploy the instance on a local (test) machine.</p>
-<p>Retrieve the sources:</p>
-<pre class="literal-block">
-cd /srv/
-git clone <repo>
-cd fedocal
-</pre>
-<p>Copy the configuration file:</p>
-<pre class="literal-block">
-cp fedocal.cfg.sample fedocal.cfg
-</pre>
-<p>Adjust the configuration file (secret key, database URL, admin group...)</p>
-<p>Create the database scheme:</p>
-<pre class="literal-block">
-python fedocal/fedocallib/model.py
-</pre>
-<p>Then configure apache:</p>
-<pre class="literal-block">
-sudo vim /etc/httd/conf.d/wsgi.conf
-</pre>
-<p>and put in this file:</p>
-<pre class="literal-block">
-WSGIScriptAlias /fedocal /var/www/wsgi/fedocal.wsgi
-<Directory /var/www/wsgi/>
- Order deny,allow
- Allow from all
-</Directory>
-</pre>
-<p>Then create the file /var/www/wsgi/fedocal.wsgi with:</p>
-<pre class="literal-block">
-import sys
-sys.path.insert(0, '/mnt/fedocal/')
-
-import fedocal
-application = fedocal.APP
-</pre>
-<p>Then restart apache and you should be able to access the website on
-<a class="reference external" href="http://localhost/fedocal">http://localhost/fedocal</a></p>
-</div>
-<div class="section" id="testing">
-<h1>Testing:</h1>
-<p>This project contains unit-tests allowing you to check if your server
-has all the dependencies correctly set.</p>
-<p>To run them:</p>
-<pre class="literal-block">
-./run_tests.sh
-</pre>
-</div>
-<div class="section" id="license">
-<h1>License:</h1>
-<p>This project is licensed GPLv3+.</p>
-</div>
-</div>
-</body>
-</html>
10 years, 10 months
[fedocal] master: Implement the meeting_date_end into the controler, forms and tests (e6cb607)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit e6cb607e1e89286ea5a7acd1a2e9e94bc57e8dd9
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Nov 8 08:35:08 2012 +0100
Implement the meeting_date_end into the controler, forms and tests
>---------------------------------------------------------------
fedocal/__init__.py | 8 ++++++++
fedocal/fedocallib/model.py | 12 +++++++++---
fedocal/forms.py | 3 +++
fedocal/tests/test_meeting.py | 9 +++++++++
4 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/fedocal/__init__.py b/fedocal/__init__.py
index 3ad1f0d..7e67688 100644
--- a/fedocal/__init__.py
+++ b/fedocal/__init__.py
@@ -293,10 +293,14 @@ def add_meeting(calendar_name):
region = form.meeting_region.data
if not calendarobj.calendar_regional_meetings or not region:
region = None
+ meeting_end_date = form.meeting_date_end.data
+ if not meeting_end_date:
+ meeting_end_date = form.meeting_date.date
meeting = Meeting(
meeting_name=form.meeting_name.data,
meeting_manager=manager,
meeting_date=form.meeting_date.data,
+ meeting_date_end=meeting_end_date,
meeting_time_start=datetime.time(int(
form.meeting_time_start.data)),
meeting_time_stop=datetime.time(int(
@@ -380,6 +384,10 @@ def edit_meeting(meeting_id):
meeting.meeting_manager = '%s,%s' % (
flask.g.fas_user.username, form.comanager.data)
meeting.meeting_date = form.meeting_date.data
+ meeting_end_date = form.meeting_date_end.data
+ if not meeting_end_date:
+ meeting_end_date = form.meeting_date.date
+ 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(
diff --git a/fedocal/fedocallib/model.py b/fedocal/fedocallib/model.py
index 66ae53a..c437de1 100644
--- a/fedocal/fedocallib/model.py
+++ b/fedocal/fedocallib/model.py
@@ -133,6 +133,7 @@ class Meeting(BASE):
calendar = relationship("Calendar")
meeting_manager = Column(String(160)) ##5 person max (32 * 5)
meeting_date = Column(Date, default=datetime.utcnow().date())
+ meeting_date_end = Column(Date, default=datetime.utcnow().date())
meeting_time_start = Column(Time, default=datetime.utcnow().time())
meeting_time_stop = Column(Time, default=datetime.utcnow().time())
meeting_information = Column(Text)
@@ -145,7 +146,8 @@ class Meeting(BASE):
recursion_ends = Column(Date, nullable=True, default=None)
def __init__(self, meeting_name, meeting_manager,
- meeting_date, meeting_time_start, meeting_time_stop,
+ meeting_date, meeting_date_end,
+ meeting_time_start, meeting_time_stop,
meeting_information, calendar_name, reminder_id=None,
meeting_region=None, recursion_frequency=None,
recursion_ends=None):
@@ -153,6 +155,7 @@ class Meeting(BASE):
self.meeting_name = meeting_name
self.meeting_manager = meeting_manager
self.meeting_date = meeting_date
+ self.meeting_date_end = meeting_date_end
self.meeting_time_start = meeting_time_start
self.meeting_time_stop = meeting_time_stop
self.meeting_information = meeting_information
@@ -182,6 +185,8 @@ class Meeting(BASE):
self.meeting_manager)
string = '%s\n "meeting_date": "%s",' % (string,
self.meeting_date)
+ string = '%s\n "meeting_date_end": "%s",' % (string,
+ self.meeting_date_end)
string = '%s\n "meeting_time_start": "%s",' % (string,
self.meeting_time_start)
string = '%s\n "meeting_time_stop": "%s",' % (string,
@@ -223,8 +228,9 @@ class Meeting(BASE):
meeting.recursion_ends = self.recursion_ends
else:
meeting = Meeting(self.meeting_name, self.meeting_manager,
- self.meeting_date, self.meeting_time_start,
- self.meeting_time_stop, self.meeting_information,
+ self.meeting_date, self.meeting_date_end,
+ self.meeting_time_start, self.meeting_time_stop,
+ self.meeting_information,
self.calendar_name,
self.reminder_id,
self.meeting_region,
diff --git a/fedocal/forms.py b/fedocal/forms.py
index 81a3da8..e57a6bf 100644
--- a/fedocal/forms.py
+++ b/fedocal/forms.py
@@ -47,6 +47,8 @@ class AddMeetingForm(wtf.Form):
[wtf.validators.Required()])
meeting_date = wtf.DateField('Date', [wtf.validators.Required()])
+ meeting_date_end = wtf.DateField('End date',
+ [wtf.validators.optional()])
meeting_time_start = wtf.SelectField('Start time',
[wtf.validators.Required()],
@@ -104,6 +106,7 @@ class AddMeetingForm(wtf.Form):
self.meeting_name.data = meeting.meeting_name
self.meeting_date.data = meeting.meeting_date
+ self.meeting_date_end.data = meeting.meeting_date_end
self.meeting_time_start.data = start_hour
self.meeting_time_stop.data = stop_hour
self.information.data = meeting.meeting_information
diff --git a/fedocal/tests/test_meeting.py b/fedocal/tests/test_meeting.py
index ebea2d5..5a72354 100644
--- a/fedocal/tests/test_meeting.py
+++ b/fedocal/tests/test_meeting.py
@@ -60,6 +60,7 @@ class Meetingtests(Modeltests):
meeting_name='Fedora-fr-test-meeting',
meeting_manager='pingou, shaiton',
meeting_date=TODAY,
+ meeting_date_end=TODAY,
meeting_time_start=time(19, 00),
meeting_time_stop=time(20, 00),
meeting_information='This is a test meeting',
@@ -72,6 +73,7 @@ class Meetingtests(Modeltests):
meeting_name='test-meeting2',
meeting_manager='pingou',
meeting_date=TODAY + timedelta(days=10),
+ meeting_date_end=TODAY + timedelta(days=10),
meeting_time_start=time(14, 00),
meeting_time_stop=time(16, 00),
meeting_information='This is another test meeting',
@@ -85,6 +87,7 @@ class Meetingtests(Modeltests):
meeting_name='test-meeting3',
meeting_manager='test2',
meeting_date=TODAY - timedelta(days=16),
+ meeting_date_end=TODAY - timedelta(days=16),
meeting_time_start=time(14, 00),
meeting_time_stop=time(16, 00),
meeting_information='Test meeting with past end_recursion.',
@@ -100,6 +103,7 @@ class Meetingtests(Modeltests):
meeting_name='test-meeting-st-1',
meeting_manager='test',
meeting_date=TODAY + timedelta(days=1),
+ meeting_date_end=TODAY + timedelta(days=1),
meeting_time_start=time(14, 00),
meeting_time_stop=time(16, 00),
meeting_information='This is a test meeting at the same time',
@@ -113,6 +117,7 @@ class Meetingtests(Modeltests):
meeting_name='test-meeting-st-2',
meeting_manager='test',
meeting_date=TODAY + timedelta(days=1),
+ 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',
@@ -127,6 +132,7 @@ class Meetingtests(Modeltests):
meeting_name='Another test meeting',
meeting_manager='pingou',
meeting_date=TODAY + timedelta(days=10),
+ meeting_date_end=TODAY + timedelta(days=10),
meeting_time_start=time(2, 00),
meeting_time_stop=time(3, 00),
meeting_information='This is a test meeting with recursion',
@@ -138,6 +144,7 @@ class Meetingtests(Modeltests):
meeting_name='Another test meeting2',
meeting_manager='pingou',
meeting_date=TODAY,
+ meeting_date_end=TODAY,
meeting_time_start=time(12, 00),
meeting_time_stop=time(13, 00),
meeting_information='This is a test meeting with recursion2',
@@ -157,6 +164,7 @@ class Meetingtests(Modeltests):
meeting_name='Test meeting with reminder',
meeting_manager='pingou',
meeting_date=TODAY + timedelta(days=11),
+ meeting_date_end=TODAY + timedelta(days=11),
meeting_time_start=time(11, 00),
meeting_time_stop=time(12, 00),
meeting_information='This is a test meeting with reminder',
@@ -176,6 +184,7 @@ class Meetingtests(Modeltests):
meeting_name='Test meeting with reminder and recursion',
meeting_manager='pingou',
meeting_date=TODAY + timedelta(days=12),
+ 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',
10 years, 10 months
[fedocal] master: Remove debugging print (d2dff5b)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit d2dff5bb8bce8150c09c5dac6a0d2a08ad911e7b
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Nov 8 08:31:30 2012 +0100
Remove debugging print
>---------------------------------------------------------------
fedocal/__init__.py | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/fedocal/__init__.py b/fedocal/__init__.py
index 053ef7c..3ad1f0d 100644
--- a/fedocal/__init__.py
+++ b/fedocal/__init__.py
@@ -258,12 +258,6 @@ def add_meeting(calendar_name):
form = forms.AddMeetingForm()
calendarobj = Calendar.by_id(SESSION, calendar_name)
if form.validate_on_submit():
- print fedocallib.agenda_is_free(SESSION,
- calendarobj,
- form.meeting_date.data,
- int(form.meeting_time_start.data),
- int(form.meeting_time_stop.data)
- )
if not fedocallib.is_user_managing_in_calendar(SESSION,
calendarobj.calendar_name, flask.g.fas_user):
flask.flash('You are not allowed to add a meeting to'\
10 years, 10 months
[fedocal] master: Add alembic to this project and add the first scheme revision (e549e46)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit e549e46d86018a326b1281391f16df19c158b325
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Nov 8 08:29:00 2012 +0100
Add alembic to this project and add the first scheme revision
>---------------------------------------------------------------
alembic.ini | 50 ++++++++++++++
alembic/env.py | 71 ++++++++++++++++++++
alembic/script.py.mako | 22 ++++++
.../versions/2c5c36431061_add_the_meeting_date.py | 26 +++++++
4 files changed, 169 insertions(+), 0 deletions(-)
diff --git a/alembic.ini b/alembic.ini
new file mode 100644
index 0000000..848a387
--- /dev/null
+++ b/alembic.ini
@@ -0,0 +1,50 @@
+# A generic, single database configuration.
+
+[alembic]
+# path to migration scripts
+script_location = alembic
+
+# template used to generate migration files
+# file_template = %%(rev)s_%%(slug)s
+
+# set to 'true' to run the environment during
+# the 'revision' command, regardless of autogenerate
+# revision_environment = false
+
+sqlalchemy.url = driver://user:pass@localhost/dbname
+
+
+# Logging configuration
+[loggers]
+keys = root,sqlalchemy,alembic
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = WARN
+handlers = console
+qualname =
+
+[logger_sqlalchemy]
+level = WARN
+handlers =
+qualname = sqlalchemy.engine
+
+[logger_alembic]
+level = INFO
+handlers =
+qualname = alembic
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(levelname)-5.5s [%(name)s] %(message)s
+datefmt = %H:%M:%S
diff --git a/alembic/env.py b/alembic/env.py
new file mode 100644
index 0000000..229ed7e
--- /dev/null
+++ b/alembic/env.py
@@ -0,0 +1,71 @@
+from __future__ import with_statement
+from alembic import context
+from sqlalchemy import engine_from_config, pool
+from logging.config import fileConfig
+
+# this is the Alembic Config object, which provides
+# access to the values within the .ini file in use.
+config = context.config
+
+# Interpret the config file for Python logging.
+# This line sets up loggers basically.
+fileConfig(config.config_file_name)
+
+# add your model's MetaData object here
+# for 'autogenerate' support
+# from myapp import mymodel
+# target_metadata = mymodel.Base.metadata
+target_metadata = None
+
+# other values from the config, defined by the needs of env.py,
+# can be acquired:
+# my_important_option = config.get_main_option("my_important_option")
+# ... etc.
+
+def run_migrations_offline():
+ """Run migrations in 'offline' mode.
+
+ This configures the context with just a URL
+ and not an Engine, though an Engine is acceptable
+ here as well. By skipping the Engine creation
+ we don't even need a DBAPI to be available.
+
+ Calls to context.execute() here emit the given string to the
+ script output.
+
+ """
+ url = config.get_main_option("sqlalchemy.url")
+ context.configure(url=url)
+
+ with context.begin_transaction():
+ context.run_migrations()
+
+def run_migrations_online():
+ """Run migrations in 'online' mode.
+
+ In this scenario we need to create an Engine
+ and associate a connection with the context.
+
+ """
+ engine = engine_from_config(
+ config.get_section(config.config_ini_section),
+ prefix='sqlalchemy.',
+ poolclass=pool.NullPool)
+
+ connection = engine.connect()
+ context.configure(
+ connection=connection,
+ target_metadata=target_metadata
+ )
+
+ try:
+ with context.begin_transaction():
+ context.run_migrations()
+ finally:
+ connection.close()
+
+if context.is_offline_mode():
+ run_migrations_offline()
+else:
+ run_migrations_online()
+
diff --git a/alembic/script.py.mako b/alembic/script.py.mako
new file mode 100644
index 0000000..9570201
--- /dev/null
+++ b/alembic/script.py.mako
@@ -0,0 +1,22 @@
+"""${message}
+
+Revision ID: ${up_revision}
+Revises: ${down_revision}
+Create Date: ${create_date}
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = ${repr(up_revision)}
+down_revision = ${repr(down_revision)}
+
+from alembic import op
+import sqlalchemy as sa
+${imports if imports else ""}
+
+def upgrade():
+ ${upgrades if upgrades else "pass"}
+
+
+def downgrade():
+ ${downgrades if downgrades else "pass"}
diff --git a/alembic/versions/2c5c36431061_add_the_meeting_date.py b/alembic/versions/2c5c36431061_add_the_meeting_date.py
new file mode 100644
index 0000000..96c7877
--- /dev/null
+++ b/alembic/versions/2c5c36431061_add_the_meeting_date.py
@@ -0,0 +1,26 @@
+"""Add the meeting_date_end field to the meetings table
+
+Revision ID: 2c5c36431061
+Revises: None
+Create Date: 2012-11-08 08:24:43.044403
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '2c5c36431061'
+down_revision = None
+
+from alembic import op
+import sqlalchemy as sa
+import datetime
+
+
+def upgrade():
+ ''' Add the meeting_date_end column to the meetings table '''
+ op.add_column('meetings', sa.Column('meeting_date_end', sa.Date,
+ default=datetime.utcnow().date())
+
+
+def downgrade():
+ ''' Drop the meeting_date_end column to the meetings table '''
+ op.drop_column('meetings', 'meeting_date_end')
10 years, 10 months
[fedocal] master: get_week_days now returns dates instead of strings (f4a4e04)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit f4a4e041b519ab48c2d3b8b7d608f651ee42c6f6
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Tue Nov 6 19:42:00 2012 +0100
get_week_days now returns dates instead of strings
>---------------------------------------------------------------
fedocal/fedocallib/__init__.py | 3 +--
fedocal/tests/test_fedocallib.py | 5 +++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fedocal/fedocallib/__init__.py b/fedocal/fedocallib/__init__.py
index c4b1c6b..e050e54 100644
--- a/fedocal/fedocallib/__init__.py
+++ b/fedocal/fedocallib/__init__.py
@@ -167,8 +167,7 @@ def get_week_days(year=None, month=None, day=None):
weekdays = []
for i in range(0, 7):
curday = week_start + timedelta(days=i)
- curday_txt = curday.strftime('%A %d')
- weekdays.append(curday_txt)
+ weekdays.append(curday)
return weekdays
diff --git a/fedocal/tests/test_fedocallib.py b/fedocal/tests/test_fedocallib.py
index 6c5e519..558550f 100644
--- a/fedocal/tests/test_fedocallib.py
+++ b/fedocal/tests/test_fedocallib.py
@@ -170,8 +170,9 @@ class Fedocallibtests(Modeltests):
def test_get_week_days(self):
""" Test the get_week_days function. """
- expectdays = ['Monday 01', 'Tuesday 02', 'Wednesday 03',
- 'Thursday 04', 'Friday 05', 'Saturday 06', 'Sunday 07']
+ expectdays = [date(2012, 10, 1), date(2012, 10, 2),
+ date(2012, 10, 3), date(2012, 10, 4), date(2012, 10, 5),
+ date(2012, 10, 6), date(2012, 10, 7)]
days = fedocallib.get_week_days(2012, 10, 3)
self.assertNotEqual(days, None)
self.assertEqual(days, expectdays)
10 years, 10 months
[fedocal] master: Adjust the agenda template to format the date correctly as well as use the new filter for the week heading (300afac)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 300afac82efaf9abc680f97dc3d28d8a17296acd
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Tue Nov 6 19:42:31 2012 +0100
Adjust the agenda template to format the date correctly as well as use the new filter for the week heading
>---------------------------------------------------------------
fedocal/templates/agenda.html | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/fedocal/templates/agenda.html b/fedocal/templates/agenda.html
index 54af0b4..a22d63b 100644
--- a/fedocal/templates/agenda.html
+++ b/fedocal/templates/agenda.html
@@ -19,16 +19,14 @@
<nav id="weeks">
<a href="{{url_for('calendar_fullday',
calendar_name=calendar.calendar_name, year=prev_week.year,
- month=prev_week.month, day=prev_week.day)}}">
- << Previous week
- </a> |
- <a href="{{url_for('calendar', calendar_name=calendar.calendar_name)}}">
- current week
- </a> |
+ month=prev_week.month, day=prev_week.day)}}" class="button">
+ <
+ </a>
+ {{ weekdays | WeekHeading }}
<a href="{{url_for('calendar_fullday',
calendar_name=calendar.calendar_name, year=next_week.year,
- month=next_week.month, day=next_week.day)}}">
- Next week >>
+ month=next_week.month, day=next_week.day)}}" class="button">
+ >
</a>
</nav>
{% endif %}
@@ -37,7 +35,7 @@
<tr>
<th></th>
{% for day in weekdays %}
- <th> {{ day }}</th>
+ <th> {{ day.strftime('%A %d') }}</th>
{% endfor %}
</tr>
{% for time_entry in meetings |sort %}
10 years, 10 months
[fedocal] master: Add a template filter to display the week heading correctly (90eb862)
by pingou@fedorahosted.org
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 90eb862731c7296fb651c593f501195bc00acf40
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Tue Nov 6 19:41:21 2012 +0100
Add a template filter to display the week heading correctly
>---------------------------------------------------------------
fedocal/__init__.py | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/fedocal/__init__.py b/fedocal/__init__.py
index 89eda91..053ef7c 100644
--- a/fedocal/__init__.py
+++ b/fedocal/__init__.py
@@ -63,6 +63,16 @@ def inject_calendars():
return dict(calendars=calendars)
+
+(a)APP.template_filter('WeekHeading')
+def reverse_filter(weekdays):
+ """ Template filter returning the heading string which is located in
+ between the two navigation buttons on the agenda template.
+ """
+ return "%s - %s" % (weekdays[0].strftime('%d %b'),
+ weekdays[-1].strftime('%d %b %Y'))
+
+
def is_admin():
""" Return wether the user is admin for this application or not. """
if not flask.g.fas_user:
10 years, 10 months
[fedocal] master: Add month calendar navigation buttons (7e6f69b)
by Johan Cwiklinski
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 7e6f69bc9c3794a9546ff47ad3c2778faefbc9fc
Author: Johan Cwiklinski <johan(a)x-tnd.be>
Date: Tue Nov 6 19:30:59 2012 +0100
Add month calendar navigation buttons
>---------------------------------------------------------------
fedocal/fedocallib/fedora_calendar.py | 14 ++++++++++++++
fedocal/static/fedocal.css | 22 ++++++++++++++++++++--
fedocal/tests/test_fedocallib.py | 6 +++---
3 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/fedocal/fedocallib/fedora_calendar.py b/fedocal/fedocallib/fedora_calendar.py
index 7bd70f4..578bf7e 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
+from calendar import month_name
import flask
@@ -71,6 +72,19 @@ class FedocalCalendar(HTMLCalendar):
return '<tr>%s</tr>' % s
+ def formatmonthname(self, theyear, themonth, withyear=True):
+ """
+ Return a month name as a table row.
+ """
+ if withyear:
+ s = '%s %s' % (month_name[themonth], theyear)
+ else:
+ s = '%s' % month_name[themonth]
+ prev_month_lnk = '<a class="button" href="#"><</a>'
+ next_month_lnk = '<a class="button" href="#">></a>'
+ return '<tr><th colspan="7" class="month">%s %s %s</th></tr>' % (prev_month_lnk, s, next_month_lnk)
+
+
def formatmonth(self, withyear=True):
"""
Return a formatted month as a html valid table.
diff --git a/fedocal/static/fedocal.css b/fedocal/static/fedocal.css
index 59ebe41..da1591f 100644
--- a/fedocal/static/fedocal.css
+++ b/fedocal/static/fedocal.css
@@ -135,7 +135,7 @@ section nav {
}
#agenda .today {
- background-color: #fff7da;
+ background-color: rgba(255, 246, 213, .4);
}
.my_meetings .date {
@@ -255,10 +255,28 @@ table.month td.noday {
}
table.month td.today{
- background-color: #fff7da;
+ background-color: rgba(255, 246, 213, .8);
border-color: #000;
border-width: 1px;
/* ugly hack to work with table collapsed borders */
border-style: double solid solid double;
color: #000;
}
+
+th.month {
+ color: #666;
+ padding-bottom: .4em;
+}
+
+th.month a {
+ color: #4d4d4d;
+ display: inline-block;
+}
+
+th.month a:hover {
+ color: #fff;
+}
+
+th.month .ui-button-text {
+ padding: 0 .5em;
+}
diff --git a/fedocal/tests/test_fedocallib.py b/fedocal/tests/test_fedocallib.py
index 39e0c55..6c5e519 100644
--- a/fedocal/tests/test_fedocallib.py
+++ b/fedocal/tests/test_fedocallib.py
@@ -50,7 +50,7 @@ from tests import Modeltests, TODAY
RESULT_CALENDAR_HTML = """
<table class="month">
-<tr><th colspan="7" class="month">November 2012</th></tr>
+<tr><th colspan="7" class="month"><a class="button" href="#"><</a> November 2012 <a class="button" href="#">></a></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>
@@ -555,8 +555,8 @@ class Fedocallibtests(Modeltests):
'class="%s today">%s'% (today.strftime('%a').lower(), today.day))
# Handle the change of month
expected_output = expected_output.replace(
- 'class="month">November 2012</th>',
- 'class="month">%s %s</th>' % (today.strftime('%B'),
+ 'class="month"><a class="button" href="#"><</a> November 2012 <a class="button" href="#">></a></th>',
+ 'class="month"><a class="button" href="#"><</a> %s %s <a class="button" href="#">></a></th>' % (today.strftime('%B'),
today.year))
# Handle the current_week css class
expected_output = expected_output.split('\n')
10 years, 10 months