Least change to adapt with python3
change some syntax - except clause - unicode -> bulitins.str - sqllite uri - fix import local path - 01 to 1 (0 is meaningless) add module - future - builtins (from future) - imp (python3 ) - past (from future) - sqlalchemy (update one) refer to http://python-future.org/compatible_idioms.html
This commit is contained in:
+10
-4
@@ -48,11 +48,17 @@ from shutil import move, copyfile
|
||||
from tornado.ioloop import IOLoop
|
||||
from tornado import version as tornadoVersion
|
||||
|
||||
try:
|
||||
from imp import reload
|
||||
from past.builtins import xrange
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
from wand.image import Image
|
||||
|
||||
use_generic_pdf_cover = False
|
||||
except ImportError, e:
|
||||
except ImportError as e:
|
||||
use_generic_pdf_cover = True
|
||||
from cgi import escape
|
||||
|
||||
@@ -2186,12 +2192,12 @@ def upload():
|
||||
return redirect(url_for('index'))
|
||||
try:
|
||||
copyfile(meta.file_path, saved_filename)
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
flash(_(u"Failed to store file %s (Permission denied)." % saved_filename), category="error")
|
||||
return redirect(url_for('index'))
|
||||
try:
|
||||
os.unlink(meta.file_path)
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
flash(_(u"Failed to delete file %s (Permission denied)." % meta.file_path), category="warning")
|
||||
|
||||
file_size = os.path.getsize(saved_filename)
|
||||
@@ -2223,7 +2229,7 @@ def upload():
|
||||
db.session.add(db_language)
|
||||
# combine path and normalize path from windows systems
|
||||
path = os.path.join(author_dir, title_dir).replace('\\','/')
|
||||
db_book = db.Books(title, "", db_author.sort, datetime.datetime.now(), datetime.datetime(101, 01, 01), 1,
|
||||
db_book = db.Books(title, "", db_author.sort, datetime.datetime.now(), datetime.datetime(101, 1, 1), 1,
|
||||
datetime.datetime.now(), path, has_cover, db_author, [], db_language)
|
||||
db_book.authors.append(db_author)
|
||||
if db_language is not None:
|
||||
|
||||
Reference in New Issue
Block a user