Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package 
python-djangorestframework-camel-case for openSUSE:Factory checked in at 
2023-02-10 14:36:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-djangorestframework-camel-case (Old)
 and      
/work/SRC/openSUSE:Factory/.python-djangorestframework-camel-case.new.1848 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-djangorestframework-camel-case"

Fri Feb 10 14:36:15 2023 rev:4 rq:1064236 version:1.4.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-djangorestframework-camel-case/python-djangorestframework-camel-case.changes
      2021-12-26 13:30:45.322969792 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-djangorestframework-camel-case.new.1848/python-djangorestframework-camel-case.changes
    2023-02-10 14:36:22.494298620 +0100
@@ -1,0 +2,6 @@
+Fri Feb 10 12:27:07 UTC 2023 - Dirk Müller <dmuel...@suse.com>
+
+- update to 1.4.0:
+  * added ignore_keys
+
+-------------------------------------------------------------------

Old:
----
  djangorestframework-camel-case-1.3.0.tar.gz

New:
----
  djangorestframework-camel-case-1.4.0.tar.gz

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

Other differences:
------------------
++++++ python-djangorestframework-camel-case.spec ++++++
--- /var/tmp/diff_new_pack.GWWIXg/_old  2023-02-10 14:36:22.906301081 +0100
+++ /var/tmp/diff_new_pack.GWWIXg/_new  2023-02-10 14:36:22.910301105 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-djangorestframework-camel-case
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-djangorestframework-camel-case
-Version:        1.3.0
+Version:        1.4.0
 Release:        0
 Summary:        Camel case JSON support for Django REST framework
 License:        BSD-3-Clause

++++++ djangorestframework-camel-case-1.3.0.tar.gz -> 
djangorestframework-camel-case-1.4.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/djangorestframework-camel-case-1.3.0/HISTORY.rst 
new/djangorestframework-camel-case-1.4.0/HISTORY.rst
--- old/djangorestframework-camel-case-1.3.0/HISTORY.rst        2021-12-14 
14:24:57.000000000 +0100
+++ new/djangorestframework-camel-case-1.4.0/HISTORY.rst        2023-02-09 
22:15:32.000000000 +0100
@@ -11,6 +11,8 @@
 - Merge pull request #92
 
 
+- added ignore_keys
+
 1.2.0 (2020-06-16)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/djangorestframework-camel-case-1.3.0/PKG-INFO 
new/djangorestframework-camel-case-1.4.0/PKG-INFO
--- old/djangorestframework-camel-case-1.3.0/PKG-INFO   2021-12-14 
14:27:47.702248000 +0100
+++ new/djangorestframework-camel-case-1.4.0/PKG-INFO   2023-02-09 
22:19:28.711766200 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: djangorestframework-camel-case
-Version: 1.3.0
+Version: 1.4.0
 Summary: Camel case JSON support for Django REST framework.
 Home-page: https://github.com/vbabiy/djangorestframework-camel-case
 Author: Vitaly Babiy
@@ -153,6 +153,46 @@
         
             {"myKey": {"do_not_change": 1}}
         
+        ===========
+        Ignore Keys
+        ===========
+        
+        You can also specify keys which should *not* be renamed.
+        The specified field(s) would still change (even recursively).
+        For example:
+        
+        .. code-block:: python
+        
+            data = {"unchanging_key": {"change_me": 1}}
+        
+        Would become:
+        
+        .. code-block:: python
+        
+            {"unchangingKey": {"changeMe": 1}}
+        
+        However, if you set in your settings:
+        
+        .. code-block:: python
+        
+            REST_FRAMEWORK = {
+                # ...
+                "JSON_UNDERSCOREIZE": {
+                    # ...
+                    "ignore_keys": ("unchanging_key",),
+                    # ...
+                },
+                # ...
+            }
+        
+        The `unchanging_key` field would not be renamed:
+        
+        .. code-block:: python
+        
+            {"unchanging_key": {"changeMe": 1}}
+        
+        ignore_keys and ignore_fields can be applied to the same key if 
required.
+        
         =============
         Running Tests
         =============
@@ -182,6 +222,8 @@
         - Merge pull request #92
         
         
