Hello community,

here is the log from the commit of package python-pynetbox for openSUSE:Factory 
checked in at 2020-02-11 22:24:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pynetbox (Old)
 and      /work/SRC/openSUSE:Factory/.python-pynetbox.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pynetbox"

Tue Feb 11 22:24:40 2020 rev:10 rq:773367 version:4.2.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pynetbox/python-pynetbox.changes  
2020-01-12 23:26:27.230862056 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-pynetbox.new.26092/python-pynetbox.changes   
    2020-02-11 22:25:44.599578682 +0100
@@ -1,0 +2,7 @@
+Tue Feb 11 06:39:06 UTC 2020 - Martin Hauke <[email protected]>
+
+- Update to version 4.2.5
+  * save() is not idempotent when dealing with choice objects
+    from NetBox 2.7 
+
+-------------------------------------------------------------------

Old:
----
  pynetbox-4.2.4.tar.gz

New:
----
  pynetbox-4.2.5.tar.gz

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

Other differences:
------------------
++++++ python-pynetbox.spec ++++++
--- /var/tmp/diff_new_pack.89OYU0/_old  2020-02-11 22:25:45.051578929 +0100
+++ /var/tmp/diff_new_pack.89OYU0/_new  2020-02-11 22:25:45.055578932 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-pynetbox
 #
-# Copyright (c) 2020 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
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-pynetbox
-Version:        4.2.4
+Version:        4.2.5
 Release:        0
 Summary:        NetBox API client library
 License:        Apache-2.0

++++++ pynetbox-4.2.4.tar.gz -> pynetbox-4.2.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-4.2.4/PKG-INFO new/pynetbox-4.2.5/PKG-INFO
--- old/pynetbox-4.2.4/PKG-INFO 2020-01-12 07:26:21.000000000 +0100
+++ new/pynetbox-4.2.5/PKG-INFO 2020-02-11 04:34:29.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pynetbox
-Version: 4.2.4
+Version: 4.2.5
 Summary: NetBox API client library
 Home-page: https://github.com/digitalocean/pynetbox
 Author: Zach Moody
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-4.2.4/pynetbox/core/response.py 
new/pynetbox-4.2.5/pynetbox/core/response.py
--- old/pynetbox-4.2.4/pynetbox/core/response.py        2020-01-12 
07:26:06.000000000 +0100
+++ new/pynetbox-4.2.5/pynetbox/core/response.py        2020-02-11 
04:34:14.000000000 +0100
@@ -25,8 +25,7 @@
     """Returns simple representations for items passed to lookup.
 
     Used to return a "simple" representation of objects and collections
-    sent to it via lookup. If lookup is an IPNetwork object immediately
-    return the string representation. Otherwise, we look to see if
+    sent to it via lookup. Otherwise, we look to see if
     lookup is a "choices" field (dict with only 'id' and 'value')
     or a nested_return. Finally, we check if it's a Record, if
     so simply return a string. Order is important due to nested_return
@@ -41,6 +40,10 @@
             return lookup[i]
         else:
             if hasattr(lookup, i):
+                # check if this is a "choices" field record
+                # from a NetBox 2.7 server.
+                if sorted(dict(lookup)) == sorted(["id", "value", "label"]):
+                    return getattr(lookup, "value")
                 return getattr(lookup, i)
 
     if isinstance(lookup, Record):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-4.2.4/pynetbox.egg-info/PKG-INFO 
new/pynetbox-4.2.5/pynetbox.egg-info/PKG-INFO
--- old/pynetbox-4.2.4/pynetbox.egg-info/PKG-INFO       2020-01-12 
07:26:20.000000000 +0100
+++ new/pynetbox-4.2.5/pynetbox.egg-info/PKG-INFO       2020-02-11 
04:34:29.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pynetbox
-Version: 4.2.4
+Version: 4.2.5
 Summary: NetBox API client library
 Home-page: https://github.com/digitalocean/pynetbox
 Author: Zach Moody
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-4.2.4/tests/unit/test_response.py 
new/pynetbox-4.2.5/tests/unit/test_response.py
--- old/pynetbox-4.2.4/tests/unit/test_response.py      2020-01-12 
07:26:06.000000000 +0100
+++ new/pynetbox-4.2.5/tests/unit/test_response.py      2020-02-11 
04:34:14.000000000 +0100
@@ -112,6 +112,43 @@
         test = Record(test_values, None, None)
         self.assertEqual(dict(test), test_values)
 
+    def test_choices_idempotence_prev27(self):
+        test_values = {
+            "id": 123,
+            "choices_test": {
+                "value": 1,
+                "label": "test",
+            },
+        }
+        test = Record(test_values, None, None)
+        test.choices_test = 1
+        self.assertFalse(test._diff())
+
+    def test_choices_idempotence_v27(self):
+        test_values = {
+            "id": 123,
+            "choices_test": {
+                "value": "test",
+                "label": "test",
+                "id": 1,
+            },
+        }
+        test = Record(test_values, None, None)
+        test.choices_test = "test"
+        self.assertFalse(test._diff())
+
+    def test_choices_idempotence_v28(self):
+        test_values = {
+            "id": 123,
+            "choices_test": {
+                "value": "test",
+                "label": "test",
+            },
+        }
+        test = Record(test_values, None, None)
+        test.choices_test = "test"
+        self.assertFalse(test._diff())
+
     def test_hash(self):
         endpoint = Mock()
         endpoint.name = "test-endpoint"


Reply via email to