Hello community,

here is the log from the commit of package python-whitenoise for 
openSUSE:Factory checked in at 2020-11-29 12:26:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-whitenoise (Old)
 and      /work/SRC/openSUSE:Factory/.python-whitenoise.new.5913 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-whitenoise"

Sun Nov 29 12:26:54 2020 rev:5 rq:850756 version:5.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-whitenoise/python-whitenoise.changes      
2020-02-07 15:55:36.051549332 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-whitenoise.new.5913/python-whitenoise.changes
    2020-11-29 12:26:56.257911718 +0100
@@ -1,0 +2,7 @@
+Tue Jul 21 12:51:45 UTC 2020 - Marketa Calabkova <mcalabk...@suse.com>
+
+- update to 5.1.0
+  * Add a manifest_strict setting to prevent Django throwing errors 
+    when missing files are referenced
+
+-------------------------------------------------------------------

Old:
----
  whitenoise-5.0.1.tar.gz

New:
----
  whitenoise-5.1.0.tar.gz

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

Other differences:
------------------
++++++ python-whitenoise.spec ++++++
--- /var/tmp/diff_new_pack.XCEdFs/_old  2020-11-29 12:26:56.893912361 +0100
+++ /var/tmp/diff_new_pack.XCEdFs/_new  2020-11-29 12:26:56.893912361 +0100
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-whitenoise
-Version:        5.0.1
+Version:        5.1.0
 Release:        0
 Summary:        Static file serving for WSGI applications
 License:        MIT
@@ -52,6 +52,7 @@
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %check
+PYTHONPATH=$PWD
 %pytest
 
 %files %{python_files}

++++++ whitenoise-5.0.1.tar.gz -> whitenoise-5.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whitenoise-5.0.1/docs/changelog.rst 
new/whitenoise-5.1.0/docs/changelog.rst
--- old/whitenoise-5.0.1/docs/changelog.rst     2019-12-12 16:20:26.000000000 
+0100
+++ new/whitenoise-5.1.0/docs/changelog.rst     2020-05-20 11:00:34.000000000 
+0200
@@ -6,6 +6,14 @@
    <br />
 
 
+v5.1.0
+------
+
+ * Add a :any:`manifest_strict <WHITENOISE_MANIFEST_STRICT>` setting to prevent
+   Django throwing errors when missing files are referenced (thanks
+   `@MegacoderKim <https://github.com/MegacoderKim>`_).
+
+
 v5.0.1
 ------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whitenoise-5.0.1/docs/django.rst 
new/whitenoise-5.1.0/docs/django.rst
--- old/whitenoise-5.0.1/docs/django.rst        2019-12-12 16:20:26.000000000 
+0100
+++ new/whitenoise-5.1.0/docs/django.rst        2020-05-20 11:00:34.000000000 
+0200
@@ -61,7 +61,8 @@
      # ...
    ]
 
-That's it -- WhiteNoise will now serve your static files. However, to get the
+That's it -- WhiteNoise will now serve your static files (you can confirm it's
+working using the :ref:`steps below <check-its-working>`). However, to get the
 best performance you should proceed to step 3 below and enable compression and
 caching.
 
@@ -463,6 +464,26 @@
     Note, this setting is only effective if the WhiteNoise storage backend is
     being used.
 
+.. attribute:: WHITENOISE_MANIFEST_STRICT
+
+    :default: ``True``
+
+    Set to ``False`` to prevent Django throwing an error if you reference a
+    static file which doesn't exist.
+
+    This works by setting the manifest_strict_ option on the underlying Django
+    storage instance, as described in the Django documentation:
+
+      If a file isn't found in the ``staticfiles.json`` manifest at runtime, a
+      ``ValueError`` is raised. This behavior can be disabled by subclassing
+      ``ManifestStaticFilesStorage`` and setting the ``manifest_strict`` 
attribute to
+      ``False`` -- nonexistent paths will remain unchanged.
+
+    Note, this setting is only effective if the WhiteNoise storage backend is
+    being used.
+
+.. _manifest_strict: 
https://docs.djangoproject.com/en/stable/ref/contrib/staticfiles/#django.contrib.staticfiles.storage.ManifestStaticFilesStorage.manifest_strict
+
 
 Additional Notes
 ----------------
@@ -503,6 +524,34 @@
 --------------------------------------------------------------------------
 
 
+.. _check-its-working:
+
+How do I know it's working?
++++++++++++++++++++++++++++
+
+You can confirm that WhiteNoise is installed and configured correctly by
+running you application locally with ``DEBUG`` disabled and checking that your
+static files still load.
+
+First you need to run ``collectstatic`` to get your files in the right place:
+
+.. code-block:: bash
+
+   python manage.py collectstatic
+
+Then make sure ``DEBUG`` is set to ``False`` in your ``settings.py`` and start
+the server:
+
+.. code-block:: bash
+
+   python manage.py runserver
+
+You should find that your static files are served, just as they would be in
+production.
+
+--------------------------------------------------------------------------
+
+
 .. _storage-troubleshoot:
 
 Troubleshooting the WhiteNoise Storage backend
