Now it is clear we want Python 3 only
This commit is contained in:
parent
f3b379d9e5
commit
f121bb0cdf
3 changed files with 15 additions and 2 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -1,3 +1,5 @@
|
||||||
coriplus.sqlite
|
coriplus.sqlite
|
||||||
__pycache__/
|
__pycache__/
|
||||||
uploads/
|
uploads/
|
||||||
|
*.pyc
|
||||||
|
**~
|
||||||
|
|
|
||||||
|
|
@ -13,3 +13,9 @@ Based on Tweepee example of [peewee](https://github.com/coleifer/peewee/).
|
||||||
* Timeline feed
|
* Timeline feed
|
||||||
* In-site notifications
|
* In-site notifications
|
||||||
* SQLite-based app
|
* SQLite-based app
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
* **Python 3** only. We don't want to support Python 2.
|
||||||
|
* **Flask** web framework.
|
||||||
|
* **Peewee** ORM.
|
||||||
|
|
|
||||||
7
app.py
7
app.py
|
|
@ -8,6 +8,11 @@ from functools import wraps
|
||||||
|
|
||||||
__version__ = '0.4-dev'
|
__version__ = '0.4-dev'
|
||||||
|
|
||||||
|
# we want to support Python 3 only.
|
||||||
|
# Python 2 has too many caveats.
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
|
raise RuntimeError('Python 3 required')
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config.from_pyfile('config.py')
|
app.config.from_pyfile('config.py')
|
||||||
|
|
||||||
|
|
@ -313,7 +318,7 @@ def unpush_notification(type, target, **kwargs):
|
||||||
def object_list(template_name, qr, var_name='object_list', **kwargs):
|
def object_list(template_name, qr, var_name='object_list', **kwargs):
|
||||||
kwargs.update(
|
kwargs.update(
|
||||||
page=int(request.args.get('page', 1)),
|
page=int(request.args.get('page', 1)),
|
||||||
pages=qr.count() / 20 + 1)
|
pages=qr.count() // 20 + 1)
|
||||||
kwargs[var_name] = qr.paginate(kwargs['page'])
|
kwargs[var_name] = qr.paginate(kwargs['page'])
|
||||||
return render_template(template_name, **kwargs)
|
return render_template(template_name, **kwargs)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue