WebGrid 0.5.1__tar.gz → 0.5.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. {WebGrid-0.5.1 → WebGrid-0.5.3}/PKG-INFO +19 -1
  2. {WebGrid-0.5.1 → WebGrid-0.5.3}/WebGrid.egg-info/PKG-INFO +19 -1
  3. {WebGrid-0.5.1 → WebGrid-0.5.3}/WebGrid.egg-info/requires.txt +0 -1
  4. {WebGrid-0.5.1 → WebGrid-0.5.3}/changelog.rst +18 -0
  5. {WebGrid-0.5.1 → WebGrid-0.5.3}/setup.py +0 -1
  6. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/__init__.py +9 -4
  7. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/renderers.py +2 -0
  8. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/tests/test_columns.py +13 -0
  9. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/tests/test_rendering.py +5 -5
  10. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/tests/test_types.py +4 -2
  11. WebGrid-0.5.3/webgrid/version.py +1 -0
  12. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/model/entities.py +1 -1
  13. WebGrid-0.5.1/webgrid/version.py +0 -1
  14. {WebGrid-0.5.1 → WebGrid-0.5.3}/MANIFEST.in +0 -0
  15. {WebGrid-0.5.1 → WebGrid-0.5.3}/WebGrid.egg-info/SOURCES.txt +0 -0
  16. {WebGrid-0.5.1 → WebGrid-0.5.3}/WebGrid.egg-info/dependency_links.txt +0 -0
  17. {WebGrid-0.5.1 → WebGrid-0.5.3}/WebGrid.egg-info/entry_points.txt +0 -0
  18. {WebGrid-0.5.1 → WebGrid-0.5.3}/WebGrid.egg-info/not-zip-safe +0 -0
  19. {WebGrid-0.5.1 → WebGrid-0.5.3}/WebGrid.egg-info/top_level.txt +0 -0
  20. {WebGrid-0.5.1 → WebGrid-0.5.3}/readme.rst +0 -0
  21. {WebGrid-0.5.1 → WebGrid-0.5.3}/setup.cfg +0 -0
  22. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/blazeweb.py +0 -0
  23. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/extensions.py +0 -0
  24. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/filters.py +0 -0
  25. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/flask.py +0 -0
  26. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/i18n/babel.cfg +0 -0
  27. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/i18n/es/LC_MESSAGES/webgrid.mo +0 -0
  28. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/i18n/es/LC_MESSAGES/webgrid.po +0 -0
  29. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/i18n/webgrid.pot +0 -0
  30. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/application_form_edit.png +0 -0
  31. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/b_firstpage.png +0 -0
  32. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/b_lastpage.png +0 -0
  33. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/b_nextpage.png +0 -0
  34. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/b_prevpage.png +0 -0
  35. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/bd_firstpage.png +0 -0
  36. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/bd_lastpage.png +0 -0
  37. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/bd_nextpage.png +0 -0
  38. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/bd_prevpage.png +0 -0
  39. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/delete.png +0 -0
  40. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/gettext.min.js +0 -0
  41. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/i18n/es/LC_MESSAGES/webgrid.json +0 -0
  42. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/jquery.multiple.select.js +0 -0
  43. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/multiple-select.css +0 -0
  44. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/multiple-select.png +0 -0
  45. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/th_arrow_down.png +0 -0
  46. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/th_arrow_up.png +0 -0
  47. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/webgrid.css +0 -0
  48. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/static/webgrid.js +0 -0
  49. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/templates/grid.html +0 -0
  50. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/templates/grid_footer.html +0 -0
  51. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/templates/grid_header.html +0 -0
  52. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/templates/grid_table.html +0 -0
  53. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/templates/header_filtering.html +0 -0
  54. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/templates/header_paging.html +0 -0
  55. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/templates/header_sorting.html +0 -0
  56. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/testing.py +0 -0
  57. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/tests/__init__.py +0 -0
  58. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/tests/conftest.py +0 -0
  59. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/tests/data/basic_table.html +0 -0
  60. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/tests/data/people_table.html +0 -0
  61. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/tests/data/stopwatch_table.html +0 -0
  62. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/tests/helpers.py +0 -0
  63. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/tests/test_api.py +0 -0
  64. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/tests/test_filters.py +0 -0
  65. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/tests/test_testing.py +0 -0
  66. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/tests/test_unit.py +0 -0
  67. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/types.py +0 -0
  68. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid/utils.py +0 -0
  69. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/__init__.py +0 -0
  70. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/app.py +0 -0
  71. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/data/basic_table.html +0 -0
  72. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/data/people_table.html +0 -0
  73. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/extensions.py +0 -0
  74. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/grids.py +0 -0
  75. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/helpers.py +0 -0
  76. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/i18n/babel.cfg +0 -0
  77. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/i18n/es/LC_MESSAGES/webgrid_ta.mo +0 -0
  78. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/i18n/es/LC_MESSAGES/webgrid_ta.po +0 -0
  79. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/i18n/webgrid_ta.pot +0 -0
  80. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/manage.py +0 -0
  81. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/model/__init__.py +0 -0
  82. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/model/helpers.py +0 -0
  83. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/templates/groups.html +0 -0
  84. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/templates/index.html +0 -0
  85. {WebGrid-0.5.1 → WebGrid-0.5.3}/webgrid_ta/views.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: WebGrid