+        - added ignore_keys
+        
         1.2.0 (2020-06-16)
         ------------------
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/djangorestframework-camel-case-1.3.0/README.rst 
new/djangorestframework-camel-case-1.4.0/README.rst
--- old/djangorestframework-camel-case-1.3.0/README.rst 2021-12-14 
13:53:48.000000000 +0100
+++ new/djangorestframework-camel-case-1.4.0/README.rst 2023-02-09 
22:15:32.000000000 +0100
@@ -145,6 +145,46 @@
 
     {"myKey": {"do_not_change": 1}}
 
+===========
+Ignore Keys
+===========
+
+You can also specify keys which should *not* be renamed.
+The specified field(s) would still change (even recursively).
+For example:
+
+.. code-block:: python
+
+    data = {"unchanging_key": {"change_me": 1}}
+
+Would become:
+
+.. code-block:: python
+
+    {"unchangingKey": {"changeMe": 1}}
+
+However, if you set in your settings:
+
+.. code-block:: python
+
+    REST_FRAMEWORK = {
+        # ...
+        "JSON_UNDERSCOREIZE": {
+            # ...
+            "ignore_keys": ("unchanging_key",),
+            # ...
+        },
+        # ...
+    }
+
+The `unchanging_key` field would not be renamed:
+
+.. code-block:: python
+
+    {"unchanging_key": {"changeMe": 1}}
+
+ignore_keys and ignore_fields can be applied to the same key if required.
+
 =============
 Running Tests
 =============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/djangorestframework-camel-case-1.3.0/djangorestframework_camel_case/__init__.py
 
new/djangorestframework-camel-case-1.4.0/djangorestframework_camel_case/__init__.py
--- 
old/djangorestframework-camel-case-1.3.0/djangorestframework_camel_case/__init__.py
 2021-12-14 14:25:06.000000000 +0100
+++ 
new/djangorestframework-camel-case-1.4.0/djangorestframework_camel_case/__init__.py
 2023-02-09 22:19:22.000000000 +0100
@@ -1,3 +1,3 @@
 __author__ = "Vitaly Babiy"
 __email__ = "vbabi...@gmail.com"
-__version__ = "1.3.0"
+__version__ = "1.4.0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/djangorestframework-camel-case-1.3.0/djangorestframework_camel_case/settings.py
 
new/djangorestframework-camel-case-1.4.0/djangorestframework_camel_case/settings.py
--- 
old/djangorestframework-camel-case-1.3.0/djangorestframework_camel_case/settings.py
 2021-12-14 13:53:48.000000000 +0100
+++ 
new/djangorestframework-camel-case-1.4.0/djangorestframework_camel_case/settings.py
 2023-02-09 22:15:32.000000000 +0100
@@ -8,7 +8,7 @@
 DEFAULTS = {
     "RENDERER_CLASS": "rest_framework.renderers.JSONRenderer",
     "PARSER_CLASS": "rest_framework.parsers.JSONParser",
-    "JSON_UNDERSCOREIZE": {"no_underscore_before_number": False, 
"ignore_fields": None},
+    "JSON_UNDERSCOREIZE": {"no_underscore_before_number": False, 
"ignore_fields": None, "ignore_keys": None},
 }
 
 # List of settings that may be in string import notation.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/djangorestframework-camel-case-1.3.0/djangorestframework_camel_case/util.py 
new/djangorestframework-camel-case-1.4.0/djangorestframework_camel_case/util.py
--- 
old/djangorestframework-camel-case-1.3.0/djangorestframework_camel_case/util.py 
    2021-12-14 14:00:30.000000000 +0100
+++ 
new/djangorestframework-camel-case-1.4.0/djangorestframework_camel_case/util.py 
    2023-02-09 22:15:32.000000000 +0100
@@ -23,6 +23,7 @@
 def camelize(data, **options):
     # Handle lazy translated strings.
     ignore_fields = options.get("ignore_fields") or ()
+    ignore_keys = options.get("ignore_keys") or ()
     if isinstance(data, Promise):
         data = force_str(data)
     if isinstance(data, dict):
@@ -37,10 +38,15 @@
                 new_key = re.sub(camelize_re, underscore_to_camel, key)
             else:
                 new_key = key
+
             if key not in ignore_fields and new_key not in ignore_fields:
