From 86480e58eafc1fa3486e03155ed34e02b4595a24 Mon Sep 17 00:00:00 2001 From: Slávek Banko Date: Sun, 22 Jan 2023 02:02:13 +0100 Subject: Drop python2 support in scripts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- .../plugins/scripting/scripts/exportxhtml/ExportXHTML.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'kexi/plugins/scripting/scripts/exportxhtml/ExportXHTML.py') diff --git a/kexi/plugins/scripting/scripts/exportxhtml/ExportXHTML.py b/kexi/plugins/scripting/scripts/exportxhtml/ExportXHTML.py index cace0340c..eff0e6368 100644 --- a/kexi/plugins/scripting/scripts/exportxhtml/ExportXHTML.py +++ b/kexi/plugins/scripting/scripts/exportxhtml/ExportXHTML.py @@ -19,7 +19,7 @@ class Datasource: try: self.connection = keximainwindow.getConnection() except: - raise "No connection established. Please open a project before." + raise Exception("No connection established. Please open a project before.") self.schema = None @@ -65,9 +65,9 @@ class Datasource: if not self.cursor: self.cursor = self.connection.executeQuerySchema( self.queryschema ) if not self.cursor: - raise "Failed to execute queryschema." + raise Exception("Failed to execute queryschema.") if not self.cursor.moveFirst(): - raise "Failed to move cursor to first record." + raise Exception("Failed to move cursor to first record.") if self.cursor.eof(): self.cursor = None return None @@ -131,7 +131,7 @@ class HtmlExporter: if items == None: break output.write("") for item in items: - u = unicode(str(self.htmlescape(item)),"latin-1") + u = str(str(self.htmlescape(item)),"latin-1") output.write("%s" % u.encode("utf-8")) output.write("\n") output.write("\n") @@ -144,7 +144,7 @@ class GuiApp: try: import gui except: - raise "Import of the Kross GUI module failed." + raise Exception("Import of the Kross GUI module failed.") self.dialog = gui.Dialog("Export XHTML") self.dialog.addLabel(self.dialog, "Export a table- or query-datasource to a XHTML-file.") @@ -176,10 +176,10 @@ class GuiApp: def doExport(self): file = str( self.file.get() ) query = str( self.datasourcelist.get() ) - print "Exporting '%s' to file '%s' ..." % (query,file) + print("Exporting '%s' to file '%s' ..." % (query,file)) if not self.datasource.setSource(query): - raise "Invalid datasource selected." + raise Exceptin("Invalid datasource selected.") #return style = str( self.stylelist.get() ) @@ -190,7 +190,7 @@ class GuiApp: exporter.write(f, style) f.close() - print "Successfully exported '%s' to file %s" % (query,file) + print("Successfully exported '%s' to file %s" % (query,file)) self.dialog.close() GuiApp( Datasource() ) -- cgit v1.2.3