Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-Flask-HTTPAuth for 
openSUSE:Factory checked in at 2021-06-01 10:40:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-Flask-HTTPAuth (Old)
 and      /work/SRC/openSUSE:Factory/.python-Flask-HTTPAuth.new.1898 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-Flask-HTTPAuth"

Tue Jun  1 10:40:08 2021 rev:5 rq:896578 version:4.2.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-Flask-HTTPAuth/python-Flask-HTTPAuth.changes  
    2020-06-29 21:17:50.241685978 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-Flask-HTTPAuth.new.1898/python-Flask-HTTPAuth.changes
    2021-06-01 10:41:43.881249191 +0200
@@ -1,0 +2,12 @@
+Thu Nov 26 17:46:21 UTC 2020 - Arun Persaud <[email protected]>
+
+- specfile:
+  * update copyright year
+
+- update to version 4.2.0:
+  * Allow error response to return a 200 status code #114 (commit)
+  * Add optional argument to MultiAuth class #115 (commit) (thanks
+    pryankster and Michael Wright!)
+  * Remove python 3.5 and add python 3.9 to build (commit)
+
+-------------------------------------------------------------------

Old:
----
  Flask-HTTPAuth-4.1.0.tar.gz

New:
----
  Flask-HTTPAuth-4.2.0.tar.gz

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

Other differences:
------------------
++++++ python-Flask-HTTPAuth.spec ++++++
--- /var/tmp/diff_new_pack.8ceNf4/_old  2021-06-01 10:41:44.353249996 +0200
+++ /var/tmp/diff_new_pack.8ceNf4/_new  2021-06-01 10:41:44.357250002 +0200
@@ -19,7 +19,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-Flask-HTTPAuth
-Version:        4.1.0
+Version:        4.2.0
 Release:        0
 Summary:        Basic and Digest HTTP authentication for Flask routes
 License:        MIT

++++++ Flask-HTTPAuth-4.1.0.tar.gz -> Flask-HTTPAuth-4.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Flask-HTTPAuth-4.1.0/Flask_HTTPAuth.egg-info/PKG-INFO 
new/Flask-HTTPAuth-4.2.0/Flask_HTTPAuth.egg-info/PKG-INFO
--- old/Flask-HTTPAuth-4.1.0/Flask_HTTPAuth.egg-info/PKG-INFO   2020-06-05 
01:00:01.000000000 +0200
+++ new/Flask-HTTPAuth-4.2.0/Flask_HTTPAuth.egg-info/PKG-INFO   2020-11-16 
12:52:39.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: Flask-HTTPAuth
-Version: 4.1.0
+Version: 4.2.0
 Summary: Basic and Digest HTTP authentication for Flask routes
 Home-page: http://github.com/miguelgrinberg/flask-httpauth/
 Author: Miguel Grinberg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Flask-HTTPAuth-4.1.0/Flask_HTTPAuth.egg-info/SOURCES.txt 
new/Flask-HTTPAuth-4.2.0/Flask_HTTPAuth.egg-info/SOURCES.txt
--- old/Flask-HTTPAuth-4.1.0/Flask_HTTPAuth.egg-info/SOURCES.txt        
2020-06-05 01:00:01.000000000 +0200
+++ new/Flask-HTTPAuth-4.2.0/Flask_HTTPAuth.egg-info/SOURCES.txt        
2020-11-16 12:52:40.000000000 +0100
@@ -59,6 +59,7 @@
 tests/test_digest_custom_realm.py
 tests/test_digest_get_password.py
 tests/test_digest_ha1_password.py
+tests/test_error_responses.py
 tests/test_multi.py
 tests/test_roles.py
 tests/test_token.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Flask-HTTPAuth-4.1.0/PKG-INFO 
new/Flask-HTTPAuth-4.2.0/PKG-INFO
--- old/Flask-HTTPAuth-4.1.0/PKG-INFO   2020-06-05 01:00:01.615152400 +0200
+++ new/Flask-HTTPAuth-4.2.0/PKG-INFO   2020-11-16 12:52:40.275509400 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: Flask-HTTPAuth
-Version: 4.1.0
+Version: 4.2.0
 Summary: Basic and Digest HTTP authentication for Flask routes
 Home-page: http://github.com/miguelgrinberg/flask-httpauth/
 Author: Miguel Grinberg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Flask-HTTPAuth-4.1.0/flask_httpauth.py 