3
- Version: 0.5.1
3
+ Version: 0.5.3
4
4
  Summary: A library for rendering HTML tables and Excel files from SQLAlchemy models.
5
5
  Home-page: https://github.com/level12/webgrid
6
6
  Author: Randy Syring
@@ -88,6 +88,24 @@ Links
88
88
  Changelog
89
89
  =========
90
90
 
91
+ 0.5.3 released 2023-03-02
92
+ -------------------------
93
+
94
+ - fix column attribute extraction for non-SQLAlchemy records (a090491_)
95
+
96
+ .. _a090491: https://github.com/level12/webgrid/commit/a090491
97
+
98
+
99
+ 0.5.2 released 2023-02-24
100
+ -------------------------
101
+
102
+ - fix openpyxl typing imports when openpyxl not present (d301658_)
103
+ - SQLAlchemy 2.0 compatibility (no breaking change, retains support for SA 1.4) (bfedc8d_)
104
+
105
+ .. _d301658: https://github.com/level12/webgrid/commit/d301658
106
+ .. _bfedc8d: https://github.com/level12/webgrid/commit/bfedc8d
107
+
108
+
91
109
  0.5.1 released 2023-01-20
92
110
  -------------------------
93
111
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: WebGrid
3
- Version: 0.5.1
3
+ Version: 0.5.3
4
4
  Summary: A library for rendering HTML tables and Excel files from SQLAlchemy models.
5
5
  Home-page: https://github.com/level12/webgrid
6
6
  Author: Randy Syring
@@ -88,6 +88,24 @@ Links
88
88
  Changelog
89
89
  =========
90
90
 
91
+ 0.5.3 released 2023-03-02
92
+ -------------------------
93
+
94
+ - fix column attribute extraction for non-SQLAlchemy records (a090491_)
95
+
96
+ .. _a090491: https://github.com/level12/webgrid/commit/a090491
97
+
98
+
99
+ 0.5.2 released 2023-02-24
100
+ -------------------------
101
+
102
+ - fix openpyxl typing imports when openpyxl not present (d301658_)
103
+ - SQLAlchemy 2.0 compatibility (no breaking change, retains support for SA 1.4) (bfedc8d_)
104
+
105
+ .. _d301658: https://github.com/level12/webgrid/commit/d301658
106
+ .. _bfedc8d: https://github.com/level12/webgrid/commit/bfedc8d
107
+
108
+
91
109
  0.5.1 released 2023-01-20
92
110
  -------------------------
93
111
 
@@ -12,7 +12,6 @@ dataclasses
12
12
  arrow
13
13
  coverage
14
14
  mock
15
- nose
16
15
  openpyxl
17
16
  psycopg2-binary
18
17
  pyodbc==4.0.34
