Commit c9222934 authored by Mihai Patrascoiu's avatar Mihai Patrascoiu
Browse files

Fix the ColumnType validation for Config forms.

When the Class attribute has a different name then the associated SQLAlchemy Table Column,
we need to reference the form input variable to the Mapper Column instead of the Table Column.

Reintroduce type validation in the config/links controller.
parent 760f15d3
Pipeline #2048789 passed with stage
in 2 minutes and 18 seconds
...@@ -54,7 +54,7 @@ def validate_type(Type, key, value): ...@@ -54,7 +54,7 @@ def validate_type(Type, key, value):
""" """
Validate that value is of a suitable type of the attribute key of the type Type Validate that value is of a suitable type of the attribute key of the type Type
""" """
column = Type.__table__.columns.get(key, None) column = Type.__mapper__.columns.get(key, None)
if column is None: if column is None:
raise HTTPBadRequest('Field %s unknown' % key) raise HTTPBadRequest('Field %s unknown' % key)
......
...@@ -79,7 +79,6 @@ class LinkConfigController(BaseController): ...@@ -79,7 +79,6 @@ class LinkConfigController(BaseController):
if min_active > max_active: if min_active > max_active:
raise HTTPBadRequest('max_active is lower than min_active') raise HTTPBadRequest('max_active is lower than min_active')
if not link_cfg: if not link_cfg:
link_cfg = LinkConfig( link_cfg = LinkConfig(
source=source, source=source,
...@@ -89,10 +88,8 @@ class LinkConfigController(BaseController): ...@@ -89,10 +88,8 @@ class LinkConfigController(BaseController):
max_active = max_active max_active = max_active
) )
for key, value in input_dict.iteritems(): for key, value in input_dict.iteritems():
value = validate_type(LinkConfig, key, value)
#value = validate_type(LinkConfig, key, value)
setattr(link_cfg, key, value) setattr(link_cfg, key, value)
audit_configuration('link', json.dumps(input_dict)) audit_configuration('link', json.dumps(input_dict))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment