1605 |
1605 |
'for custom view "as-datasource", CardDef "items", field "internal-id", operator "eq"'
|
1606 |
1606 |
)
|
1607 |
1607 |
|
|
1608 |
formdef.fields[0].value_template = '{{ cards|objects:"items"|filter_by:"bool"|filter_value:True }}'
|
|
1609 |
formdef.store()
|
|
1610 |
pub.loggederror_class.wipe()
|
|
1611 |
with pytest.raises(Exception):
|
|
1612 |
"""
|
|
1613 |
File "/home/lguerin/src/wcs/wcs/sql.py", line 3225, in store
|
|
1614 |
'session_data': bytearray(pickle.dumps(self.__dict__, protocol=2)),
|
|
1615 |
_pickle.PicklingError: Can't pickle <class 'wcs.carddef._wcs_Items'>: it's not the same object as wcs.carddef._wcs_Items
|
|
1616 |
"""
|
|
1617 |
resp = get_app(pub).get('/test/') # XXX pickle error in session
|
|
1618 |
assert resp.form['f1'].options == [('', False, '---')]
|
|
1619 |
assert pub.loggederror_class.count() == 1
|
|
1620 |
logged_error = pub.loggederror_class.select()[0]
|
|
1621 |
assert logged_error.formdef_id == formdef.id
|
|
1622 |
assert logged_error.summary.startswith('Invalid value "[')
|
|
1623 |
assert logged_error.summary.endswith(
|
|
1624 |
'for custom view "as-datasource", CardDef "items", field "internal-id", operator "eq"'
|
|
1625 |
)
|
|
1626 |
assert '<wcs.variables.LazyFormData object at ' in logged_error.summary
|
|
1627 |
|
1608 |
1628 |
# empty list
|
1609 |
1629 |
formdef.fields[
|
1610 |
1630 |
0
|
... | ... | |
1612 |
1632 |
'{{ cards|objects:"items"|filter_by:"attr"|filter_value:"unknown"|getlist:"form_internal_id"|list }}'
|
1613 |
1633 |
)
|
1614 |
1634 |
formdef.store()
|
1615 |
|
custom_view.filters['filter-internal-id-operator'] = 'eq'
|
1616 |
|
custom_view.store()
|
1617 |
1635 |
resp = get_app(pub).get('/test/')
|
1618 |
1636 |
assert resp.form['f1'].options == [('', False, '---')]
|
1619 |
1637 |
custom_view.filters['filter-internal-id-operator'] = 'ne'
|
... | ... | |
1628 |
1646 |
formdef.store()
|
1629 |
1647 |
resp = get_app(pub).get('/test/')
|
1630 |
1648 |
assert {int(x[0]) for x in resp.form['f1'].options} == {1, 3, 5, 7, 9}
|
|
1649 |
formdef.fields[
|
|
1650 |
0
|
|
1651 |
].value_template = '{{ cards|objects:"items"|filter_by:"bool"|filter_value:True|getlist:"attr2" }}'
|
|
1652 |
formdef.store()
|
|
1653 |
pub.loggederror_class.wipe()
|
|
1654 |
with pytest.raises(Exception):
|
|
1655 |
"""
|
|
1656 |
File "/home/lguerin/src/wcs/wcs/sql.py", line 3225, in store
|
|
1657 |
'session_data': bytearray(pickle.dumps(self.__dict__, protocol=2)),
|
|
1658 |
_pickle.PicklingError: Can't pickle <class 'wcs.carddef._wcs_Items'>: it's not the same object as wcs.carddef._wcs_Items
|
|
1659 |
"""
|
|
1660 |
resp = get_app(pub).get('/test/')
|
|
1661 |
assert {int(x[0]) for x in resp.form['f1'].options} == {1, 3, 5, 7, 9}
|
1631 |
1662 |
|
1632 |
1663 |
|
1633 |
1664 |
def test_item_field_from_cards_check_lazy_live(pub):
|