I have created a web application using Flask, Flask-Admin and Flask-SQLAlchemy where the administrator can upload images. The image uploading functionality was imitated largely from this Flask-Admin example. For the production website, I use MySQL and uploading works perfectly fine. However, in the test suite I use a memory-mapped SQLite database and any attempt to upload an image through the same form fails with an InterfaceError. See this Gist for the full details and a reduced test case.
It seems like it might have something to do with type mapping, where the MySQL backend of SQLAlchemy appears to understand that the filename of the uploaded image must be inserted in the SQL statement while the SQLite backend does not. However, the Flask-Admin example that I linked to above works absolutely fine and it is based on SQLite, too.
Who can tell me what is wrong, and what needs to be done to make the test pass? The golden tip may be awarded with up to 200 reputation points!
(Sorry, not starting a bounty hunt up front, because the last time I tried a bounty hunt on such a specialistic question, nobody answered the question within the bounty period.)
Aucun commentaire:
Enregistrer un commentaire