flask-sqlalchemy icon indicating copy to clipboard operation
flask-sqlalchemy copied to clipboard

modifications to backref made inside _wrap_with_default_query_class(fn, cls) get lost

Open ekoka opened this issue 9 years ago • 0 comments

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.

ekoka avatar Aug 19 '16 18:08 ekoka