association_proxy between GameObject and attributes breaks #53

Closed
opened 2016-12-16 18:59:06 +01:00 by nik · 7 comments
nik commented 2016-12-16 18:59:06 +01:00 (Migrated from edugit.org)

The association_proxy to the attributes breaks, at least with Flask-Restless 1.0.0b2. Not sure whether this is related to the update or the definition of the proxy is broken.

The association_proxy to the attributes breaks, at least with Flask-Restless 1.0.0b2. Not sure whether this is related to the update or the definition of the proxy is broken.
nik commented 2017-01-22 20:48:43 +01:00 (Migrated from edugit.org)

Contacted @jfinkels by e-mail.

There is a pull request in jfinkels/flask-restless#608 that might be worth testing.

Contacted @jfinkels by e-mail. There is a pull request in jfinkels/flask-restless#608 that might be worth testing.
nik commented 2017-01-25 20:36:12 +01:00 (Migrated from edugit.org)

With https://github.com/jfinkels/flask-restless/pull/608 we at least get a different exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/flask_restless/views/base.py", line 444, in wrapped
    return func(*args, **kw)
  File "/usr/local/lib/python3.5/dist-packages/flask_restless/views/resources.py", line 400, in get
    return self._get_resource(resource_id)
  File "/usr/local/lib/python3.5/dist-packages/flask_restless/views/resources.py", line 335, in _get_resource
    return self._get_resource_helper(resource)
  File "/usr/local/lib/python3.5/dist-packages/flask_restless/views/base.py", line 1549, in _get_resource_helper
    result = serializer.serialize(resource, only=only)
  File "/usr/local/lib/python3.5/dist-packages/flask_restless/serialization/serializers.py", line 493, in serialize
    resource = self._dump(instance, only=only)
  File "/usr/local/lib/python3.5/dist-packages/flask_restless/serialization/serializers.py", line 315, in _dump
    assoc_scalars = list(assoc_proxy_scalar_collections(model))
  File "/usr/local/lib/python3.5/dist-packages/flask_restless/helpers.py", line 116, in assoc_proxy_scalar_collections
    and not isinstance(v.remote_attr.property, RelationshipProperty) \
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/ext/associationproxy.py", line 175, in remote_attr
    return getattr(self.target_class, self.value_attr)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/util/langhelpers.py", line 754, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/ext/associationproxy.py", line 225, in target_class
    return self._get_property().mapper.class_
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/ext/associationproxy.py", line 214, in _get_property
    return (orm.class_mapper(self.owning_class).
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/base.py", line 425, in class_mapper
    "Class object expected, got '%r'." % (class_, ))
With https://github.com/jfinkels/flask-restless/pull/608 we at least get a different exception: ``` Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/flask_restless/views/base.py", line 444, in wrapped return func(*args, **kw) File "/usr/local/lib/python3.5/dist-packages/flask_restless/views/resources.py", line 400, in get return self._get_resource(resource_id) File "/usr/local/lib/python3.5/dist-packages/flask_restless/views/resources.py", line 335, in _get_resource return self._get_resource_helper(resource) File "/usr/local/lib/python3.5/dist-packages/flask_restless/views/base.py", line 1549, in _get_resource_helper result = serializer.serialize(resource, only=only) File "/usr/local/lib/python3.5/dist-packages/flask_restless/serialization/serializers.py", line 493, in serialize resource = self._dump(instance, only=only) File "/usr/local/lib/python3.5/dist-packages/flask_restless/serialization/serializers.py", line 315, in _dump assoc_scalars = list(assoc_proxy_scalar_collections(model)) File "/usr/local/lib/python3.5/dist-packages/flask_restless/helpers.py", line 116, in assoc_proxy_scalar_collections and not isinstance(v.remote_attr.property, RelationshipProperty) \ File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/ext/associationproxy.py", line 175, in remote_attr return getattr(self.target_class, self.value_attr) File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/util/langhelpers.py", line 754, in __get__ obj.__dict__[self.__name__] = result = self.fget(obj) File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/ext/associationproxy.py", line 225, in target_class return self._get_property().mapper.class_ File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/ext/associationproxy.py", line 214, in _get_property return (orm.class_mapper(self.owning_class). File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/base.py", line 425, in class_mapper "Class object expected, got '%r'." % (class_, )) ```
nik commented 2017-01-28 01:57:00 +01:00 (Migrated from edugit.org)

@Creeparoo, if we cannot get this fixed, shall we go with a self.attribute("foo", "bar") API for now until we can fix it?

@Creeparoo, if we cannot get this fixed, shall we go with a `self.attribute("foo", "bar")` API for now until we can fix it?
eike commented 2017-01-28 11:37:39 +01:00 (Migrated from edugit.org)

Created by: Creeparoo

Yes!

*Created by: Creeparoo* Yes!
nik commented 2017-02-28 14:02:06 +01:00 (Migrated from edugit.org)

Removing from milestone as this is a Flask-Restless bug. We could release the beta without the dictionary API.

Removing from milestone as this is a Flask-Restless bug. We could release the beta without the dictionary API.
nik commented 2017-03-24 13:09:33 +01:00 (Migrated from edugit.org)
https://github.com/jfinkels/flask-restless/issues/641
nik commented 2017-04-03 17:06:51 +02:00 (Migrated from edugit.org)

Obsoleted by #117.

Obsoleted by #117.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nik/veripeditus-server#53
No description provided.