diff options
| -rw-r--r-- | CHANGELOG.rst | 10 | ||||
| -rw-r--r-- | CONTRIBUTORS | 5 | ||||
| -rw-r--r-- | Dockerfile | 2 | ||||
| -rw-r--r-- | README.rst | 2 | ||||
| -rw-r--r-- | docs/contributing.rst | 4 | ||||
| -rw-r--r-- | docs/installation.rst | 2 | ||||
| -rw-r--r-- | docs/upgrade.rst | 10 | ||||
| -rw-r--r-- | ihatemoney/forms.py | 2 | ||||
| -rw-r--r-- | ihatemoney/migrations/alembic.ini | 1 | ||||
| -rw-r--r-- | ihatemoney/migrations/versions/afbf27e6ef20_add_bill_import_date_field.py | 26 | ||||
| -rw-r--r-- | ihatemoney/models.py | 5 | ||||
| -rw-r--r-- | ihatemoney/templates/list_bills.html | 3 | ||||
| -rw-r--r-- | ihatemoney/tests/tests.py | 33 | ||||
| -rw-r--r-- | ihatemoney/utils.py | 4 | ||||
| -rw-r--r-- | setup.py | 4 |
15 files changed, 99 insertions, 14 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 59cd0e5..2c52315 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,8 +3,14 @@ Changelog This document describes changes between each past release. -2.1.1 (unreleased) ------------------- +3.1 (unreleased) +---------------- + +- Nothing changed yet. + + +3.0 (2018-11-25) +---------------- Fixed ===== diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 008ae90..1fc1463 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -8,13 +8,18 @@ Adrien CLERC <adrien@antipoul.fr> Alexis Metaireau <alexis@notmyidea.org> Arnaud Bos <arnaud.tlse@gmail.com> Baptiste Jonglez <git@bitsofnetworks.org> +Benjamin Bouvier <public@benj.me> Berteh <berteh@gmail.com> +Carey Metcalfe <carey@cmetcalfe.ca> +Daniel Schreiber <daniel-schreiber@gmx.de> donkers <thedonkers@gmail.com> Feth AREZKI <feth@tuttu.info> Frédéric Sureau <fredericsureau@gmail.com> Jocelyn Delalande <jocelyn@crapouillou.net> Lucas Verney <phyks@phyks.me> Mathieu Leplatre <leplatrem@gmail.com> +Marien Fressinaud <dev@marienfressinaud.fr> +mduret <mathieu.duret@gmail.com> Tinmn <royque@gmail.com> Toover <toover@toover.me> Xavier Mehrenberger <xavier.mehrenberger@gmail.com> @@ -1,6 +1,6 @@ FROM python:3.6-alpine -RUN apk add gcc libc-dev libffi-dev openssl-dev &&\ +RUN apk update && apk add gcc libc-dev libffi-dev openssl-dev &&\ mkdir /ihatemoney &&\ mkdir -p /etc/ihatemoney &&\ pip install --no-cache-dir gunicorn pymysql @@ -11,6 +11,7 @@ bills. * `Online documentation <https://ihatemoney.readthedocs.org>`_ * `Hosted version <https://ihatemoney.org>`_ +* `Mailing list <https://mailman.alwaysdata.com/postorius/lists/info.ihatemoney.org/>`_ (to get updates when needed) The code is distributed under a BSD *beerware* derivative: if you meet the people in person and you want to pay them a craft beer, you are highly encouraged to do @@ -28,3 +29,4 @@ Contributing Do you wish to contribute to IHateMoney? Fantastic! There's a lot of very useful help on the official `contributing <https://ihatemoney.readthedocs.io/en/latest/contributing.html>`_ page. + diff --git a/docs/contributing.rst b/docs/contributing.rst index b27e3f9..4b9e58b 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -166,3 +166,7 @@ Once this is done, use the "release" instruction: $ make release And the new version should be published on PyPI. + +.. note:: The above command will prompt for version number, handle + :file:`CHANGELOG.rst` and :file:`setup.py` updates, package creation, + pypi upload. It will prompt you before each step to get your consent. diff --git a/docs/installation.rst b/docs/installation.rst index f4744ae..38374e9 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -134,7 +134,7 @@ With Nginx, Gunicorn and Supervisord ihatemoney generate-config supervisord.conf > /etc/supervisor/conf.d/ihatemoney.conf -4. Copy (and adapt) output of ``ihatemoney generate-config conf/nginx.conf`` with your nginx vhosts [#nginx-vhosts]_ +4. Copy (and adapt) output of ``ihatemoney generate-config nginx.conf`` with your nginx vhosts [#nginx-vhosts]_ 5. Reload both nginx and supervisord. It should be working ;) .. [#nginx-vhosts] typically, */etc/nginx/conf.d/* or diff --git a/docs/upgrade.rst b/docs/upgrade.rst index 702008b..e48edcb 100644 --- a/docs/upgrade.rst +++ b/docs/upgrade.rst @@ -8,6 +8,8 @@ it before upgrading. Ihatemoney follows `semantic versioning <http://semver.org/>`_. So minor/patch upgrades can be done blindly. +.. _general-procedure: + General procedure ================= @@ -33,6 +35,14 @@ Version-specific instructions When upgrading from a major version to another, you **must** follow special instructions: +2.x → 3.x +--------- + +Sentry support has been removed. Sorry if you used it. + +Appart from that, :ref:`general-procedure` applies. + + 1.x → 2.x --------- diff --git a/ihatemoney/forms.py b/ihatemoney/forms.py index de9004d..e8d437b 100644 --- a/ihatemoney/forms.py +++ b/ihatemoney/forms.py @@ -189,7 +189,7 @@ class InviteForm(FlaskForm): for email in [email.strip() for email in form.emails.data.split(",")]: try: email_validator.validate_email(email) - except email_validator.EmailNotValidError as e: + except email_validator.EmailNotValidError: raise ValidationError(_("The email %(email)s is not valid", email=email)) diff --git a/ihatemoney/migrations/alembic.ini b/ihatemoney/migrations/alembic.ini index f8ed480..5301449 100644 --- a/ihatemoney/migrations/alembic.ini +++ b/ihatemoney/migrations/alembic.ini @@ -7,6 +7,7 @@ # set to 'true' to run the environment during # the 'revision' command, regardless of autogenerate # revision_environment = false +script_location = . # Logging configuration diff --git a/ihatemoney/migrations/versions/afbf27e6ef20_add_bill_import_date_field.py b/ihatemoney/migrations/versions/afbf27e6ef20_add_bill_import_date_field.py new file mode 100644 index 0000000..4179155 --- /dev/null +++ b/ihatemoney/migrations/versions/afbf27e6ef20_add_bill_import_date_field.py @@ -0,0 +1,26 @@ +"""add bill.import_date field + +Revision ID: afbf27e6ef20 +Revises: b78f8a8bdb16 +Create Date: 2018-02-19 20:29:26.286136 + +""" + +# revision identifiers, used by Alembic. +revision = 'afbf27e6ef20' +down_revision = 'b78f8a8bdb16' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.add_column('bill', sa.Column('creation_date', sa.Date(), nullable=True)) + ### end Alembic commands ### + + +def downgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.drop_column('bill', 'creation_date') + ### end Alembic commands ### diff --git a/ihatemoney/models.py b/ihatemoney/models.py index c6ce23f..9e9fbeb 100644 --- a/ihatemoney/models.py +++ b/ihatemoney/models.py @@ -163,6 +163,7 @@ class Project(db.Model): .filter(Bill.payer_id == Person.id)\ .filter(Person.project_id == Project.id)\ .filter(Project.id == self.id)\ + .order_by(Bill.creation_date.desc())\ .order_by(Bill.date.desc())\ .order_by(Bill.id.desc()) @@ -329,7 +330,8 @@ class Bill(db.Model): query_class = BillQuery - _to_serialize = ("id", "payer_id", "owers", "amount", "date", "what") + _to_serialize = ("id", "payer_id", "owers", "amount", "date", + "creation_date", "what") id = db.Column(db.Integer, primary_key=True) @@ -338,6 +340,7 @@ class Bill(db.Model): amount = db.Column(db.Float) date = db.Column(db.Date, default=datetime.now) + creation_date = db.Column(db.Date, default=datetime.now) what = db.Column(db.UnicodeText) archive = db.Column(db.Integer, db.ForeignKey("archive.id")) diff --git a/ihatemoney/templates/list_bills.html b/ihatemoney/templates/list_bills.html index 81f8cd5..718009b 100644 --- a/ihatemoney/templates/list_bills.html +++ b/ihatemoney/templates/list_bills.html @@ -98,10 +98,11 @@ {% if bills.count() > 0 %} <table id="bill_table" class="col table table-striped table-hover"> - <thead><tr><th>{{ _("When?") }}</th><th>{{ _("Who paid?") }}</th><th>{{ _("For what?") }}</th><th>{{ _("For whom?") }}</th><th>{{ _("How much?") }}</th><th>{{ _("Actions") }}</th></tr></thead> + <thead><tr><th>{{ _("Added on") }}</th><th>{{ _("When?") }}</th><th>{{ _("Who paid?") }}</th><th>{{ _("For what?") }}</th><th>{{ _("For whom?") }}</th><th>{{ _("How much?") }}</th><th>{{ _("Actions") }}</th></tr></thead> <tbody> {% for bill in bills %} <tr owers="{{bill.owers|join(',','id')}}" payer="{{bill.payer.id}}"> + <td>{{ bill.creation_date if bill.creation_date else bill.date }}</td> <td>{{ bill.date }}</td> <td>{{ bill.payer }}</td> <td>{{ bill.what }}</td> diff --git a/ihatemoney/tests/tests.py b/ihatemoney/tests/tests.py index 63a7394..f368780 100644 --- a/ihatemoney/tests/tests.py +++ b/ihatemoney/tests/tests.py @@ -9,6 +9,7 @@ try: except ImportError: from mock import patch +import datetime import os import json from collections import defaultdict @@ -1271,7 +1272,13 @@ class APITestCase(IhatemoneyTestCase): "date": "2011-08-10", "id": 1} - self.assertDictEqual(expected, json.loads(req.data.decode('utf-8'))) + got = json.loads(req.data.decode('utf-8')) + self.assertEqual( + datetime.date.today(), + datetime.datetime.strptime(got["creation_date"], '%Y-%m-%d').date() + ) + del got["creation_date"] + self.assertDictEqual(expected, got) # the list of bills should length 1 req = self.client.get("/api/projects/raclette/bills", @@ -1303,6 +1310,10 @@ class APITestCase(IhatemoneyTestCase): # check its fields req = self.client.get("/api/projects/raclette/bills/1", headers=self.get_auth("raclette")) + creation_date = datetime.datetime.strptime( + json.loads(req.data.decode('utf-8'))["creation_date"], + '%Y-%m-%d' + ).date() expected = { "what": "beer", @@ -1314,7 +1325,13 @@ class APITestCase(IhatemoneyTestCase): "date": "2011-09-10", "id": 1} - self.assertDictEqual(expected, json.loads(req.data.decode('utf-8'))) + got = json.loads(req.data.decode('utf-8')) + self.assertEqual( + creation_date, + datetime.datetime.strptime(got["creation_date"], '%Y-%m-%d').date() + ) + del got["creation_date"] + self.assertDictEqual(expected, got) # delete a bill req = self.client.delete("/api/projects/raclette/bills/1", @@ -1393,6 +1410,10 @@ class APITestCase(IhatemoneyTestCase): # get this bill details req = self.client.get("/api/projects/raclette/bills/1", headers=self.get_auth("raclette")) + creation_date = datetime.datetime.strptime( + json.loads(req.data.decode('utf-8'))["creation_date"], + '%Y-%m-%d' + ).date() # compare with the added info self.assertStatus(200, req) @@ -1405,7 +1426,13 @@ class APITestCase(IhatemoneyTestCase): "amount": 25.0, "date": "2011-08-10", "id": 1} - self.assertDictEqual(expected, json.loads(req.data.decode('utf-8'))) + got = json.loads(req.data.decode('utf-8')) + self.assertEqual( + creation_date, + datetime.datetime.strptime(got["creation_date"], '%Y-%m-%d').date() + ) + del got["creation_date"] + self.assertDictEqual(expected, got) # getting it should return a 404 req = self.client.get("/api/projects/raclette", diff --git a/ihatemoney/utils.py b/ihatemoney/utils.py index d03e91b..19340df 100644 --- a/ihatemoney/utils.py +++ b/ihatemoney/utils.py @@ -23,8 +23,8 @@ def slugify(value): value = unicodedata.normalize('NFKD', value) if six.PY2: value = value.encode('ascii', 'ignore') - value = six.text_type(re.sub('[^\w\s-]', '', value).strip().lower()) - return re.sub('[-\s]+', '-', value) + value = six.text_type(re.sub(r'[^\w\s-]', '', value).strip().lower()) + return re.sub(r'[-\s]+', '-', value) class Redirect303(HTTPException, RoutingException): @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- import codecs import os from setuptools import setup, find_packages @@ -34,7 +34,7 @@ ENTRY_POINTS = { setup(name='ihatemoney', - version='2.1.1.dev0', + version='3.1.dev0', description='A simple shared budget manager web application.', long_description="{}\n\n{}".format(README.encode('utf-8'), CHANGELOG.encode('utf-8')), license='Custom BSD Beerware', |
