--- a/ProjectDjangoTagsMenu/DjangoTagsMenuHandler.py Tue Jun 23 17:52:47 2020 +0200 +++ b/ProjectDjangoTagsMenu/DjangoTagsMenuHandler.py Wed Oct 14 18:55:22 2020 +0200 @@ -811,7 +811,7 @@ elif tag == "if": from .IfTagInputDialog import IfTagInputDialog dlg = IfTagInputDialog() - if dlg.exec_() == QDialog.Accepted: + if dlg.exec() == QDialog.Accepted: templateText = dlg.getTag() elif tag == "ifchanged": data, ok = DjangoTagInputDialog.getText( @@ -1311,7 +1311,7 @@ elif tag == "lorem": from .LoremTagInputDialog import LoremTagInputDialog dlg = LoremTagInputDialog() - if dlg.exec_() == QDialog.Accepted: + if dlg.exec() == QDialog.Accepted: templateText = "{{% {0} %}}".format(dlg.getTag()) #################################################### @@ -1383,9 +1383,8 @@ self.tr("All Files (*)")) if filename: try: - f = open(filename, "r", encoding="utf-8") - comment = f.read() - f.close() + with open(filename, "r", encoding="utf-8") as f: + comment = f.read() templateText = ( '{{% comment %}} {0} {{% endcomment %}}'.format( comment))