aboutsummaryrefslogtreecommitdiff
path: root/src/web/models
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-11-08 15:16:07 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-11-08 15:16:07 +0100
commit015e5ea3004b009bb3b03656d08ef45ee5f793e6 (patch)
tree81a7de4f98f9299d554ea409a4473c206680a5de /src/web/models
parentadded tag to the API whitelist (diff)
downloadnewspipe-015e5ea3004b009bb3b03656d08ef45ee5f793e6.tar.gz
newspipe-015e5ea3004b009bb3b03656d08ef45ee5f793e6.tar.bz2
newspipe-015e5ea3004b009bb3b03656d08ef45ee5f793e6.zip
bug fix
Diffstat (limited to 'src/web/models')
-rw-r--r--src/web/models/right_mixin.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/web/models/right_mixin.py b/src/web/models/right_mixin.py
index 6b2f1b67..1c316f95 100644
--- a/src/web/models/right_mixin.py
+++ b/src/web/models/right_mixin.py
@@ -1,3 +1,6 @@
+from sqlalchemy.ext.associationproxy import _AssociationList
+
+
class RightMixin:
@staticmethod
@@ -44,11 +47,17 @@ class RightMixin:
def dump(self, role='admin'):
if role == 'admin':
- dico = {k: getattr(self, k) for k in self.__table__.columns.keys()}
+ dico = {k: getattr(self, k)
+ for k in set(self.__table__.columns.keys())
+ .union(self.fields_api_read())
+ .union(self.fields_base_read())}
elif role == 'api':
dico = {k: getattr(self, k) for k in self.fields_api_read()}
else:
dico = {k: getattr(self, k) for k in self.fields_base_read()}
if hasattr(self, '__dump__'):
dico.update(self.__dump__)
+ for key, value in dico.items(): # preventing association proxy to die
+ if isinstance(value, _AssociationList):
+ dico[key] = list(value)
return dico
bgstack15