From 9c7844481a2af680281c790af72e29c1ebe164e5 Mon Sep 17 00:00:00 2001
From: vermeul <swen@ethz.ch>
Date: Mon, 19 Aug 2019 14:34:17 +0200
Subject: [PATCH] read allowed attributes from definitions.py

---
 pybis/src/python/pybis/attribute.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/pybis/src/python/pybis/attribute.py b/pybis/src/python/pybis/attribute.py
index 7beb0b22a11..0c947fe5a9c 100644
--- a/pybis/src/python/pybis/attribute.py
+++ b/pybis/src/python/pybis/attribute.py
@@ -415,13 +415,17 @@ class AttrHolder():
             name = name_map[name]
 
         if self._is_new:
-            #if name not in self._allowed_attrs_new:
             if name not in self._defs['attrs_new']:
-                raise ValueError("No such attribute: «{}» for entity: {}".format(name, self.entity))
+                raise ValueError(
+                    "No such attribute: «{}» for entity: {}. Allowed attributes are: {}"
+                    .format(name, self.entity, self._defs['attrs_new'])
+                )
         else:
-            #if name not in self._allowed_attrs_up:
             if name not in self._defs['attrs_up']:
-                raise ValueError("No such attribute: «{}» for entity: {}".format(name, self.entity))
+                raise ValueError(
+                    "No such attribute: «{}» for entity: {}. Allowed attributes are: {}"
+                    .format(name, self.entity, self._defs['attrs_up'])
+                )
 
         if name in ["parents", "children", "components"]:
 
-- 
GitLab