flask-sqlalchemy
flask-sqlalchemy copied to clipboard
modifications to backref made inside _wrap_with_default_query_class(fn, cls) get lost
def _wrap_with_default_query_class(fn, cls):
@functools.wraps(fn)
def newfn(*args, **kwargs):
_set_default_query_class(kwargs, cls)
if "backref" in kwargs:
backref = kwargs['backref']
if isinstance(backref, string_types):
backref = (backref, {})
_set_default_query_class(backref[1], cls)
return fn(*args, **kwargs)
return newfn
In the code above backref is extracted from kwargs, modified if it's a string type, but the modifications are never reintroduced to kwargs.