-                new_dict[new_key] = camelize(value, **options)
+                result = camelize(value, **options)
+            else:
+                result = value
+            if key in ignore_keys or new_key in ignore_keys:
+                new_dict[key] = result
             else:
-                new_dict[new_key] = value
+                new_dict[new_key] = result
         return new_dict
     if is_iterable(data) and not isinstance(data, str):
         return [camelize(item, **options) for item in data]
@@ -51,7 +57,7 @@
     if options.get("no_underscore_before_number"):
         pattern = r"([a-z0-9]|[A-Z]?(?=[A-Z](?=[a-z])))([A-Z])"
     else:
-        pattern = 
r"([a-z0-9]|[A-Z]?(?=[A-Z0-9](?=[a-z0-9]|$)))([A-Z]|(?<=[a-z])[0-9](?=[0-9A-Z]|$)|(?<=[A-Z])[0-9](?=[0-9]|$))"
+        pattern = 
r"([a-z0-9]|[A-Z]?(?=[A-Z0-9](?=[a-z0-9]|(?<![A-Z])$)))([A-Z]|(?<=[a-z])[0-9](?=[0-9A-Z]|$)|(?<=[A-Z])[0-9](?=[0-9]|$))"
     return re.compile(pattern)
 
 
@@ -69,6 +75,7 @@
 
 def underscoreize(data, **options):
     ignore_fields = options.get("ignore_fields") or ()
+    ignore_keys = options.get("ignore_keys") or ()
     if isinstance(data, dict):
         new_dict = {}
         if type(data) == MultiValueDict:
@@ -83,9 +90,13 @@
                 new_key = key
 
             if key not in ignore_fields and new_key not in ignore_fields:
-                new_dict[new_key] = underscoreize(value, **options)
+                result = underscoreize(value, **options)
+            else:
+                result = value
+            if key in ignore_keys or new_key in ignore_keys:
+                new_dict[key] = result
             else:
-                new_dict[new_key] = value
+                new_dict[new_key] = result
 
         if isinstance(data, QueryDict):
             new_query = QueryDict(mutable=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/djangorestframework-camel-case-1.3.0/djangorestframework_camel_case.egg-info/PKG-INFO
 
new/djangorestframework-camel-case-1.4.0/djangorestframework_camel_case.egg-info/PKG-INFO
--- 
old/djangorestframework-camel-case-1.3.0/djangorestframework_camel_case.egg-info/PKG-INFO
   2021-12-14 14:27:47.000000000 +0100
+++ 
new/djangorestframework-camel-case-1.4.0/djangorestframework_camel_case.egg-info/PKG-INFO
   2023-02-09 22:19:28.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: djangorestframework-camel-case
-Version: 1.3.0
+Version: 1.4.0
 Summary: Camel case JSON support for Django REST framework.
 Home-page: https://github.com/vbabiy/djangorestframework-camel-case
 Author: Vitaly Babiy
@@ -153,6 +153,46 @@
         
             {"myKey": {"do_not_change": 1}}
         
+        ===========
+        Ignore Keys
+        ===========
+        
+        You can also specify keys which should *not* be renamed.
+        The specified field(s) would still change (even recursively).
+        For example:
+        
+        .. code-block:: python
+        
+            data = {"unchanging_key": {"change_me": 1}}
+        
+        Would become:
+        
+        .. code-block:: python
+        
+            {"unchangingKey": {"changeMe": 1}}
+        
+        However, if you set in your settings:
+        
+        .. code-block:: python
+        
+            REST_FRAMEWORK = {
+                # ...
+                "JSON_UNDERSCOREIZE": {
+                    # ...
+                    "ignore_keys": ("unchanging_key",),
+                    # ...
+                },
+                # ...
+            }
+        
+        The `unchanging_key` field would not be renamed:
+        
+        .. code-block:: python
+        
+            {"unchanging_key": {"changeMe": 1}}
+        
+        ignore_keys and ignore_fields can be applied to the same key if 
required.
+        
         =============
         Running Tests
         =============
@@ -182,6 +222,8 @@
         - Merge pull request #92
         
         
+        - added ignore_keys
+        
         1.2.0 (2020-06-16)
         ------------------
         

Reply via email to