Skip to content

Commit ca99273

Browse files
chore: Release 1.7.0 to master (#6541)
chore: Release 1.7.0 to master
2 parents c1a6a0e + 37c7097 commit ca99273

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4666
-325
lines changed

.circleci/config.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: circleci/python:3.7.4-node
6+
environment:
7+
APP_CONFIG: config.TestingConfig
8+
DATABASE_URL: postgresql://postgres@localhost/test
9+
TEST_DATABASE_URL: postgresql://postgres@localhost/test
10+
# Services
11+
- image: circleci/postgres:11.5-alpine-ram
12+
environment:
13+
POSTGRES_USER: postgres
14+
POSTGRES_DB: test
15+
- image: circleci/redis:5.0.6-alpine
16+
17+
working_directory: ~/code
18+
19+
steps:
20+
- checkout
21+
22+
# Download and cache dependencies
23+
- restore_cache:
24+
keys:
25+
- v1.3-dependencies-{{ checksum "requirements/tests.txt" }}-{{ checksum "package.json" }}
26+
# fallback to using the latest cache if no exact match is found
27+
- v1.3-dependencies-
28+
29+
- run:
30+
name: Install Python Dependencies
31+
command: |
32+
python3 -m venv venv
33+
. venv/bin/activate
34+
pip install --exists-action w -r requirements/tests.txt
35+
36+
- run:
37+
name: Install Node Dependencies
38+
command: yarn
39+
40+
- save_cache:
41+
paths:
42+
- ./venv
43+
- ./node_modules
44+
- ~/.cache/yarn
45+
- ~/.yarn/bin
46+
key: v1.3-dependencies-{{ checksum "requirements/tests.txt" }}-{{ checksum "package.json" }}
47+
48+
- run:
49+
name: Create API blueprint
50+
command: npx aglio --input docs/api/api_blueprint_source.apib --compile --output docs/api/api_blueprint.apib
51+
52+
- run:
53+
name: Test API Doc
54+
command: . venv/bin/activate && npx dredd

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,7 @@ src
5555

5656
#tickets
5757
generated/
58+
59+
docker-compose.override.yml
60+
celerybeat-schedule.*
61+
.coverage

.travis.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
language: python
22

3+
dist: xenial
4+
35
services:
46
- docker
7+
- postgresql
58

69
addons:
710
apt:
@@ -10,17 +13,11 @@ addons:
1013
- libssl-dev
1114
- libffi-dev
1215

13-
python:
14-
- '3.6'
16+
python: 3.7
1517

1618
cache: pip
1719

18-
before-install:
19-
- npm -g install npm@latest
20-
2120
install:
22-
- npm install -g aglio
23-
- npm install -g [email protected]
2421
- pip3 install -r requirements/tests.txt
2522

2623
env:
@@ -31,8 +28,6 @@ before_script:
3128
- export DATABASE_URL=postgresql://postgres@localhost:5432/test
3229
- export TEST_DATABASE_URL=postgresql://postgres@localhost:5432/test
3330
- bash scripts/test_multiple_heads.sh
34-
- aglio --input docs/api/api_blueprint_source.apib --compile --output docs/api/api_blueprint.apib
35-
- dredd
3631

3732
script:
3833
- nosetests tests/all -v --with-coverage

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Changelog
2+
3+
##### v1.8.0 (Unreleased):
4+
5+
- No Changes
6+
7+
##### v1.7.0 (2019-10-19):
8+
9+
- ** BREAKING ** Requires Python 3.7
10+
- Add info endpoint to get server version
11+
- Add management script to switch modules on or off
12+
- Increase gunicorn workers in docker and add options for configuration
13+
- Fix CSV export *(included as hotfix in previous version)*
14+
- Fix order PDF not found errors by mounting `generated` folder in docker
15+
- Fix ICal attribute errors and add tests
16+
- Fix Pentabarf export and add tests
17+
- Add workaround for multiprocess engine forking
18+
- Use pool pre ping option to avoid dropped connections
19+
- Add .env in docker compose to override environment variables
20+
- Configure redis and celery in sentry integration
21+
- Convert some classes to dataclasses
22+
- Update dependencies

Dockerfile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
FROM python:3.6-alpine as base
1+
FROM python:3.7-alpine as base
22
LABEL maintainer="Niranjan Rajendran <[email protected]>"
33

4-
##
5-
##
4+
####
65

76
FROM base as builder
87

@@ -18,19 +17,17 @@ ADD requirements /requirements/
1817

1918
RUN wget https://bootstrap.pypa.io/ez_setup.py && python ez_setup.py
2019

21-
ENV PYTHONPATH /install/lib/python3.6/site-packages
20+
ENV PYTHONPATH /install/lib/python3.7/site-packages
2221
RUN pip install --install-option="--prefix=/install" setuptools && \
2322
LIBRARY_PATH=/lib:/usr/lib pip install --install-option="--prefix=/install" -r /requirements.txt
2423

25-
26-
##
27-
##
24+
####
2825

2926
FROM base
3027

3128
COPY --from=builder /install /usr/local
3229
RUN apk --no-cache add postgresql-dev ca-certificates libxslt jpeg zlib file libxml2 git && \
33-
pip install git+https://github.com/fossasia/flask-rest-jsonapi.git@shubhamp-master#egg=flask-rest-jsonapi
30+
pip install git+https://github.com/fossasia/flask-rest-jsonapi.git@0.12.6.1#egg=flask-rest-jsonapi
3431

3532
WORKDIR /data/app
3633
ADD . .

README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
![Open Event Server](/docs/images/open-event-server.png)
44

5-
[![GitHub release](https://img.shields.io/badge/release-1.0.0--alpha.10-blue.svg?style=flat-square)](https://github.com/fossasia/open-event-server/releases/latest)
5+
[![GitHub release](https://img.shields.io/github/release/fossasia/open-event-server.svg)](https://github.com/fossasia/open-event-server/releases/latest)
66
[![Build Status](https://travis-ci.org/fossasia/open-event-server.svg?branch=development)](https://travis-ci.org/fossasia/open-event-server)
7+
[![CircleCI Build Staus Badge](https://img.shields.io/circleci/build/github/fossasia/open-event-server?label=CircleCI%20Build)](https://www.circleci.com/gh/fossasia/open-event-server)
78
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/1ac554483fac462797ffa5a8b9adf2fa?style=flat-square)](https://www.codacy.com/app/fossasia/open-event-server)
8-
[![Codecov branch](https://codecov.io/gh/fossasia/open-event-server/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/fossasia/open-event-server)
9+
[![Codecov branch](https://codecov.io/gh/fossasia/open-event-server/branch/development/graph/badge.svg?style=flat-square)](https://codecov.io/gh/fossasia/open-event-server)
910
[![Gitter](https://img.shields.io/badge/chat-on%20gitter-ff006f.svg?style=flat-square)](https://gitter.im/fossasia/open-event-server)
1011
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
1112
[![Mailing List](https://img.shields.io/badge/Mailing%20List-FOSSASIA-blue.svg)](https://groups.google.com/forum/#!forum/open-event)
@@ -66,7 +67,7 @@ Please get familiar with the components of the project in order to be able to co
6667
* App server - [uWSGI](https://github.com/unbit/uwsgi)
6768
* Web Server - [NGINX](https://www.nginx.com)
6869

69-
Note that open-event-server **works with Python 3.6** at the moment.
70+
Note that open-event-server **works with Python 3.7** at the moment.
7071

7172
### External Service Dependencies
7273

@@ -193,6 +194,34 @@ Clone the repo and set up the server according to the steps listed. Make sure yo
193194
pip3 install -r requirements/tests.txt
194195
```
195196

197+
#### Enable/Disable modules
198+
199+
- Enable/Disable a specific module
200+
201+
```
202+
python manage.py module --name module_name --switch on/off
203+
```
204+
205+
**_Example :_**
206+
207+
```
208+
python manage.py module --name ticket_include --switch on
209+
python manage.py module -n ticket_include -s off
210+
```
211+
212+
- Enable/Disable all modules
213+
214+
```
215+
python manage.py module --name module_name --switch on/off
216+
```
217+
218+
**_Example :_**
219+
220+
```
221+
python manage.py module --name all --switch on
222+
python manage.py module -n all -s off
223+
```
224+
196225
#### Running unit tests
197226

198227
* Open Event uses Postgres database for testing. So set `DATABASE_URL` as a postgres database. Here is an example.

app/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import stripe
3333
from app.settings import get_settings
3434
from app.models import db
35+
from app.models.utils import add_engine_pidguard, sqlite_datetime_fix
3536
from app.api.helpers.jwt import jwt_user_loader
3637
from app.api.helpers.cache import cache
3738
from werkzeug.middleware.profiler import ProfilerMiddleware
@@ -59,7 +60,7 @@
5960
env.read_envfile()
6061

6162

62-
class ReverseProxied(object):
63+
class ReverseProxied:
6364
"""
6465
ReverseProxied flask wsgi app wrapper from http://stackoverflow.com/a/37842465/1562480 by aldel
6566
"""
@@ -149,6 +150,7 @@ def create_app():
149150
from app.api.admin_translations import admin_blueprint
150151
from app.api.orders import alipay_blueprint
151152
from app.api.settings import admin_misc_routes
153+
from app.api.server_version import info_route
152154

153155
app.register_blueprint(api_v1)
154156
app.register_blueprint(event_copy)
@@ -167,6 +169,12 @@ def create_app():
167169
app.register_blueprint(admin_blueprint)
168170
app.register_blueprint(alipay_blueprint)
169171
app.register_blueprint(admin_misc_routes)
172+
app.register_blueprint(info_route)
173+
174+
add_engine_pidguard(db.engine)
175+
176+
if app.config['SQLALCHEMY_DATABASE_URI'].startswith("sqlite://"):
177+
sqlite_datetime_fix()
170178

171179
sa.orm.configure_mappers()
172180

app/api/helpers/ICalExporter.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def export(event_id):
4747

4848
for speaker in session.speakers:
4949
# Ref: http://icalendar.readthedocs.io/en/latest/usage.html#file-structure
50-
# can use speaker.email below but privacy reasons
51-
attendee = vCalAddress('MAILTO:' + event.email if event.email else '[email protected]')
50+
attendee = vCalAddress('MAILTO:' + speaker.email if speaker.email else '[email protected]')
5251
attendee.params['cn'] = vText(speaker.name)
5352
event_component.add('attendee', attendee)
5453

app/api/helpers/db.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22
import traceback
33

4+
from flask import request
45
from flask_rest_jsonapi.exceptions import ObjectNotFound
56
from sqlalchemy import func
67
from sqlalchemy.orm.exc import NoResultFound
@@ -63,7 +64,11 @@ def safe_query(self, model, column_name, value, parameter_name):
6364
:return:
6465
"""
6566
try:
66-
record = self.session.query(model).filter(getattr(model, column_name) == value).one()
67+
record = self.session.query(model).filter(getattr(model, column_name) == value)
68+
if request.args.get('get_trashed') != 'true':
69+
if hasattr(model, 'deleted_at'):
70+
record = record.filter(model.deleted_at == None)
71+
record = record.one()
6772
except NoResultFound:
6873
raise ObjectNotFound({'parameter': '{}'.format(parameter_name)},
6974
"{}: {} not found".format(model.__name__, value))

app/api/helpers/payment.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def forex(from_currency, to_currency, amount):
2727
return amount
2828

2929

30-
class StripePaymentsManager(object):
30+
class StripePaymentsManager:
3131
"""
3232
Class to manage payments through Stripe.
3333
"""
@@ -135,7 +135,7 @@ def capture_payment(order_invoice, currency=None, credentials=None):
135135
raise ConflictException({'pointer': ''}, str(e))
136136

137137

138-
class PayPalPaymentsManager(object):
138+
class PayPalPaymentsManager:
139139
"""
140140
Class to manage payment through Paypal REST API.
141141
"""
@@ -265,7 +265,7 @@ def execute_payment(paypal_payer_id, paypal_payment_id):
265265
return False, payment.error
266266

267267

268-
class AliPayPaymentsManager(object):
268+
class AliPayPaymentsManager:
269269
"""
270270
Class to manage AliPay Payments
271271
"""
@@ -294,7 +294,7 @@ def charge_source(order_identifier):
294294
return charge
295295

296296

297-
class OmisePaymentsManager(object):
297+
class OmisePaymentsManager:
298298
"""
299299
Class to manage Omise Payments
300300
"""
@@ -320,7 +320,7 @@ def charge_payment(order_identifier, token):
320320
return charge
321321

322322

323-
class PaytmPaymentsManager(object):
323+
class PaytmPaymentsManager:
324324
"""
325325
Class to manage PayTM payments
326326
"""

0 commit comments

Comments
 (0)