Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package gnuhealth-thalamus for 
openSUSE:Factory checked in at 2021-04-08 21:32:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/gnuhealth-thalamus (Old)
 and      /work/SRC/openSUSE:Factory/.gnuhealth-thalamus.new.2401 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "gnuhealth-thalamus"

Thu Apr  8 21:32:44 2021 rev:8 rq:883859 version:0.9.14

Changes:
--------
--- /work/SRC/openSUSE:Factory/gnuhealth-thalamus/gnuhealth-thalamus.changes    
2021-03-11 20:12:53.276721601 +0100
+++ 
/work/SRC/openSUSE:Factory/.gnuhealth-thalamus.new.2401/gnuhealth-thalamus.changes
  2021-04-08 21:33:00.639862786 +0200
@@ -1,0 +2,5 @@
+Thu Apr  8 12:34:35 UTC 2021 - Axel Braun <axel.br...@gmx.de>
+
+- version 0.9.14 - no changelog provided
+
+-------------------------------------------------------------------

Old:
----
  thalamus-0.9.13.tar.gz

New:
----
  thalamus-0.9.14.tar.gz

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

Other differences:
------------------
++++++ gnuhealth-thalamus.spec ++++++
--- /var/tmp/diff_new_pack.uFtidV/_old  2021-04-08 21:33:01.135863329 +0200
+++ /var/tmp/diff_new_pack.uFtidV/_new  2021-04-08 21:33:01.139863335 +0200
@@ -21,7 +21,7 @@
 
 %define modname thalamus
 Name:           gnuhealth-%{modname}
-Version:        0.9.13
+Version:        0.9.14
 Release:        0
 Summary:        The GNU Health Federation Message and Authentication Server
 License:        GPL-3.0-or-later

++++++ thalamus-0.9.13.tar.gz -> thalamus-0.9.14.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/thalamus-0.9.13/PKG-INFO new/thalamus-0.9.14/PKG-INFO
--- old/thalamus-0.9.13/PKG-INFO        2021-03-03 20:13:30.480479000 +0100
+++ new/thalamus-0.9.14/PKG-INFO        2021-04-08 14:29:49.907651400 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: thalamus
-Version: 0.9.13
+Version: 0.9.14
 Summary: The GNU Health Federation Message and Authentication Server
 Home-page: http://health.gnu.org
 Author: GNU Solidario
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/thalamus-0.9.13/thalamus/thalamus.py 
new/thalamus-0.9.14/thalamus/thalamus.py
--- old/thalamus-0.9.13/thalamus/thalamus.py    2021-03-03 19:28:32.000000000 
+0100
+++ new/thalamus-0.9.14/thalamus/thalamus.py    2021-04-08 13:53:14.000000000 
+0200
@@ -1,7 +1,6 @@
-# -*- coding: utf-8 -*-
 ##############################################################################
 #
-#    Thalamus, the GNU Health Message and Authentication Server
+#    Thalamus, the GNU Health Federation Message and Authentication Server
 #
 #           Thalamus is part of the GNU Health project
 #
@@ -75,14 +74,15 @@
     Checks if the Federation ID exists on the GNU Health HIS
     Returns the instance or null
     """
-    cur = conn.cursor()
-    cur.execute(
-        sql.SQL("SELECT id from {} where id = %s \
-                limit(1)").format(sql.Identifier(table)), (resid,))
-    try:
-        res, = cur.fetchone()
-    except:
-        res = None
+    with conn:
+        with conn.cursor() as cur:
+            cur.execute(
+                sql.SQL("SELECT id from {} where id = %s \
+                        limit(1)").format(sql.Identifier(table)), (resid,))
+            try:
+                res, = cur.fetchone()
+            except:
+                res = None
 
     return res
 
@@ -96,33 +96,36 @@
     and checks them against the entry on the people db collection
     The password is bcrypt hashed
     """
-    cur = conn.cursor()
-    cur.execute('SELECT data from people \
-        where id = %s limit(1)', (username,))
-    try:
-        user, = cur.fetchone()
-    except:
-        user = None
-
-    if (user):
-        person = user['id']
-        hashed_password = user['password']
-        roles = user['roles']
-        if bcrypt.checkpw(password.encode('utf-8'),
-                          hashed_password.encode('utf-8')):
-            """ Authentication OK
-            Now check the access level for the resource
-            """
-            method = request.method
-            endpoint = request.endpoint
-            view_args = request.view_args
-            return access_control(username, roles, method, endpoint, view_args)
+    with conn:
+        with conn.cursor() as cur:
 
-        else:
-            return False
+            cur.execute('SELECT data from people \
+                where id = %s limit(1)', (username,))
+            try:
+                user, = cur.fetchone()
+            except:
+                user = None
+
+            if (user):
+                person = user['id']
+                hashed_password = user['password']
+                roles = user['roles']
+                if bcrypt.checkpw(password.encode('utf-8'),
+                                  hashed_password.encode('utf-8')):
+                    """ Authentication OK
+                    Now check the access level for the resource
+                    """
+                    method = request.method
+                    endpoint = request.endpoint
+                    view_args = request.view_args
+                    return access_control(username, roles, method,
+                                          endpoint, view_args)
+
+                else:
+                    return False
 
