ConfigTreeNode.py
branchpython3
changeset 3785 29bc2bebf1d4
parent 3755 ca814b175391
equal deleted inserted replaced
3784:a5f58ca4629b 3785:29bc2bebf1d4
   556 
   556 
   557         # Eventualy Initialize child instance list for this class of confnode
   557         # Eventualy Initialize child instance list for this class of confnode
   558         ChildrenWithSameClass = self.Children.setdefault(CTNType, list())
   558         ChildrenWithSameClass = self.Children.setdefault(CTNType, list())
   559         # Check count
   559         # Check count
   560         if getattr(CTNClass, "CTNMaxCount", None) and len(ChildrenWithSameClass) >= CTNClass.CTNMaxCount:
   560         if getattr(CTNClass, "CTNMaxCount", None) and len(ChildrenWithSameClass) >= CTNClass.CTNMaxCount:
   561             raise Exception(
   561 
   562                 _("Max count ({a1}) reached for this confnode of type {a2} ").
   562             msg = _("Max count ({a1}) reached for this confnode of type {a2} ").format(
   563                 format(a1=CTNClass.CTNMaxCount, a2=CTNType))
   563                     a1=CTNClass.CTNMaxCount, a2=CTNType)
       
   564             self.GetCTRoot().logger.write_warning(msg)
       
   565 
       
   566             return None
   564 
   567 
   565         # create the final class, derived of provided confnode and template
   568         # create the final class, derived of provided confnode and template
   566         class FinalCTNClass(CTNClass, ConfigTreeNode):
   569         class FinalCTNClass(CTNClass, ConfigTreeNode):
   567             """
   570             """
   568             ConfNode class is derivated into FinalCTNClass before being instanciated
   571             ConfNode class is derivated into FinalCTNClass before being instanciated