@@ -606,10 +655,8 @@
 
 which will show you all the paths which Django searches for the file "foo".
 
-If, for some reason, you want Django to silently ignore such errors you can 
subclass
-the storage backend and set the manifest_strict_ attribute to ``False``.
-
-.. _manifest_strict: 
https://docs.djangoproject.com/en/stable/ref/contrib/staticfiles/#django.contrib.staticfiles.storage.ManifestStaticFilesStorage.manifest_strict
+If, for some reason, you want Django to silently ignore such errors you can set
+``WHITENOISE_MANIFEST_STRICT`` to ``False``.
 
 
 Using WhiteNoise with Webpack / Browserify / $LATEST_JS_THING
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whitenoise-5.0.1/docs/index.rst 
new/whitenoise-5.1.0/docs/index.rst
--- old/whitenoise-5.0.1/docs/index.rst 2019-12-12 16:20:26.000000000 +0100
+++ new/whitenoise-5.1.0/docs/index.rst 2020-05-20 11:00:34.000000000 +0200
@@ -57,7 +57,7 @@
 QuickStart for Django apps
 --------------------------
 
-Edit your ``settings.py`` file and add WhiteNoise to the ``MIDDLEWARE_CLASSES``
+Edit your ``settings.py`` file and add WhiteNoise to the ``MIDDLEWARE``
 list, above all other middleware apart from Django's `SecurityMiddleware
 
<https://docs.djangoproject.com/en/stable/ref/middleware/#module-django.middleware.security>`_:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whitenoise-5.0.1/tests/test_storage.py 
new/whitenoise-5.1.0/tests/test_storage.py
--- old/whitenoise-5.0.1/tests/test_storage.py  2019-12-12 16:20:26.000000000 
+0100
+++ new/whitenoise-5.1.0/tests/test_storage.py  2020-05-20 11:00:34.000000000 
+0200
@@ -12,7 +12,11 @@
 from django.utils.functional import empty
 import pytest
 
-from whitenoise.storage import HelpfulExceptionMixin, MissingFileError
+from whitenoise.storage import (
+    HelpfulExceptionMixin,
+    MissingFileError,
+    CompressedManifestStaticFilesStorage,
+)
 
 from .utils import Files
 
@@ -85,3 +89,12 @@
 def test_manifest_file_is_left_in_place(_compressed_manifest_storage):
     manifest_file = os.path.join(settings.STATIC_ROOT, "staticfiles.json")
     assert os.path.exists(manifest_file)
+
+
+def test_manifest_strict_attribute_is_set():
+    with override_settings(WHITENOISE_MANIFEST_STRICT=True):
+        storage = CompressedManifestStaticFilesStorage()
+        assert storage.manifest_strict is True
+    with override_settings(WHITENOISE_MANIFEST_STRICT=False):
+        storage = CompressedManifestStaticFilesStorage()
+        assert storage.manifest_strict is False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whitenoise-5.0.1/whitenoise/__init__.py 
new/whitenoise-5.1.0/whitenoise/__init__.py
--- old/whitenoise-5.0.1/whitenoise/__init__.py 2019-12-12 16:20:26.000000000 
+0100
+++ new/whitenoise-5.1.0/whitenoise/__init__.py 2020-05-20 11:00:34.000000000 
+0200
@@ -1,5 +1,5 @@
 from .base import WhiteNoise
 