-    else:
-        return False
+            else:
+                return False
 
 
 # Authorization
@@ -159,11 +162,12 @@
         """
         Retrieves all the people on the person collection
         """
-        cur = conn.cursor()
-        cur.execute('SELECT data from people')
-        people = cur.fetchall()
+        with conn:
+            with conn.cursor() as cur:
+                cur.execute('SELECT data from people')
+                people = cur.fetchall()
 
-        return jsonify(people)
+                return jsonify(people)
 
 
 # Person
@@ -177,20 +181,23 @@
         """
         Retrieves the person instance
         """
-        cur = conn.cursor()
-        cur.execute('SELECT data from people \
-            where id = %s limit(1)', (person_id,))
-
-        try:
-            person, = cur.fetchone()
-        except:
-            person = None
+        with conn:
+            with conn.cursor() as cur:
 
-        # Return a 404 if the person ID is not found
-        if not person:
-            return '', 404
+                cur = conn.cursor()
+                cur.execute('SELECT data from people \
+                    where id = %s limit(1)', (person_id,))
+
+                try:
+                    person, = cur.fetchone()
+                except:
+                    person = None
+
+                # Return a 404 if the person ID is not found
+                if not person:
+                    return '', 404
 
-        return jsonify(person)
+                return jsonify(person)
 
     def post(self, person_id):
         """
@@ -239,12 +246,12 @@
             values['password'] = hashed_pw
 
         # Insert the newly created person
-        cur = conn.cursor()
-        cur.execute("INSERT INTO people (ID, DATA) VALUES (%(id)s, \
-            %(data)s)", {'id': person_id, 'data': json.dumps(values)})
-        res = conn.commit()
+        with conn:
+            with conn.cursor() as cur:
+                res = cur.execute("INSERT INTO people (ID, DATA) VALUES 
(%(id)s, \
+                    %(data)s)", {'id': person_id, 'data': json.dumps(values)})
 
-        return res
+                return res
 
     def patch(self, person_id):
         """
@@ -266,10 +273,10 @@
             jdata = json.dumps(values)
             # UPDATE the information from the person
             # associated to the federation ID
-            cur = conn.cursor()
-            cur.execute("UPDATE PEOPLE SET data = data || %s where id = %s",
-                        (jdata, person_id))
-            conn.commit()
+            with conn:
+                with conn.cursor() as cur:
+                    cur.execute("UPDATE PEOPLE SET data = data || %s where id 
= %s",
+                                (jdata, person_id))
 
         else:
             abort(404, error="User not found")
@@ -289,9 +296,9 @@
                 abort(422, error="The user is active.")
 
         # Delete the person
-        cur = conn.cursor()
-        cur.execute("DELETE FROM people WHERE id = %s", (person_id,))
-        conn.commit()
+        with conn:
+            with conn.cursor() as cur:
+                cur.execute("DELETE FROM people WHERE id = %s", (person_id,))
 
 
 # Book of Life Resource
@@ -304,11 +311,12 @@
         """
         Retrieves the pages of life from the person
         """
-        cur = conn.cursor()
-        cur.execute('SELECT data from pols where book = %s', (person_id,))
-        pages = cur.fetchall()
+        with conn:
+            with conn.cursor() as cur:
+                cur.execute('SELECT data from pols where book = %s', 
(person_id,))
+                pages = cur.fetchall()
 
-        return jsonify(pages)
+                return jsonify(pages)
 
         #  Return a 404 if the person ID is not found
         if not pages:
@@ -327,17 +335,18 @@
         """
         Retrieves the page instance
         """
-        cur = conn.cursor()
-        cur.execute('SELECT data from pols \
-            where id = %s limit(1)', (page_id,))
-        try:
-            page, = cur.fetchone()
-        except:
-            page = None
-
-        #  Return a 404 if the page ID is not found
-        if not page:
-            abort(404, error="Book or page or not found")
+        with conn:
+            with conn.cursor() as cur:
+                cur.execute('SELECT data from pols \
+                    where id = %s limit(1)', (page_id,))
+                try:
+                    page, = cur.fetchone()
+                except:
+                    page = None
+
+                #  Return a 404 if the page ID is not found
+                if not page:
+                    abort(404, error="Book or page or not found")
 
         return jsonify(page)
 
@@ -356,15 +365,14 @@
         # Basic validation on page ID exsistance and string type
         if (person_id and 'id' in values):
             if (type(person_id) is str and type(values['id'])):
+                with conn:
+                    with conn.cursor() as cur:
 
-                # Insert the newly created Page of Life from the person Book
-                cur = conn.cursor()
-                cur.execute("INSERT INTO pols (ID, BOOK, DATA) \
-                            VALUES (%(id)s, %(book)s, %(data)s)",
-                            {'id': page_id, 'book': person_id,
-                             'data': json.dumps(values)})
-
-                res = conn.commit()
+                        # Insert the newly created Page of Life from the 
person Book
+                        res = cur.execute("INSERT INTO pols (ID, BOOK, DATA) \
+                                    VALUES (%(id)s, %(book)s, %(data)s)",
+                                    {'id': page_id, 'book': person_id,
+                                     'data': json.dumps(values)})
 
         else:
             print("wrong format on person or page ID")