new/Flask-HTTPAuth-4.2.0/flask_httpauth.py
--- old/Flask-HTTPAuth-4.1.0/flask_httpauth.py  2020-06-05 00:59:56.000000000 
+0200
+++ new/Flask-HTTPAuth-4.2.0/flask_httpauth.py  2020-11-16 12:52:31.000000000 
+0100
@@ -12,11 +12,11 @@
 from functools import wraps
 from hashlib import md5
 from random import Random, SystemRandom
-from flask import request, make_response, session, g
+from flask import request, make_response, session, g, Response
 from werkzeug.datastructures import Authorization
 from werkzeug.security import safe_str_cmp
 
-__version__ = '4.1.0'
+__version__ = '4.2.0'
 
 
 class HTTPAuth(object):
@@ -49,8 +49,9 @@
         @wraps(f)
         def decorated(*args, **kwargs):
             res = f(*args, **kwargs)
+            check_status_code = not isinstance(res, (tuple, Response))
             res = make_response(res)
-            if res.status_code == 200:
+            if check_status_code and res.status_code == 200:
                 # if user didn't set status code, use 401
                 res.status_code = 401
             if 'WWW-Authenticate' not in res.headers.keys():
@@ -352,9 +353,11 @@
         self.main_auth = main_auth
         self.additional_auth = args
 
-    def login_required(self, f=None, role=None):
-        if f is not None and role is not None:  # pragma: no cover
-            raise ValueError('role is the only supported argument')
+    def login_required(self, f=None, role=None, optional=None):
+        if f is not None and \
+                (role is not None or optional is not None):  # pragma: no cover
+            raise ValueError(
+                'role and optional are the only supported arguments')
 
         def login_required_internal(f):
             @wraps(f)
@@ -374,8 +377,9 @@
                                 break
                 if selected_auth is None:
                     selected_auth = self.main_auth
-                return selected_auth.login_required(role=role)(f)(
-                    *args, **kwargs)
+                return selected_auth.login_required(role=role,
+                                                    optional=optional
+                                                    )(f)(*args, **kwargs)
             return decorated
 
         if f:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Flask-HTTPAuth-4.1.0/tests/test_error_responses.py 
new/Flask-HTTPAuth-4.2.0/tests/test_error_responses.py
--- old/Flask-HTTPAuth-4.1.0/tests/test_error_responses.py      1970-01-01 
01:00:00.000000000 +0100
+++ new/Flask-HTTPAuth-4.2.0/tests/test_error_responses.py      2020-11-16 
11:28:40.000000000 +0100
@@ -0,0 +1,47 @@
+import unittest
+import base64
+from flask import Flask, Response
+from flask_httpauth import HTTPBasicAuth
+
+
+class HTTPAuthTestCase(unittest.TestCase):
+    responses = [
+        ['error', 401],
+        [('error', 403), 403],
+        [('error', 200), 200],
+        [Response('error'), 200],
+        [Response('error', 403), 403],
+    ]
+
+    def setUp(self):
+        app = Flask(__name__)
+        app.config['SECRET_KEY'] = 'my secret'
+
+        basic_verify_auth = HTTPBasicAuth()
+
+        @basic_verify_auth.verify_password
+        def basic_verify_auth_verify_password(username, password):
+            return False
+
+        @basic_verify_auth.error_handler
+        def error_handler():
+            self.assertIsNone(basic_verify_auth.current_user())
+            return self.error_response
+
+        @app.route('/')
+        @basic_verify_auth.login_required
+        def index():
+            return 'index'
+
+        self.app = app
+        self.basic_verify_auth = basic_verify_auth
+        self.client = app.test_client()
+
+    def test_default_status_code(self):
+        creds = base64.b64encode(b'foo:bar').decode('utf-8')
+
+        for r in self.responses:
+            self.error_response = r[0]
+            response = self.client.get(
+                '/', headers={'Authorization': 'Basic ' + creds})
+            self.assertEqual(response.status_code, r[1])

Reply via email to