Hello community,
here is the log from the commit of package python-flask-peewee for
openSUSE:Factory checked in at 2020-03-25 23:47:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-flask-peewee (Old)
and /work/SRC/openSUSE:Factory/.python-flask-peewee.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-flask-peewee"
Wed Mar 25 23:47:55 2020 rev:2 rq:788261 version:3.0.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-flask-peewee/python-flask-peewee.changes
2018-11-29 22:58:08.135673880 +0100
+++
/work/SRC/openSUSE:Factory/.python-flask-peewee.new.3160/python-flask-peewee.changes
2020-03-25 23:49:58.960025550 +0100
@@ -2 +2,8 @@
-Wed Oct 10 14:59:35 UTC 2018 - Antonio Larrosa <[email protected]> - 3.0.3
+Wed Mar 25 11:15:45 UTC 2020 - Antonio Larrosa <[email protected]>
+
+- Add patch from upstream to fix building with latest Werkzeug and Flask:
+ * 0001-Compatibility-with-newer-werkzeug-and-flask.patch
+- Add BuildRequires: %{pythons} to fix tests
+
+-------------------------------------------------------------------
+Wed Oct 10 14:59:35 UTC 2018 - Antonio Larrosa <[email protected]>
@@ -7 +14 @@
-Tue Oct 9 16:36:33 UTC 2018 - Antonio Larrosa <[email protected]> - 3.0.3
+Tue Oct 9 16:36:33 UTC 2018 - Antonio Larrosa <[email protected]>
@@ -9,2 +16,2 @@
-- Add runtests.py from upstream since the source package doesn't include it and
- use it to enable tests to run.
+- Add runtests.py from upstream since the source package doesn't include it
+ and use it to enable tests to run.
@@ -13 +20 @@
-Fri Sep 21 10:55:41 UTC 2018 - Antonio Larrosa <[email protected]> - 3.0.3
+Fri Sep 21 10:55:41 UTC 2018 - Antonio Larrosa <[email protected]>
@@ -16,2 +23,2 @@
-- Add 0001-Clarify-that-project-uses-MIT.patch from upstream after a request I
made
- to clarify the project license
+- Add 0001-Clarify-that-project-uses-MIT.patch from upstream after a request
+ I made to clarify the project license
New:
----
0001-Compatibility-with-newer-werkzeug-and-flask.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-flask-peewee.spec ++++++
--- /var/tmp/diff_new_pack.ZvaK0P/_old 2020-03-25 23:50:00.676025095 +0100
+++ /var/tmp/diff_new_pack.ZvaK0P/_new 2020-03-25 23:50:00.676025095 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-flask-peewee
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,37 +12,40 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-flask-peewee
Version: 3.0.3
Release: 0
-License: MIT
Summary: Peewee integration for flask
-Url: http://github.com/coleifer/flask-peewee/
+License: MIT
Group: Development/Languages/Python
+URL: http://github.com/coleifer/flask-peewee/
Source:
https://files.pythonhosted.org/packages/source/f/flask-peewee/flask-peewee-%{version}.tar.gz
Source1:
https://raw.githubusercontent.com/coleifer/flask-peewee/master/runtests.py
Patch0: 0001-Clarify-that-project-uses-MIT.patch
-BuildRequires: python-rpm-macros
+Patch1: 0001-Compatibility-with-newer-werkzeug-and-flask.patch
BuildRequires: %{python_module setuptools}
+BuildRequires: %{pythons}
BuildRequires: fdupes
+BuildRequires: python-rpm-macros
# Test requirements
BuildRequires: %{python_module Flask}
BuildRequires: %{python_module Jinja2}
-BuildRequires: %{python_module peewee >= 3.0.0}
+BuildRequires: %{python_module WTForms}
BuildRequires: %{python_module Werkzeug}
+BuildRequires: %{python_module peewee >= 3.0.0}
BuildRequires: %{python_module wtf-peewee}
-BuildRequires: %{python_module WTForms}
# End of test requirements
Requires: python-Flask
Requires: python-Jinja2
-Requires: python-peewee >= 3.0.0
+Requires: python-WTForms
Requires: python-Werkzeug
+Requires: python-peewee >= 3.0.0
Requires: python-wtf-peewee
-Requires: python-WTForms
BuildArch: noarch
%python_subpackages
@@ -53,6 +56,7 @@
%prep
%setup -q -n flask-peewee-%{version}
%patch0 -p1
+%patch1 -p1
rm -Rf example
cp %{S:1} .
++++++ 0001-Compatibility-with-newer-werkzeug-and-flask.patch ++++++
>From fd89cf20fe9525b195596d17ee122110a110f67d Mon Sep 17 00:00:00 2001
From: Charles Leifer <[email protected]>
Date: Mon, 6 Jan 2020 17:12:44 -0600
Subject: [PATCH] Compatibility with new(er) werkzeug and flask.
Tests passing and general cleanup.
---
flask_peewee/admin.py | 2 +-
flask_peewee/rest.py | 3 +--
flask_peewee/tests/base.py | 16 ++++++++--------
flask_peewee/tests/rest.py | 9 ++++-----
flask_peewee/tests/serializer.py | 28 ++++++++++++++--------------
flask_peewee/tests/test_app.py | 14 +++++++-------
flask_peewee/tests/utils.py | 10 +++++-----
7 files changed, 40 insertions(+), 42 deletions(-)
diff --git a/flask_peewee/admin.py b/flask_peewee/admin.py
index 7566e0f..9191c43 100644
--- a/flask_peewee/admin.py
+++ b/flask_peewee/admin.py
@@ -32,7 +32,7 @@
from peewee import DateTimeField
from peewee import ForeignKeyField
from peewee import TextField
-from werkzeug import Headers
+from werkzeug.datastructures import Headers
from wtforms import fields
from wtforms import widgets
from wtfpeewee.fields import ModelHiddenField
diff --git a/flask_peewee/rest.py b/flask_peewee/rest.py
index e4a7934..05c3170 100644
--- a/flask_peewee/rest.py
+++ b/flask_peewee/rest.py
@@ -288,8 +288,7 @@ def response_bad_request(self):
return Response('Bad request', 400)
def response(self, data):
- kwargs = {} if request.is_xhr else {'indent': 2}
- return Response(json.dumps(data, **kwargs),
mimetype='application/json')
+ return Response(json.dumps(data), mimetype='application/json')
def require_method(self, func, methods):
@functools.wraps(func)
diff --git a/flask_peewee/tests/base.py b/flask_peewee/tests/base.py
index 3744510..e7cf19e 100644
--- a/flask_peewee/tests/base.py
+++ b/flask_peewee/tests/base.py
@@ -26,21 +26,21 @@ def setUp(self):
EModel.drop_table(True)
EModel.create_table()
FModel.create_table()
-
+
self.flask_app = test_app.app
self.flask_app._template_context = {}
-
- self.app = test_app.app.test_client()
-
+
+ self.app = test_app.app.test_client()
+
def create_user(self, username, password, **kwargs):
user = User(username=username, email=kwargs.pop('email', ''), **kwargs)
user.set_password(password)
user.save()
return user
-
+
def create_message(self, user, content, **kwargs):
return Message.create(user=user, content=content, **kwargs)
-
+
def create_users(self):
users = [
self.create_user('admin', 'admin', admin=True),
@@ -49,11 +49,11 @@ def create_users(self):
]
self.admin, self.normal, self.inactive = users
return users
-
+
def get_context(self, var_name):
if var_name not in self.flask_app._template_context:
raise KeyError('%s not in template context' % var_name)
return self.flask_app._template_context[var_name]
-
+
def assertContext(self, key, value):
self.assertEqual(self.get_context(key), value)
diff --git a/flask_peewee/tests/rest.py b/flask_peewee/tests/rest.py
index ed8f80c..07970cc 100644
--- a/flask_peewee/tests/rest.py
+++ b/flask_peewee/tests/rest.py
@@ -18,8 +18,10 @@
from flask_peewee.tests.base import FlaskPeeweeTestCase
from flask_peewee.tests.test_app import AModel
from flask_peewee.tests.test_app import APIKey
+from flask_peewee.tests.test_app import BDetails
from flask_peewee.tests.test_app import BModel
from flask_peewee.tests.test_app import CModel
+from flask_peewee.tests.test_app import DModel
from flask_peewee.tests.test_app import EModel
from flask_peewee.tests.test_app import FModel
from flask_peewee.tests.test_app import Message
@@ -106,11 +108,8 @@ def assertAPITestModels(self, json_data, tms):
class RestApiResourceTestCase(RestApiTestCase):
def setUp(self):
super(RestApiResourceTestCase, self).setUp()
- FModel.delete().execute()
- EModel.delete().execute()
- CModel.delete().execute()
- BModel.delete().execute()
- AModel.delete().execute()
+ for M in (FModel, EModel, DModel, CModel, BDetails, BModel, AModel):
+ M.delete().execute()
def create_test_models(self):
self.a1 = AModel.create(a_field='a1')
diff --git a/flask_peewee/tests/serializer.py b/flask_peewee/tests/serializer.py
index d0beabc..5734cd4 100644
--- a/flask_peewee/tests/serializer.py
+++ b/flask_peewee/tests/serializer.py
@@ -13,7 +13,7 @@ def setUp(self):
super(SerializerTestCase, self).setUp()
self.s = Serializer()
self.d = Deserializer()
-
+
def test_serializer(self):
users = self.create_users()
serialized = self.s.serialize_object(self.admin)
@@ -26,13 +26,13 @@ def test_serializer(self):
'admin': True,
'email': '',
})
-
+
serialized = self.s.serialize_object(self.admin, fields={User: ['id',
'username']})
self.assertEqual(serialized, {
'id': self.admin.id,
'username': 'admin',
})
-
+
serialized = self.s.serialize_object(self.admin, exclude={User:
['password', 'join_date']})
self.assertEqual(serialized, {
'id': self.admin.id,
@@ -41,10 +41,10 @@ def test_serializer(self):
'admin': True,
'email': '',
})
-
+
def test_deserializer(self):
users = self.create_users()
-
+
deserialized, models = self.d.deserialize_object(User(), {
'id': self.admin.id,
'username': 'admin',
@@ -53,40 +53,40 @@ def test_deserializer(self):
'active': True,
'admin': True,
})
-
+
for attr in ['id', 'username', 'password', 'active', 'admin']:
self.assertEqual(
getattr(deserialized, attr),
getattr(self.admin, attr),
)
-
+
self.assertEqual(
deserialized.join_date.strftime('%Y-%m-%d %H:%M:%S'),
self.admin.join_date.strftime('%Y-%m-%d %H:%M:%S'),
)
-
+
admin_pk = self.admin.id
-
+
deserialized, models = self.d.deserialize_object(self.admin, {
'username': 'edited',
'active': False,
'admin': False,
})
-
+
self.assertEqual(deserialized.username, 'edited')
self.assertEqual(deserialized.admin, False)
self.assertEqual(deserialized.active, False)
self.assertEqual(deserialized.id, admin_pk)
-
+
deserialized.save()
-
+
self.assertEqual(User.select().count(), 3)
edited = User.get(username='edited')
self.assertEqual(edited.id, admin_pk)
-
+
def test_s_and_d(self):
self.create_users()
-
+
s = self.s.serialize_object(self.admin)
d, model_list = self.d.deserialize_object(User(), s)
self.assertEqual(d, self.admin)
diff --git a/flask_peewee/tests/test_app.py b/flask_peewee/tests/test_app.py
index 25c72ad..c90d4a9 100644
--- a/flask_peewee/tests/test_app.py
+++ b/flask_peewee/tests/test_app.py
@@ -70,7 +70,7 @@ class Message(db.Model):
user = ForeignKeyField(User)
content = TextField()
pub_date = DateTimeField(default=datetime.datetime.now)
-
+
def __unicode__(self):
return '%s: %s' % (self.user, self.content)
@@ -83,7 +83,7 @@ class Note(db.Model):
class TestModel(db.Model):
data = TextField()
-
+
class Meta:
order_by = ('id',)
@@ -98,7 +98,7 @@ class BModel(db.Model):
class CModel(db.Model):
b = ForeignKeyField(BModel)
c_field = CharField()
-
+
class DModel(db.Model):
c = ForeignKeyField(CModel)
d_field = CharField()
@@ -122,12 +122,12 @@ class APIKey(db.Model):
class NotePanel(AdminPanel):
template_name = 'admin/notes.html'
-
+
def get_urls(self):
return (
('/create/', self.create),
)
-
+
def create(self):
if request.method == 'POST':
if request.form.get('message'):
@@ -137,7 +137,7 @@ def create(self):
)
next = request.form.get('next') or self.dashboard_url()
return redirect(next)
-
+
def get_context(self):
return {
'note_list': Note.select().order_by(('created_date',
'desc')).paginate(1, 3)
@@ -183,7 +183,7 @@ class NoteAdmin(ModelAdmin):
class UserResource(RestResource):
exclude = ('password', 'email',)
-
+
def get_query(self):
return User.select().where(User.active==True)
diff --git a/flask_peewee/tests/utils.py b/flask_peewee/tests/utils.py
index 64bed7c..d975bdf 100644
--- a/flask_peewee/tests/utils.py
+++ b/flask_peewee/tests/utils.py
@@ -21,27 +21,27 @@
class UtilsTestCase(FlaskPeeweeTestCase):
def setUp(self):
super(UtilsTestCase, self).setUp()
-
+
def test_get_object_or_404(self):
user = self.create_user('test', 'test')
-
+
# test with model as first arg
self.assertRaises(NotFound, get_object_or_404, User,
User.username=='not-here')
self.assertEqual(user, get_object_or_404(User, User.username=='test'))
-
+
# test with query as first arg
active = User.select().where(User.active==True)
inactive = User.select().where(User.active==False)
self.assertRaises(NotFound, get_object_or_404, active,
User.username=='not-here')
self.assertRaises(NotFound, get_object_or_404, inactive,
User.username=='test')
self.assertEqual(user, get_object_or_404(active,
User.username=='test'))
-
+
def test_passwords(self):
p = make_password('testing')
self.assertTrue(check_password('testing', p))
self.assertFalse(check_password('testing ', p))
self.assertFalse(check_password('Testing', p))
self.assertFalse(check_password('', p))
-
+
p2 = make_password('Testing')
self.assertFalse(p == p2)