@@ -388,11 +396,10 @@
             jdata = json.dumps(values)
             # UPDATE the information from the page
             # associated to the federation ID book
-            cur = conn.cursor()
-            cur.execute("UPDATE pols SET data = data || %s where id = %s",
-                        (jdata, page_id))
-            conn.commit()
-
+            with conn:
+                with conn.cursor() as cur:
+                    cur.execute("UPDATE pols SET data = data || %s where id = 
%s",
+                                (jdata, page_id))
         else:
             abort(404, error="Page not found")
 
@@ -418,12 +425,13 @@
         """
         Retrieves the documents of a person
         """
-        cur = conn.cursor()
-        cur.execute('SELECT fedacct, pol, data, document from personal_docs \
-            where fedacct = %s', (person_id,))
-        documents = cur.fetchall()
+        with conn:
+            with conn.cursor() as cur:
+                cur.execute('SELECT fedacct, pol, data, document from 
personal_docs \
+                    where fedacct = %s', (person_id,))
+                documents = cur.fetchall()
 
-        return jsonify(documents)
+                return jsonify(documents)
 
 
 api.add_resource(PersonalDocs, '/personal_docs/<string:person_id>')
@@ -439,12 +447,14 @@
         """
         Retrieves the documents of a person
         """
-        cur = conn.cursor()
-        cur.execute('SELECT fedacct, pol, data, document from personal_docs \
-            where fedacct = %s', (person_id, pol_id))
-        documents = cur.fetchall()
+        with conn:
+            with conn.cursor() as cur:
 
-        return jsonify(documents)
+                cur.execute('SELECT fedacct, pol, data, document from 
personal_docs \
+                    where fedacct = %s', (person_id, pol_id))
+                documents = cur.fetchall()
+
+                return jsonify(documents)
 
 
 api.add_resource(PolDocs, '/personal_docs/<string:person_id>/<string:pol_id>')
@@ -460,11 +470,12 @@
         """
         Retrieves the Domiciliary Units
         """
-        cur = conn.cursor()
-        cur.execute('SELECT data from dus')
-        dus = cur.fetchall()
+        with conn:
+            with conn.cursor() as cur:
+                cur.execute('SELECT data from dus')
+                dus = cur.fetchall()
 
-        return jsonify(dus)
+                return jsonify(dus)
 
 
 api.add_resource(DomiciliaryUnits, '/domiciliary-units')
@@ -480,11 +491,12 @@
         """
         Retrieves the Institutions
         """
-        cur = conn.cursor()
-        cur.execute('SELECT data from institutions')
-        institutions = cur.fetchall()
+        with conn:
+            with conn.cursor() as cur:
+                cur.execute('SELECT data from institutions')
+                institutions = cur.fetchall()
 
-        return jsonify(institutions)
+                return jsonify(institutions)
 
 
 api.add_resource(Institutions, '/institutions')
@@ -501,7 +513,7 @@
     decorators = [auth.login_required]  # Use the decorator from httpauth
 
     def get(self):
-        return True 
+        return True
 
 
 api.add_resource(Login, '/login')
@@ -533,16 +545,16 @@
         jdata = json.dumps(values)
         # UPDATE the information from the person
         # associated to the federation ID
-        cur = conn.cursor()
-        cur.execute("UPDATE PEOPLE SET data = data || %s where id = %s",
-                    (jdata, person_id))
-        update_password = cur.rowcount
-        conn.commit()
-
-        if update_password > 0:
-            return redirect(url_for('index'))
-        else:
-            error = "Error updating the password"
+        with conn:
+            with conn.cursor() as cur:
+                cur.execute("UPDATE PEOPLE SET data = data || %s where id = 
%s",
+                            (jdata, person_id))
+                update_password = cur.rowcount
+
+                if update_password > 0:
+                    return redirect(url_for('index'))
+                else:
+                    error = "Error updating the password"
 
     return render_template('password.html', form=form,
                            fed_account=person_id, error=error)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/thalamus-0.9.13/thalamus.egg-info/PKG-INFO 
new/thalamus-0.9.14/thalamus.egg-info/PKG-INFO
--- old/thalamus-0.9.13/thalamus.egg-info/PKG-INFO      2021-03-03 
20:13:30.000000000 +0100
+++ new/thalamus-0.9.14/thalamus.egg-info/PKG-INFO      2021-04-08 
14:29:49.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: thalamus
-Version: 0.9.13
+Version: 0.9.14
 Summary: The GNU Health Federation Message and Authentication Server
 Home-page: http://health.gnu.org
 Author: GNU Solidario
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/thalamus-0.9.13/version new/thalamus-0.9.14/version
--- old/thalamus-0.9.13/version 2021-03-03 19:29:38.000000000 +0100
+++ new/thalamus-0.9.14/version 2021-04-08 14:28:02.000000000 +0200
@@ -1 +1 @@
-0.9.13
+0.9.14

Reply via email to