Skip to content

Commit

Permalink
Merge branch 'master' into document_refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sfermigier committed Nov 23, 2017
2 parents caf290a + b47a326 commit 75f5380
Show file tree
Hide file tree
Showing 48 changed files with 774 additions and 878 deletions.
20 changes: 11 additions & 9 deletions .pre-commit-config.yaml
@@ -1,9 +1,11 @@
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: 7ec485352199e02d608198b0206b0675fa84af73
hooks:
- id: trailing-whitespace
files: \.(py|sh|yaml|txt)$
- id: flake8
files: \.py$
- id: debug-statements
files: \.py$
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: v0.9.3
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: debug-statements
- id: check-xml
- id: check-yaml
- id: check-json
- id: check-ast
- id: flake8
12 changes: 5 additions & 7 deletions .travis.yml
Expand Up @@ -8,8 +8,6 @@ python:
- "3.6"

env:
global:
- LD_LIBRARY_PATH=~/sqlite-3.9.1/lib
matrix:
- SQLALCHEMY_DATABASE_URI="sqlite://"
- SQLALCHEMY_DATABASE_URI="postgres://postgres@localhost/abilian_sbe"
Expand All @@ -18,23 +16,23 @@ services:
- redis-server

addons:
postgresql: "9.3"
postgresql: "9.4"
apt:
packages:
- poppler-utils
- nodejs

# Install OS dependencies
before_install:
- sudo add-apt-repository 'deb http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ xenial main'
- sudo apt-get update
- sudo apt-get install sqlite3
- python -c "import sqlite3; print('SQLITE3:', sqlite3.sqlite_version)"

- export NPM_CONFIG_PREFIX=~/npm-packages
- mkdir "${NPM_CONFIG_PREFIX}"
- npm install -g less
- export PATH=~/npm-packages/bin:$PATH
- wget 'http://jenkins.abilian.com/_fixtures/libsqlite-3.9.1-precise-bin.tar.gz'
- tar xpvzf libsqlite-3.9.1-precise-bin.tar.gz -C ~
- echo $LD_LIBRARY_PATH
- ls ~/sqlite-3.9.1/lib

# Install Python dependencies
install:
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.rst
@@ -1,6 +1,12 @@
Changelog for Abilian SBE
=========================

0.3.17 (2017-10-02)
-------------------

- Remove unwanted button
- Cleanup and prepare for the future

0.3.13 (2017-08-02)
-------------------

Expand Down
6 changes: 4 additions & 2 deletions Makefile
Expand Up @@ -7,7 +7,8 @@ INSTANCE_FOLDER=$(shell \
$(VIRTUAL_ENV)/bin/python \
-c 'from flask import Flask; print Flask("myapp").instance_path')

default: test

all: test lint

install:
pip install -r requirements.txt
Expand Down Expand Up @@ -75,7 +76,7 @@ endif
# testing
#
test:
pytest --tb=short $(PKG) tests
pytest --ff -x --tb=short $(PKG) tests

test-with-coverage:
pytest --tb=short --durations 10 \
Expand Down Expand Up @@ -190,6 +191,7 @@ update-deps:
git --no-pager diff requirements.txt

sync-deps:
pip install -U pip setuptools wheel
pip install -r requirements.txt
pip install -r etc/dev-requirements.txt
pip install -e .
3 changes: 2 additions & 1 deletion abilian/sbe/app.py
Expand Up @@ -66,7 +66,8 @@ class Application(BaseApplication):
# "abilian.sbe.apps.calendar",
"abilian.sbe.apps.communities",
"abilian.sbe.apps.social",
"abilian.sbe.apps.preferences",)
"abilian.sbe.apps.preferences",
)

script_manager = command_manager

Expand Down
8 changes: 5 additions & 3 deletions abilian/sbe/apps/calendar/forms.py
Expand Up @@ -4,11 +4,11 @@
from __future__ import absolute_import, print_function, unicode_literals

import bleach
from wtforms import StringField, TextAreaField
from wtforms import StringField, TextAreaField, ValidationError
from wtforms.fields.html5 import URLField

from abilian.i18n import _l
from abilian.web.forms import Form, ValidationError
from abilian.web.forms import Form
from abilian.web.forms.fields import DateTimeField
from abilian.web.forms.filters import strip
from abilian.web.forms.validators import required
Expand Down Expand Up @@ -48,7 +48,9 @@
'img': ['src', 'alt', 'title'],
}

