ProjectDjangoTagsMenu/DjangoTagInputDialog.py

changeset 47
825bf5861f89
parent 44
3ea572ed13b6
child 49
ef6c805ae218
diff -r 1e62de075091 -r 825bf5861f89 ProjectDjangoTagsMenu/DjangoTagInputDialog.py
--- a/ProjectDjangoTagsMenu/DjangoTagInputDialog.py	Tue Jun 23 17:52:01 2020 +0200
+++ b/ProjectDjangoTagsMenu/DjangoTagInputDialog.py	Tue Jun 23 17:52:32 2020 +0200
@@ -7,8 +7,6 @@
 Module implementing a dialog to enter data for the creation of a tag.
 """
 
-from __future__ import unicode_literals
-
 from PyQt5.QtCore import Qt
 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel
 
@@ -27,10 +25,14 @@
         @param defaults list of default values for the entry fields (list
             of string)
         @param parent reference to the parent widget (QWidget)
+        @exception RuntimeError raised to signal too many labels were given
         """
         super(DjangoTagInputDialog, self).__init__(parent)
         
-        assert 0 < len(labels) < 6      # max 5 entries allowed
+        if len(labels) == 0 or len(labels) > 5:
+            raise RuntimeError(
+                "Illegal number of labels given (max. 5 allowed)")
+        
         self.__inputs = []
         
         self.__topLayout = QVBoxLayout(self)
@@ -88,4 +90,4 @@
         if dlg.exec_() == QDialog.Accepted:
             return dlg.getData(), True
         else:
-            return tuple(), False
+            return (), False

eric ide

mercurial