Commits

Mikhail Korobov committed a829f3b

Only set attributes in __init__ if they are known attributes in order to ensure backwards compatibility

  • Participants
  • Parent commits 464a0fd

Comments (0)

Files changed (3)

File admin_tools/dashboard/dashboards.py

 
     def __init__(self, **kwargs):
         for key in kwargs:
-            setattr(self, key, kwargs[key])
+            if hasattr(self.__class__, key):
+                setattr(self, key, kwargs[key])
         self.children = self.children or []
 
     def init_with_context(self, context):

File admin_tools/dashboard/modules.py

 
     def __init__(self, **kwargs):
         for key in kwargs:
-            setattr(self, key, kwargs[key])
+            if hasattr(self.__class__, key):
+                setattr(self, key, kwargs[key])
         self.children = self.children or []
         self.css_classes = self.css_classes or []
 

File admin_tools/menu/items.py

 
     def __init__(self, **kwargs):
         for key in kwargs:
-            setattr(self, key, kwargs[key])
+            if hasattr(self.__class__, key):
+                setattr(self, key, kwargs[key])
         self.children = self.children or []
         self.css_classes = self.css_classes or []