Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Code checks

on: push

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Run pycodestyle
run: |
pip install pycodestyle
./pycodestyle.sh
if [[ $? -ne 0 ]]; then
echo "Linting failed, please reformat your code"
exit 1
fi

test:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install test dependencies
run: |
pip install -r requirements.txt
pip install coverage
- name: Run tests
run: |
LANGUAGE=en_GB:en coverage run --source=flask_table setup.py test
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions examples/attr_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ def main():
tab = ItemTable(items)
print(tab.__html__())


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions examples/column_html_attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,6 @@ def main():
Except it doesn't bother to prettify the output.
"""


if __name__ == '__main__':
main()
2 changes: 2 additions & 0 deletions examples/csrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def single_item(id):

def get_table_class():
csrf_token = get_csrf_token()

class ItemTable(Table):
name = Col('Name')
description = Col('Description')
Expand Down Expand Up @@ -67,6 +68,7 @@ def get_elements(cls):
def get_element_by_id(cls, id):
return [i for i in cls.get_elements() if i.id == id][0]


def main():
app.run(debug=True)

Expand Down
1 change: 1 addition & 0 deletions examples/datetimecol.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ def main():
# or {{ table }} in jinja
print(table.__html__())


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions examples/external_url_col.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ def main():
tab = ItemTable(items)
print(tab.__html__())


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions examples/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ def main():
Except it doesn't bother to prettify the output.
"""


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions examples/simple_nested.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@ def main():
Except it doesn't bother to prettify the output.
"""


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions examples/simple_sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ class UserTable(Table):
username = Col('Username')
email = Col('Email')


users = User.query.all()
print(UserTable(items=users).__html__())
1 change: 1 addition & 0 deletions examples/sortable.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ def get_sorted_by(cls, sort, reverse=False):
def get_element_by_id(cls, id):
return [i for i in cls.get_elements() if i.id == id][0]


if __name__ == '__main__':
app.run(debug=True)
1 change: 1 addition & 0 deletions examples/subclassing.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ def main():
# or {{ tab }} in jinja
print(tab.__html__())


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions examples/subclassing2.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ def main():
# or {{ tab }} in jinja
print(tab.__html__())


if __name__ == '__main__':
main()
3 changes: 2 additions & 1 deletion flask_table/columns.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import unicode_literals

from flask import Markup, url_for
from flask import url_for
from markupsafe import Markup
from babel.dates import format_date, format_datetime
from flask_babel import gettext as _

Expand Down
3 changes: 1 addition & 2 deletions flask_table/html.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from functools import partial

from flask import Markup
from markupsafe import Markup


def element(element, attrs=None, content='',
Expand Down
2 changes: 1 addition & 1 deletion flask_table/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import unicode_literals
from collections import OrderedDict

from flask import Markup
from markupsafe import Markup
from flask_babel import gettext as _

from .columns import Col
Expand Down
3 changes: 0 additions & 3 deletions pep8.sh

This file was deleted.

3 changes: 3 additions & 0 deletions pycodestyle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

pycodestyle flask_table/*.py examples/*.py tests/*.py setup.py
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Flask
Flask-Babel
Flask-Testing
MarkupSafe
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
install_requires = [
'Flask',
'Flask-Babel',
'MarkupSafe',
]

if os.path.exists('README'):
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Subitem(Item):


def html_reduce(s):
return ''.join(l.strip() for l in s.split('\n'))
return ''.join(x.strip() for x in s.split('\n'))


class TableTest(unittest.TestCase):
Expand Down