@@ -1,6 +1,24 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 0.5.3 released 2023-03-02
5
+ -------------------------
6
+
7
+ - fix column attribute extraction for non-SQLAlchemy records (a090491_)
8
+
9
+ .. _a090491: https://github.com/level12/webgrid/commit/a090491
10
+
11
+
12
+ 0.5.2 released 2023-02-24
13
+ -------------------------
14
+
15
+ - fix openpyxl typing imports when openpyxl not present (d301658_)
16
+ - SQLAlchemy 2.0 compatibility (no breaking change, retains support for SA 1.4) (bfedc8d_)
17
+
18
+ .. _d301658: https://github.com/level12/webgrid/commit/d301658
19
+ .. _bfedc8d: https://github.com/level12/webgrid/commit/bfedc8d
20
+
21
+
4
22
  0.5.1 released 2023-01-20
5
23
  -------------------------
6
24
 
@@ -12,7 +12,6 @@ develop_requires = [
12
12
  'arrow',
13
13
  'coverage',
14
14
  'mock',
15
- 'nose', # required to import some blazeweb helpers
16
15
  'openpyxl',
17
16
  'psycopg2-binary',
18
17
  # pinned to version in our package index.
@@ -319,8 +319,10 @@ class Column(object):
319
319
  """
320
320
  # key style based on key
321
321
  try:
322
- return record[self.key]
323
- except (TypeError, KeyError):
322
+ if isinstance(record, dict):
323
+ return record[self.key]
324
+ return record._mapping[self.key]
325
+ except (TypeError, KeyError, AttributeError):
324
326
  pass
325
327
 
326
328
  # index style based on position in query and key
@@ -1370,7 +1372,7 @@ class BaseGrid(six.with_metaclass(_DeclarativeMeta, object)):
1370
1372
  sa_aggregate_func, _ = self.subtotal_cols[colobj.key]
1371
1373
 
1372
1374
  # column may have a label. If it does, use it
1373
- if isinstance(colobj.expr, sasql.expression._Label):
1375
+ if isinstance(colobj.expr, sasql.expression.Label):
1374
1376
  aggregate_this = sasql.text(colobj.key)
1375
1377
  elif colobj.expr is None:
1376
1378
  aggregate_this = sasql.literal_column(colobj.key)
@@ -1390,7 +1392,10 @@ class BaseGrid(six.with_metaclass(_DeclarativeMeta, object)):
1390
1392
  cols.append(sa.literal(1).label('__is_total__'))
1391
1393
 
1392
1394
  t0 = time.perf_counter()
1393
- result = self.manager.sa_query(*cols).select_entity_from(SUB).first()
1395
+ query = self.manager.sa_query(*cols)
1396
+ # WARN: probably not future proof
1397
+ query._set_select_from([SUB], True)
1398
+ result = query.first()
1394
1399
  t1 = time.perf_counter()
1395
1400
  log.debug('Totals query ran in {} seconds'.format(t1 - t0))
1396
1401
 
@@ -36,6 +36,8 @@ import csv
36
36
  if openpyxl:
37
37
  from openpyxl.styles import Font, Border, Side, Alignment
38
38
  from openpyxl.utils import get_column_letter
39
+ else:
40
+ Font = Border = Side = Alignment = None
39
41
 
40
42
  try:
41
43
  from morphi.helpers.jinja import configure_jinja_environment
@@ -3,6 +3,7 @@ import datetime as dt
3
3
  from decimal import Decimal as D
4
4
 
5
5
  from blazeutils.containers import HTMLAttributes
6
+ from blazeutils.datastructures import BlankObject
6
7
  import pytest
7
8
 
8
9
  from webgrid import (
@@ -124,6 +125,18 @@ class TestColumn(object):
124
125
  assert col.can_sort is False
125
126
  assert col.visible is False
126
127
 
128
+ def test_extraction_by_key(self):
129
+ col = Column('Foo', 'foo')
130
+ record = {'foo': 'bar', 'other': 'value'}
131
+ data = col.extract_data(record)
132
+ assert data == 'bar'
133
+
134
+ def test_extraction_by_attribute(self):
135
+ col = Column('Foo', 'foo')
136
+ record = BlankObject(foo='bar', other='value')
137
+ data = col.extract_data(record)
138
+ assert data == 'bar'
139
+
127
140
  def test_nonkeyed_not_sort(self):
128
141
  class TG(Grid):
129
142
  FullNameColumn('Full Name')
@@ -1073,13 +1073,13 @@ class TestXLSXRenderer(object):
1073
1073
  assert row_values == [None, None, 'Lap 1', None, None, 'Lap 2', None, 'Lap 3', None]
1074
1074
  assert sheet.cell(2, 2).value == 'Label'
1075
1075
  assert sheet.cell(3, 2).value == 'Watch 1'
1076
- assert [str(range_) for range_ in sheet.merged_cells.ranges] == [
1076
+ assert set([str(range_) for range_ in sheet.merged_cells.ranges]) == set([
1077
1077
  'A1:B1',
1078
1078
  'C1:D1',
1079
1079
  # E is a single cell
1080
1080
  'F1:G1',
1081
1081
  'H1:I1',
1082
- ]
1082
+ ])
1083
1083
  assert sheet.max_column == 9
1084
1084
 
1085
1085
  def test_group_headings_xlsxwriter(self):
@@ -1095,13 +1095,13 @@ class TestXLSXRenderer(object):
1095
1095
  assert row_values == [None, None, 'Lap 1', None, None, 'Lap 2', None, 'Lap 3', None]
1096
1096
  assert sheet.cell(2, 2).value == 'Label'
1097
1097
  assert sheet.cell(3, 2).value == 'Watch 1'
1098
- assert [str(range_) for range_ in sheet.merged_cells.ranges] == [
1098
+ assert set([str(range_) for range_ in sheet.merged_cells.ranges]) == set([
1099
1099
  'A1:B1',
1100
1100
  'C1:D1',
1101
1101
  # E is a single cell
1102
1102
  'F1:G1',
1103
1103
  'H1:I1',
1104
- ]
1104
+ ])
1105
1105
  assert sheet.max_column == 9
1106
1106
 
1107
1107
  def test_subtotals_with_no_records(self):
@@ -1176,7 +1176,7 @@ class TestXLSXRenderer(object):
1176
1176
 
1177
1177
  assert sheet.max_row == 6
1178
1178
  assert sheet.cell(6, 1).value == 'Totals (4 records):'
1179
- assert sheet.merged_cells.ranges == []
1179
+ assert set(sheet.merged_cells.ranges) == set()
1180
1180
 
1181
1181
  def test_can_render(self):
1182
1182
  class FakeCountsGrid(PeopleGrid):
@@ -56,7 +56,9 @@ class TestGridSettings:
56
56
  data = self.ok_values(**input_data)
57
57
  with pytest.raises(
58
58
  types.ValidationError,
59
- match=re.escape(f"{subobject}: __init__() got an unexpected keyword argument 'bar'"),
59
+ match=re.compile(
60
+ f"{subobject}:.*__init__\\(\\) got an unexpected keyword argument 'bar'"
61
+ ),
60
62
  ):
61
63
  types.GridSettings.from_dict(data)
62
64
 
@@ -64,7 +66,7 @@ class TestGridSettings:
64
66
  data = self.ok_values(sort=[{'flag_desc': False}])
65
67
  with pytest.raises(
66
68
  types.ValidationError,
67
- match=re.escape("Sort: __init__() missing 1 required positional argument: 'key'"),
69
+ match=re.compile(r"Sort:.*__init__\(\) missing 1 required positional argument: 'key'"),
68
70
  ):
69
71
  types.GridSettings.from_dict(data)
70
72
 
@@ -0,0 +1 @@
1
+ VERSION = '0.5.3'
@@ -29,7 +29,7 @@ class Car(db.Model, DefaultMixin):
29
29
  year = sa.Column(sa.Integer, nullable=False)
30
30
 
31
31
  radio_id = sa.Column(sa.Integer, sa.ForeignKey(Radio.id), nullable=False)
32
- radio = sa.orm.relation(Radio, lazy=False)
32
+ radio = saorm.relationship(Radio, lazy=False)
33
33
 
34
34
  def __repr__(self):
35
35
  return '<Car %s, %s, %s>' % (self.make, self.model, self.year)
@@ -1 +0,0 @@
1
- VERSION = '0.5.1'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes