Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-Flask-SQLAlchemy for openSUSE:Factory checked in at 2021-06-01 10:40:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-Flask-SQLAlchemy (Old) and /work/SRC/openSUSE:Factory/.python-Flask-SQLAlchemy.new.1898 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Flask-SQLAlchemy" Tue Jun 1 10:40:07 2021 rev:6 rq:896577 version:2.5.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-Flask-SQLAlchemy/python-Flask-SQLAlchemy.changes 2020-07-24 09:59:20.173608399 +0200 +++ /work/SRC/openSUSE:Factory/.python-Flask-SQLAlchemy.new.1898/python-Flask-SQLAlchemy.changes 2021-06-01 10:41:43.129247911 +0200 @@ -1,0 +2,14 @@ +Sun Apr 4 23:23:50 UTC 2021 - Arun Persaud <a...@gmx.de> + +- specfile: + * update copyright year + +- update to version 2.5.1: + * Fix compatibility with Python 2.7. + +- changes from version 2.5.0: + * Update to support SQLAlchemy 1.4. + * SQLAlchemy URL objects are immutable. Some internal methods have + changed to return a new URL instead of None. :issue:`885` + +------------------------------------------------------------------- Old: ---- Flask-SQLAlchemy-2.4.4.tar.gz New: ---- Flask-SQLAlchemy-2.5.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-Flask-SQLAlchemy.spec ++++++ --- /var/tmp/diff_new_pack.bzQPam/_old 2021-06-01 10:41:43.665248824 +0200 +++ /var/tmp/diff_new_pack.bzQPam/_new 2021-06-01 10:41:43.665248824 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-Flask-SQLAlchemy # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-Flask-SQLAlchemy -Version: 2.4.4 +Version: 2.5.1 Release: 0 Summary: SQLAlchemy support for Flask License: BSD-3-Clause ++++++ Flask-SQLAlchemy-2.4.4.tar.gz -> Flask-SQLAlchemy-2.5.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Flask-SQLAlchemy-2.4.4/CHANGES.rst new/Flask-SQLAlchemy-2.5.1/CHANGES.rst --- old/Flask-SQLAlchemy-2.4.4/CHANGES.rst 2020-07-14 18:37:14.000000000 +0200 +++ new/Flask-SQLAlchemy-2.5.1/CHANGES.rst 2021-03-18 20:01:27.000000000 +0100 @@ -1,3 +1,21 @@ +Version 2.5.1 +------------- + +Released 2021-03-18 + +- Fix compatibility with Python 2.7. + + +Version 2.5.0 +------------- + +Released 2021-03-18 + +- Update to support SQLAlchemy 1.4. +- SQLAlchemy ``URL`` objects are immutable. Some internal methods have + changed to return a new URL instead of ``None``. :issue:`885` + + Version 2.4.4 ------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Flask-SQLAlchemy-2.4.4/Flask_SQLAlchemy.egg-info/PKG-INFO new/Flask-SQLAlchemy-2.5.1/Flask_SQLAlchemy.egg-info/PKG-INFO --- old/Flask-SQLAlchemy-2.4.4/Flask_SQLAlchemy.egg-info/PKG-INFO 2020-07-14 18:40:26.000000000 +0200 +++ new/Flask-SQLAlchemy-2.5.1/Flask_SQLAlchemy.egg-info/PKG-INFO 2021-03-18 20:02:18.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: Flask-SQLAlchemy -Version: 2.4.4 +Version: 2.5.1 Summary: Adds SQLAlchemy support to your Flask application. Home-page: https://github.com/pallets/flask-sqlalchemy Author: Armin Ronacher diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Flask-SQLAlchemy-2.4.4/PKG-INFO new/Flask-SQLAlchemy-2.5.1/PKG-INFO --- old/Flask-SQLAlchemy-2.4.4/PKG-INFO 2020-07-14 18:40:26.864290700 +0200 +++ new/Flask-SQLAlchemy-2.5.1/PKG-INFO 2021-03-18 20:02:18.032466000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: Flask-SQLAlchemy -Version: 2.4.4 +Version: 2.5.1 Summary: Adds SQLAlchemy support to your Flask application. Home-page: https://github.com/pallets/flask-sqlalchemy Author: Armin Ronacher diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Flask-SQLAlchemy-2.4.4/docs/quickstart.rst new/Flask-SQLAlchemy-2.5.1/docs/quickstart.rst --- old/Flask-SQLAlchemy-2.4.4/docs/quickstart.rst 2020-07-14 18:25:12.000000000 +0200 +++ new/Flask-SQLAlchemy-2.5.1/docs/quickstart.rst 2021-03-18 19:56:21.000000000 +0100 @@ -73,7 +73,7 @@ class Foo(db.Model): # ... - def __init__(**kwargs): + def __init__(self, **kwargs): super(Foo, self).__init__(**kwargs) # do custom stuff diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Flask-SQLAlchemy-2.4.4/flask_sqlalchemy/__init__.py new/Flask-SQLAlchemy-2.5.1/flask_sqlalchemy/__init__.py --- old/Flask-SQLAlchemy-2.4.4/flask_sqlalchemy/__init__.py 2020-07-14 18:36:32.000000000 +0200 +++ new/Flask-SQLAlchemy-2.5.1/flask_sqlalchemy/__init__.py 2021-03-18 20:01:04.000000000 +0100 @@ -15,16 +15,34 @@ from flask.signals import Namespace from sqlalchemy import event, inspect, orm from sqlalchemy.engine.url import make_url -from sqlalchemy.ext.declarative import DeclarativeMeta, declarative_base from sqlalchemy.orm.exc import UnmappedClassError from sqlalchemy.orm.session import Session as SessionBase -from flask_sqlalchemy.model import Model from ._compat import itervalues, string_types, xrange from .model import DefaultMeta +from .model import Model from . import utils -__version__ = "2.4.4" +try: + from sqlalchemy.orm import declarative_base + from sqlalchemy.orm import DeclarativeMeta +except ImportError: + # SQLAlchemy <= 1.3 + from sqlalchemy.ext.declarative import declarative_base + from sqlalchemy.ext.declarative import DeclarativeMeta + +# Scope the session to the current greenlet if greenlet is available, +# otherwise fall back to the current thread. +try: + from greenlet import getcurrent as _ident_func +except ImportError: + try: + from threading import get_ident as _ident_func + except ImportError: + # Python 2.7 + from thread import get_ident as _ident_func + +__version__ = "2.5.1" # the best timer function for the platform if sys.platform == 'win32': @@ -40,6 +58,26 @@ before_models_committed = _signals.signal('before-models-committed') +def _sa_url_set(url, **kwargs): + try: + url = url.set(**kwargs) + except AttributeError: + # SQLAlchemy <= 1.3 + for key, value in kwargs.items(): + setattr(url, key, value) + + return url + + +def _sa_url_query_setdefault(url, **kwargs): + query = dict(url.query) + + for key, value in kwargs.items(): + query.setdefault(key, value) + + return _sa_url_set(url, query=query) + + def _make_table(db): def _make_table(*args, **kwargs): if len(args) > 1 and isinstance(args[1], db.Column): @@ -552,7 +590,7 @@ return self._engine sa_url = make_url(uri) - options = self.get_options(sa_url, echo) + sa_url, options = self.get_options(sa_url, echo) self._engine = rv = self._sa.create_engine(sa_url, options) if _record_queries(self._app): @@ -566,8 +604,9 @@ def get_options(self, sa_url, echo): options = {} - self._sa.apply_pool_defaults(self._app, options) - self._sa.apply_driver_hacks(self._app, sa_url, options) + options = self._sa.apply_pool_defaults(self._app, options) + sa_url, options = self._sa.apply_driver_hacks(self._app, sa_url, options) + if echo: options['echo'] = echo @@ -578,7 +617,7 @@ # Give options set in SQLAlchemy.__init__() ultimate priority options.update(self._sa._engine_options) - return options + return sa_url, options def get_state(app): @@ -744,7 +783,7 @@ if options is None: options = {} - scopefunc = options.pop('scopefunc', _app_ctx_stack.__ident_func__) + scopefunc = options.pop('scopefunc', _ident_func) options.setdefault('query_cls', self.Query) return orm.scoped_session( self.create_session(options), scopefunc=scopefunc @@ -861,6 +900,11 @@ return response_or_exc def apply_pool_defaults(self, app, options): + """ + .. versionchanged:: 2.5 + Returns the ``options`` dict, for consistency with + :meth:`apply_driver_hacks`. + """ def _setdefault(optionkey, configkey): value = app.config[configkey] if value is not None: @@ -869,6 +913,7 @@ _setdefault('pool_timeout', 'SQLALCHEMY_POOL_TIMEOUT') _setdefault('pool_recycle', 'SQLALCHEMY_POOL_RECYCLE') _setdefault('max_overflow', 'SQLALCHEMY_MAX_OVERFLOW') + return options def apply_driver_hacks(self, app, sa_url, options): """This method is called before engine creation and used to inject @@ -879,9 +924,15 @@ The default implementation provides some saner defaults for things like pool sizes for MySQL and sqlite. Also it injects the setting of `SQLALCHEMY_NATIVE_UNICODE`. + + .. versionchanged:: 2.5 + Returns ``(sa_url, options)``. SQLAlchemy 1.4 made the URL + immutable, so any changes to it must now be passed back up + to the original caller. """ if sa_url.drivername.startswith('mysql'): - sa_url.query.setdefault('charset', 'utf8') + sa_url = _sa_url_query_setdefault(sa_url, charset="utf8") + if sa_url.drivername != 'mysql+gaerdbms': options.setdefault('pool_size', 10) options.setdefault('pool_recycle', 7200) @@ -911,7 +962,9 @@ # if it's not an in memory database we make the path absolute. if not detected_in_memory: - sa_url.database = os.path.join(app.root_path, sa_url.database) + sa_url = _sa_url_set( + sa_url, database=os.path.join(app.root_path, sa_url.database) + ) unu = app.config['SQLALCHEMY_NATIVE_UNICODE'] if unu is None: @@ -932,6 +985,8 @@ DeprecationWarning ) + return sa_url, options + @property def engine(self): """Gives access to the engine. If the database configuration is bound diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Flask-SQLAlchemy-2.4.4/tests/test_config.py new/Flask-SQLAlchemy-2.5.1/tests/test_config.py --- old/Flask-SQLAlchemy-2.4.4/tests/test_config.py 2020-07-14 18:25:12.000000000 +0200 +++ new/Flask-SQLAlchemy-2.5.1/tests/test_config.py 2021-03-18 19:56:21.000000000 +0100 @@ -1,3 +1,5 @@ +import os + import mock import pytest from sqlalchemy.pool import NullPool @@ -216,3 +218,9 @@ args, options = m_create_engine.call_args assert options['poolclass'].__name__ == 'NullPool' assert 'pool_size' not in options + + +def test_sqlite_relative_to_app_root(app): + app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///test.db" + db = fsa.SQLAlchemy(app) + assert db.engine.url.database == os.path.join(app.root_path, "test.db")