-__version__ = "5.0.1"
+__version__ = "5.1.0"
 
 __all__ = ["WhiteNoise"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whitenoise-5.0.1/whitenoise/base.py 
new/whitenoise-5.1.0/whitenoise/base.py
--- old/whitenoise-5.0.1/whitenoise/base.py     2019-12-12 16:20:26.000000000 
+0100
+++ new/whitenoise-5.1.0/whitenoise/base.py     2020-05-20 11:00:34.000000000 
+0200
@@ -6,7 +6,6 @@
 from wsgiref.util import FileWrapper
 
 from .media_types import MediaTypes
-from .scantree import scantree
 from .responders import StaticFile, MissingFileError, IsDirectoryError, 
Redirect
 from .string_utils import (
     decode_if_byte_string,
@@ -261,3 +260,14 @@
         else:
             headers = {}
         return Redirect(relative_url, headers=headers)
+
+
+def scantree(root):
+    """
+    Recurse the given directory yielding (pathname, os.stat(pathname)) pairs
+    """
+    for entry in os.scandir(root):
+        if entry.is_dir():
+            yield from scantree(entry.path)
+        else:
+            yield entry.path, entry.stat()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whitenoise-5.0.1/whitenoise/httpstatus_backport.py 
new/whitenoise-5.1.0/whitenoise/httpstatus_backport.py
--- old/whitenoise-5.0.1/whitenoise/httpstatus_backport.py      2019-12-12 
16:20:26.000000000 +0100
+++ new/whitenoise-5.1.0/whitenoise/httpstatus_backport.py      1970-01-01 
01:00:00.000000000 +0100
@@ -1,24 +0,0 @@
-"""
-Very partial backport of the `http.HTTPStatus` enum from Python 3.5
-
-This implements just enough of the interface for our purposes, it does not
-attempt to be a full implementation.
-"""
-
-
-class HTTPStatus(int):
-
-    phrase = None
-
-    def __new__(cls, code, phrase):
-        instance = int.__new__(cls, code)
-        instance.phrase = phrase
-        return instance
-
-
-HTTPStatus.OK = HTTPStatus(200, "OK")
-HTTPStatus.PARTIAL_CONTENT = HTTPStatus(206, "Partial Content")
-HTTPStatus.FOUND = HTTPStatus(302, "Found")
-HTTPStatus.NOT_MODIFIED = HTTPStatus(304, "Not Modified")
-HTTPStatus.METHOD_NOT_ALLOWED = HTTPStatus(405, "Method Not Allowed")
-HTTPStatus.REQUESTED_RANGE_NOT_SATISFIABLE = HTTPStatus(416, "Range Not 
Satisfiable")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whitenoise-5.0.1/whitenoise/responders.py 
new/whitenoise-5.1.0/whitenoise/responders.py
--- old/whitenoise-5.0.1/whitenoise/responders.py       2019-12-12 
16:20:26.000000000 +0100
+++ new/whitenoise-5.1.0/whitenoise/responders.py       2020-05-20 
11:00:34.000000000 +0200
@@ -2,10 +2,7 @@
 from email.utils import formatdate, parsedate
 import errno
 
-try:
-    from http import HTTPStatus
-except ImportError:
-    from .httpstatus_backport import HTTPStatus
+from http import HTTPStatus
 import os
 import re
 import stat
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whitenoise-5.0.1/whitenoise/scantree.py 
new/whitenoise-5.1.0/whitenoise/scantree.py
--- old/whitenoise-5.0.1/whitenoise/scantree.py 2019-12-12 16:20:26.000000000 
+0100
+++ new/whitenoise-5.1.0/whitenoise/scantree.py 1970-01-01 01:00:00.000000000 
+0100
@@ -1,41 +0,0 @@
-"""
-Provides a `scantree` function which recurses a given directory, yielding
-(pathname, os.stat(pathname)) pairs.
-
-Attempts to use the more efficient `scandir` function if this is available,
-falling back to `os.listdir` otherwise.
-"""
-import os
-import stat
-
-try:
-    from os import scandir
-except ImportError:
-    try:
-        from scandir import scandir
-    except ImportError:
-        scandir = None
-
-
-if scandir:
-
-    def scantree(root):
-        for entry in scandir(root):
-            if entry.is_dir():
-                for item in scantree(entry.path):
-                    yield item
-            else:
-                yield entry.path, entry.stat()
-
-
-else:
-
-    def scantree(root):
-        for filename in os.listdir(root):
-            path = os.path.join(root, filename)
-            stat_result = os.stat(path)
-            if stat.S_ISDIR(stat_result.st_mode):
-                for item in scantree(path):
-                    yield item
-            else:
-                yield path, stat_result
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whitenoise-5.0.1/whitenoise/storage.py 
new/whitenoise-5.1.0/whitenoise/storage.py
--- old/whitenoise-5.0.1/whitenoise/storage.py  2019-12-12 16:20:26.000000000 
+0100
+++ new/whitenoise-5.1.0/whitenoise/storage.py  2020-05-20 11:00:34.000000000 
+0200
@@ -122,6 +122,12 @@
 
     _new_files = None
 
+    def __init__(self, *args, **kwargs):
+        manifest_strict = getattr(settings, "WHITENOISE_MANIFEST_STRICT", None)
+        if manifest_strict is not None:
+            self.manifest_strict = manifest_strict
+        super().__init__(*args, **kwargs)
+
     def post_process(self, *args, **kwargs):
         files = super(CompressedManifestStaticFilesStorage, self).post_process(
             *args, **kwargs
_______________________________________________
openSUSE Commits mailing list -- commit@lists.opensuse.org
To unsubscribe, email commit-le...@lists.opensuse.org
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/commit@lists.opensuse.org

Reply via email to