ALLOWED_STYLES = ['text-align',]
ALLOWED_STYLES = [
'text-align',
]

WIDGET_ALLOWED = {}
for attr in ALLOWED_TAGS:
Expand Down
2 changes: 1 addition & 1 deletion abilian/sbe/apps/calendar/views.py
Expand Up @@ -43,7 +43,7 @@ def get_month(event):
@route('/archives/')
def archives():
events = Event.query \
.order_by(Event.start) \
.order_by(Event.start.desc()) \
.filter(Event.end <= datetime.now()) \
.all()

Expand Down
8 changes: 4 additions & 4 deletions abilian/sbe/apps/communities/forms.py
Expand Up @@ -12,7 +12,7 @@
from flask_babel import lazy_gettext as _l
from six import text_type
from wtforms.fields import BooleanField, StringField, TextAreaField
from wtforms.validators import ValidationError, optional, required
from wtforms.validators import ValidationError, data_required, optional

from abilian.core.models.subjects import Group
from abilian.web.forms import Form
Expand Down Expand Up @@ -51,10 +51,10 @@ def _group_choices():


class CommunityForm(Form):
name = StringField(label=_l(u"Name"), validators=[required()])
name = StringField(label=_l(u"Name"), validators=[data_required()])
description = TextAreaField(
label=_l(u"Description"),
validators=[required(), length(max=500)],
validators=[data_required(), length(max=500)],
widget=TextArea(resizeable="vertical"))

linked_group = Select2Field(
Expand All @@ -68,7 +68,7 @@ class CommunityForm(Form):
widget=ImageInput(width=65, height=65),
validators=[optional()])

type = Select2Field(label=_(u"Type"), validators=[required()],
type = Select2Field(label=_(u"Type"), validators=[data_required()],
filters=(strip,),
choices=[(_l(u'informative'), 'informative'),
(_l(u'participative'), 'participative')])
Expand Down
4 changes: 2 additions & 2 deletions abilian/sbe/apps/communities/models.py
Expand Up @@ -259,8 +259,8 @@ def remove_membership(self, user):
.filter(and_(M.user_id == user.id, M.community_id == self.id)) \
.first()
if not membership:
raise KeyError(
"User {} is not a member of community {}".format(user, self))
raise KeyError("User {} is not a member of community {}".format(
user, self))

db.session.delete(membership)
self.membership_count -= 1
Expand Down
3 changes: 2 additions & 1 deletion abilian/sbe/apps/communities/search.py
Expand Up @@ -63,7 +63,8 @@ def filter_user_communities():

if communities:
communities = wq.And([
wq.Term(_COMMUNITY_CONTENT_FIELDNAME, True), wq.Or(communities)
wq.Term(_COMMUNITY_CONTENT_FIELDNAME, True),
wq.Or(communities)
])
filter_q = wq.Or([filter_q, communities])

Expand Down
3 changes: 3 additions & 0 deletions abilian/sbe/apps/communities/templates/community/macros.html
Expand Up @@ -30,6 +30,9 @@
{% if not label %}
{% set label = _("Read by") %}
{% endif %}
{% if not viewers %}
{% set viewers = [] %}
{% endif %}
{% set nb_viewers=viewers|length %}
<p class="viewed">
{{ label }}
Expand Down
6 changes: 4 additions & 2 deletions abilian/sbe/apps/communities/tests/test_community.py
Expand Up @@ -142,8 +142,10 @@ def test_members(self):

# test delete
data = {
'action': 'delete',
'user': self.user_c2.id,
'action':
'delete',
'user':
self.user_c2.id,
'membership':
[m.id for m in community.memberships
if m.user == self.user_c2][0],
Expand Down
5 changes: 3 additions & 2 deletions abilian/sbe/apps/communities/views/views.py
Expand Up @@ -486,8 +486,9 @@ def members_excel_export():

response = current_app.response_class(fd, mimetype=XLSX_MIME)

filename = u'{}-members-{}.xlsx'.format(
community.slug, strftime("%d:%m:%Y-%H:%M:%S", gmtime()))
filename = u'{}-members-{}.xlsx'.format(community.slug,
strftime("%d:%m:%Y-%H:%M:%S",
gmtime()))
response.headers['content-disposition'] = \
u'attachment;filename="{}"'.format(filename)

Expand Down

0 comments on commit 75f5380

Please sign in to comment.