From 683a5c488a9c62b028642e95d707044826882d5f Mon Sep 17 00:00:00 2001 From: ospalh Date: Thu, 18 Oct 2012 09:43:02 +0200 Subject: [PATCH 1/3] Fix error message for bad re. --- aqt/browser.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aqt/browser.py b/aqt/browser.py index 165f6ba66..2df667b39 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -1130,8 +1130,7 @@ update cards set usn=?, mod=?, did=? where odid=0 and id in """ + ids2str( field, frm.ignoreCase.isChecked()) except sre_constants.error: - ui.utils.showInfo(_("Invalid regular expression."), - parent=self) + showInfo(_("Invalid regular expression."), parent=self) return else: self.onSearch() From 7ab8419594331efcf060494b5e55eb13cfa61836 Mon Sep 17 00:00:00 2001 From: ospalh Date: Thu, 18 Oct 2012 11:03:28 +0200 Subject: [PATCH 2/3] Import urllib2 only once. --- aqt/editor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aqt/editor.py b/aqt/editor.py index f037ad7b7..2dfab13f5 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -3,7 +3,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html from aqt.qt import * -import re, os, sys, urllib2, ctypes, traceback, urllib2 +import re, os, sys, urllib2, ctypes, traceback from anki.utils import stripHTML, isWin, isMac, namedtmp, json from anki.sound import play from anki.hooks import runHook, runFilter From 1ecb0c4ecd5178f8bf104b594f9e5b80fe621b9c Mon Sep 17 00:00:00 2001 From: ospalh Date: Thu, 18 Oct 2012 11:28:28 +0200 Subject: [PATCH 3/3] Use the right name to remove original file when adding. (This is in (half-)dead code, but anyway.) --- aqt/editor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aqt/editor.py b/aqt/editor.py index 2dfab13f5..48890ad6a 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -789,7 +789,7 @@ please click the help button."""), help="cloze") if canDelete and self.mw.pm.profile['deleteMedia']: if os.path.abspath(name) != os.path.abspath(path): try: - os.unlink(old) + os.unlink(path) except: pass # return a local html link