Hello community,

here is the log from the commit of package python-SQLAlchemy-Utils for 
openSUSE:Factory checked in at 2018-12-10 12:30:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-SQLAlchemy-Utils (Old)
 and      /work/SRC/openSUSE:Factory/.python-SQLAlchemy-Utils.new.19453 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-SQLAlchemy-Utils"

Mon Dec 10 12:30:22 2018 rev:15 rq:656753 version:0.33.9

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-SQLAlchemy-Utils/python-SQLAlchemy-Utils.changes
  2018-11-26 10:29:41.213071565 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-SQLAlchemy-Utils.new.19453/python-SQLAlchemy-Utils.changes
       2018-12-10 12:30:24.786402516 +0100
@@ -1,0 +2,7 @@
+Sat Dec  8 19:34:43 UTC 2018 - Arun Persaud <a...@gmx.de>
+
+- update to version 0.33.9:
+  * Fixed SQLite database_exists to check for correct file format
+    (#306, pull request courtesy of jomasti)
+
+-------------------------------------------------------------------

Old:
----
  SQLAlchemy-Utils-0.33.8.tar.gz

New:
----
  SQLAlchemy-Utils-0.33.9.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-SQLAlchemy-Utils.spec ++++++
--- /var/tmp/diff_new_pack.2cLKvj/_old  2018-12-10 12:30:25.210402093 +0100
+++ /var/tmp/diff_new_pack.2cLKvj/_new  2018-12-10 12:30:25.214402088 +0100
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-SQLAlchemy-Utils
-Version:        0.33.8
+Version:        0.33.9
 Release:        0
 Summary:        Various utility functions for SQLAlchemy
 License:        BSD-3-Clause

++++++ SQLAlchemy-Utils-0.33.8.tar.gz -> SQLAlchemy-Utils-0.33.9.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SQLAlchemy-Utils-0.33.8/CHANGES.rst 
new/SQLAlchemy-Utils-0.33.9/CHANGES.rst
--- old/SQLAlchemy-Utils-0.33.8/CHANGES.rst     2018-11-19 13:06:09.000000000 
+0100
+++ new/SQLAlchemy-Utils-0.33.9/CHANGES.rst     2018-12-04 14:37:35.000000000 
+0100
@@ -4,6 +4,12 @@
 Here you can see the full list of changes between each SQLAlchemy-Utils 
release.
 
 
+0.33.9 (2018-11-19)
+^^^^^^^^^^^^^^^^^^^
+
+- Fixed SQLite database_exists to check for correct file format (#306, pull 
request courtesy of jomasti)
+
+
 0.33.8 (2018-11-19)
 ^^^^^^^^^^^^^^^^^^^
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SQLAlchemy-Utils-0.33.8/PKG-INFO 
new/SQLAlchemy-Utils-0.33.9/PKG-INFO
--- old/SQLAlchemy-Utils-0.33.8/PKG-INFO        2018-11-19 13:41:48.000000000 
+0100
+++ new/SQLAlchemy-Utils-0.33.9/PKG-INFO        2018-12-04 14:40:02.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: SQLAlchemy-Utils
-Version: 0.33.8
+Version: 0.33.9
 Summary: Various utility functions for SQLAlchemy.
 Home-page: https://github.com/kvesteri/sqlalchemy-utils
 Author: Konsta Vesterinen, Ryan Leckey, Janne Vanhala, Vesa Uimonen
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SQLAlchemy-Utils-0.33.8/SQLAlchemy_Utils.egg-info/PKG-INFO 
new/SQLAlchemy-Utils-0.33.9/SQLAlchemy_Utils.egg-info/PKG-INFO
--- old/SQLAlchemy-Utils-0.33.8/SQLAlchemy_Utils.egg-info/PKG-INFO      
2018-11-19 13:41:47.000000000 +0100
+++ new/SQLAlchemy-Utils-0.33.9/SQLAlchemy_Utils.egg-info/PKG-INFO      
2018-12-04 14:40:02.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: SQLAlchemy-Utils
-Version: 0.33.8
+Version: 0.33.9
 Summary: Various utility functions for SQLAlchemy.
 Home-page: https://github.com/kvesteri/sqlalchemy-utils
 Author: Konsta Vesterinen, Ryan Leckey, Janne Vanhala, Vesa Uimonen
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SQLAlchemy-Utils-0.33.8/conftest.py 
new/SQLAlchemy-Utils-0.33.9/conftest.py
--- old/SQLAlchemy-Utils-0.33.8/conftest.py     2018-11-19 08:53:23.000000000 
+0100
+++ new/SQLAlchemy-Utils-0.33.9/conftest.py     2018-12-04 14:36:31.000000000 
+0100
@@ -73,7 +73,7 @@
 
 
 @pytest.fixture
-def sqlite_file_dsn():
+def sqlite_file_dsn(db_name):
     return 'sqlite:///{0}.db'.format(db_name)
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SQLAlchemy-Utils-0.33.8/docs/internationalization.rst 
new/SQLAlchemy-Utils-0.33.9/docs/internationalization.rst
--- old/SQLAlchemy-Utils-0.33.8/docs/internationalization.rst   2018-09-20 
09:34:12.000000000 +0200
+++ new/SQLAlchemy-Utils-0.33.9/docs/internationalization.rst   2018-12-03 
08:37:23.000000000 +0100
@@ -88,7 +88,7 @@
 Translation hybrids can also be used as expressions.
 ::
 
-    session.query(Article).filter(Article.name['en'] == 'Some article')
+    session.query(Article).filter(Article.name_translations['en'] == 'Some 
article')
 
 
 By default if no value is found for either current or default locale the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SQLAlchemy-Utils-0.33.8/sqlalchemy_utils/__init__.py 
new/SQLAlchemy-Utils-0.33.9/sqlalchemy_utils/__init__.py
--- old/SQLAlchemy-Utils-0.33.8/sqlalchemy_utils/__init__.py    2018-11-19 
13:06:17.000000000 +0100
+++ new/SQLAlchemy-Utils-0.33.9/sqlalchemy_utils/__init__.py    2018-12-04 
14:37:43.000000000 +0100
@@ -100,4 +100,4 @@
     refresh_materialized_view
 )
 
-__version__ = '0.33.8'
+__version__ = '0.33.9'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SQLAlchemy-Utils-0.33.8/sqlalchemy_utils/functions/database.py 
new/SQLAlchemy-Utils-0.33.9/sqlalchemy_utils/functions/database.py
--- old/SQLAlchemy-Utils-0.33.8/sqlalchemy_utils/functions/database.py  
2018-11-19 08:53:23.000000000 +0100
+++ new/SQLAlchemy-Utils-0.33.9/sqlalchemy_utils/functions/database.py  
2018-12-04 14:36:31.000000000 +0100
@@ -458,6 +458,15 @@
         engine.dispose()
         return result
 
+    def sqlite_file_exists(database):
+        if not os.path.isfile(database) or os.path.getsize(database) < 100:
+            return False
+
+        with open(database, 'rb') as f:
+            header = f.read(100)
+
+        return header[:16] == b'SQLite format 3\x00'
+
     url = copy(make_url(url))
     database = url.database
     if url.drivername.startswith('postgres'):
@@ -478,7 +487,7 @@
 
     elif engine.dialect.name == 'sqlite':
         if database:
-            return database == ':memory:' or os.path.exists(database)
+            return database == ':memory:' or sqlite_file_exists(database)
         else:
             # The default SQLAlchemy database is in memory,
             # and :memory is not required, thus we should support that use-case
@@ -567,7 +576,8 @@
 
     elif engine.dialect.name == 'sqlite' and database != ':memory:':
         if database:
-            open(database, 'w').close()
+            engine.execute("CREATE TABLE DB(id int);")
+            engine.execute("DROP TABLE DB;")
 
     else:
         text = 'CREATE DATABASE {0}'.format(quote(engine, database))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SQLAlchemy-Utils-0.33.8/tests/functions/test_database.py 
new/SQLAlchemy-Utils-0.33.9/tests/functions/test_database.py
--- old/SQLAlchemy-Utils-0.33.8/tests/functions/test_database.py        
2018-11-19 08:53:23.000000000 +0100
+++ new/SQLAlchemy-Utils-0.33.9/tests/functions/test_database.py        
2018-12-04 14:36:31.000000000 +0100
@@ -35,7 +35,10 @@
 
 @pytest.mark.usefixtures('sqlite_file_dsn')
 class TestDatabaseSQLiteFile(DatabaseTest):
-    pass
+    def test_existing_non_sqlite_file(self, dsn):
+        database = sa.engine.url.make_url(dsn).database
+        open(database, 'w').close()
+        self.test_create_and_drop(dsn)
 
 
 @pytest.mark.skipif('pymysql is None')


Reply via email to