Hello community,

here is the log from the commit of package python-django-minio-storage for 
openSUSE:Factory checked in at 2020-01-09 22:51:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-django-minio-storage (Old)
 and      /work/SRC/openSUSE:Factory/.python-django-minio-storage.new.6675 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-django-minio-storage"

Thu Jan  9 22:51:38 2020 rev:3 rq:762084 version:0.3.5

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-django-minio-storage/python-django-minio-storage.changes
  2019-10-30 14:48:55.866253252 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-django-minio-storage.new.6675/python-django-minio-storage.changes
        2020-01-09 22:52:23.086763035 +0100
@@ -1,0 +2,7 @@
+Thu Jan  9 08:37:15 UTC 2020 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.3.5:
+  * Added settings MINIO_STORAGE_ASSUME_MEDIA_BUCKET_EXISTS and
+    MINIO_STORAGE_ASSUME_STATIC_BUCKET_EXISTS
+
+-------------------------------------------------------------------

Old:
----
  django-minio-storage-0.3.4.tar.gz

New:
----
  django-minio-storage-0.3.5.tar.gz

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

Other differences:
------------------
++++++ python-django-minio-storage.spec ++++++
--- /var/tmp/diff_new_pack.Ue5LNP/_old  2020-01-09 22:52:24.522763754 +0100
+++ /var/tmp/diff_new_pack.Ue5LNP/_new  2020-01-09 22:52:24.530763758 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-django-minio-storage
 #
-# Copyright (c) 2019 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
@@ -20,7 +20,7 @@
 %bcond_with test
 %define skip_python2 1
 Name:           python-django-minio-storage
-Version:        0.3.4
+Version:        0.3.5
 Release:        0
 Summary:        Django file storage using minio
 License:        MIT OR Apache-2.0

++++++ django-minio-storage-0.3.4.tar.gz -> django-minio-storage-0.3.5.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-minio-storage-0.3.4/CHANGELOG.md 
new/django-minio-storage-0.3.5/CHANGELOG.md
--- old/django-minio-storage-0.3.4/CHANGELOG.md 2019-10-28 07:30:17.000000000 
+0100
+++ new/django-minio-storage-0.3.5/CHANGELOG.md 2019-12-16 12:40:45.000000000 
+0100
@@ -1,14 +1,26 @@
 --- NEXT
 
+## 0.3.5
 
-### 0.3.4
+#### Add support for skipping bucket existst/policy check on start up
+https://github.com/py-pa/django-minio-storage/commit/7086f125ed74b157240bae10c589ce785ca93bbf
 
-- fixed resource leak where one extra file was opened per file and never 
closed: 
https://github.com/py-pa/django-minio-storage/commit/1532e34c7dcecbc2cf3ca0805d6fbf42b57c25ba
+Added settings MINIO_STORAGE_ASSUME_MEDIA_BUCKET_EXISTS and
+MINIO_STORAGE_ASSUME_STATIC_BUCKET_EXISTS
 
+## 0.3.4
 
-### 0.3.3
+#### • fixed resource leak where one extra file was opened per file and never 
closed
+https://github.com/py-pa/django-minio-storage/commit/1532e34c7dcecbc2cf3ca0805d6fbf42b57c25ba
+  
+There leaked file descriptors were only freed by the gargabe collector before
+this fix so if you have farily tight loop that does something to a lot of files
+while not generating a lot of garbage to trigger the gc.
 
-- reworked management commands and added tests.
+
+## 0.3.3
+
+#### • reworked management commands and added tests.
 
 ```
 $ python manage.py minio
@@ -32,35 +44,46 @@
     delete              remove an empty bucket
     ls                  list bucket objects or buckets
     policy              get or set bucket policy
-
 ```
 
 
+## 0.3.2
+
+#### • GET_ONLY is now the default bucket policy
+
 
-### 0.3.2
+## 0.3.1
 
-- GET_ONLY is now the default bucket policy
-- Added thedjango  mangement commands to the package
+### Changes
 
+#### • dropped python 2 support, 3.6+ is now required
 
-### 0.3.1
+#### • dropped support for django earlier than 1.11
 
-Changes:
+#### • policy settings default values changed
 
-- dropped python 2 support, 3.6+ is now required
-- dropped support for django earlier than 1.11
 - MINIO_STORAGE_AUTO_CREATE_..._POLICY now has more options (see Policy enum)
 - MINIO_STORAGE_AUTO_CREATE_..._POLICY now defaults to GET_ONLY
 
-New feautures:
+### New feautures
+
+#### • new django management commands
+
+- minio_bucket
+- minio_bucket_policy
+#### • implement Storage.listdir(): 
+
+https://github.com/py-pa/django-minio-storage/commit/9300d3d0b819672dbae788155258ff499788691c
+
+#### • add max_age to Storage.url()
+
+https://github.com/py-pa/django-minio-storage/commit/5084b954ad0ba0afad340a8d1010ccd2e491a30c
 
-- django management commands minio_bucket and minio_bucket_policy
-- implement Storage.listdir(): 
https://github.com/py-pa/django-minio-storage/commit/9300d3d0b819672dbae788155258ff499788691c
-- add max_age to Storage.url(): 
https://github.com/py-pa/django-minio-storage/commit/5084b954ad0ba0afad340a8d1010ccd2e491a30c
+### Fixes
 
-Fixes:
+#### • urlquote object name when using BASE_URL setting
 
-- urlquote object name when using BASE_URL setting: 
https://github.com/py-pa/django-minio-storage/commit/960961932bcef8c17fbb774f0ef5fa3022af15a2
+https://github.com/py-pa/django-minio-storage/commit/960961932bcef8c17fbb774f0ef5fa3022af15a2
 
 
 ## 0.2.2 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-minio-storage-0.3.4/PKG-INFO 
new/django-minio-storage-0.3.5/PKG-INFO
--- old/django-minio-storage-0.3.4/PKG-INFO     2019-10-28 07:32:30.000000000 
+0100
+++ new/django-minio-storage-0.3.5/PKG-INFO     2019-12-16 12:41:53.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: django-minio-storage
-Version: 0.3.4
+Version: 0.3.5
 Summary: Django file storage using the minio python client
 Home-page: https://github.com/py-pa/django-minio-storage
 Author: Tom Houlé
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/django-minio-storage-0.3.4/django_minio_storage.egg-info/PKG-INFO 
new/django-minio-storage-0.3.5/django_minio_storage.egg-info/PKG-INFO
--- old/django-minio-storage-0.3.4/django_minio_storage.egg-info/PKG-INFO       
2019-10-28 07:32:30.000000000 +0100
+++ new/django-minio-storage-0.3.5/django_minio_storage.egg-info/PKG-INFO       
2019-12-16 12:41:53.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: django-minio-storage
-Version: 0.3.4
+Version: 0.3.5
 Summary: Django file storage using the minio python client
 Home-page: https://github.com/py-pa/django-minio-storage
 Author: Tom Houlé
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-minio-storage-0.3.4/docs/usage.md 
new/django-minio-storage-0.3.5/docs/usage.md
--- old/django-minio-storage-0.3.4/docs/usage.md        2019-10-18 
08:33:15.000000000 +0200
+++ new/django-minio-storage-0.3.5/docs/usage.md        2019-12-16 
12:38:11.000000000 +0100
@@ -29,6 +29,10 @@
 - `MINIO_STORAGE_AUTO_CREATE_MEDIA_BUCKET`: whether to create the bucket if it
   does not already exist (default: `False`)
 
+- `MINIO_STORAGE_ASSUME_MEDIA_BUCKET_EXISTS`: whether to ignore media bucket 
+  creation and policy.  
+  (default: `False`)
+
 - `MINIO_STORAGE_AUTO_CREATE_MEDIA_POLICY`: sets the buckets public policy
   right after it's been created by `MINIO_STORAGE_AUTO_CREATE_MEDIA_BUCKET`.
   Valid values are: `GET_ONLY`, `READ_ONLY`, `WRITE_ONLY`, `READ_WRITE` and
@@ -40,6 +44,11 @@
 - `MINIO_STORAGE_AUTO_CREATE_STATIC_BUCKET`: whether to create the bucket if it
   does not already exist (default: `False`)
 
+
+- `MINIO_STORAGE_ASSUME_STATIC_BUCKET_EXISTS`: whether to ignore the static 
bucket 
+  creation and policy.  
+  (default: `False`)
+
 - `MINIO_STORAGE_AUTO_CREATE_STATIC_POLICY`: sets the buckets public policy
   right after it's been created by `MINIO_STORAGE_AUTO_CREATE_STATIC_BUCKET`.
   Valid values are: `GET_ONLY`, `READ_ONLY`, `WRITE_ONLY`, `READ_WRITE` and
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-minio-storage-0.3.4/minio_storage/storage.py 
new/django-minio-storage-0.3.5/minio_storage/storage.py
--- old/django-minio-storage-0.3.4/minio_storage/storage.py     2019-10-28 
05:38:53.000000000 +0100
+++ new/django-minio-storage-0.3.5/minio_storage/storage.py     2019-12-16 
12:38:11.000000000 +0100
@@ -46,6 +46,7 @@
         policy_type: T.Optional[Policy] = None,
         backup_format: T.Optional[str] = None,
         backup_bucket: T.Optional[str] = None,
+        assume_bucket_exists: bool = False,
         **kwargs,
     ):
         self.client = minio_client
@@ -64,6 +65,7 @@
             self.file_class = file_class
         self.auto_create_bucket = auto_create_bucket
         self.auto_create_policy = auto_create_policy
+        self.assume_bucket_exists = assume_bucket_exists
         self.policy_type = policy_type
 
         self.presign_urls = presign_urls
@@ -73,18 +75,21 @@
         super().__init__()
 
     def _init_check(self):
-        if self.auto_create_bucket and not 
self.client.bucket_exists(self.bucket_name):
-            self.client.make_bucket(self.bucket_name)
-            if self.auto_create_policy:
-                policy_type = self.policy_type
-                if policy_type is None:
-                    policy_type = Policy.get
-                self.client.set_bucket_policy(
-                    self.bucket_name, policy_type.bucket(self.bucket_name)
-                )
+        if not self.assume_bucket_exists:
+            if self.auto_create_bucket and not self.client.bucket_exists(
+                self.bucket_name
+            ):
+                self.client.make_bucket(self.bucket_name)
+                if self.auto_create_policy:
+                    policy_type = self.policy_type
+                    if policy_type is None:
+                        policy_type = Policy.get
+                    self.client.set_bucket_policy(
+                        self.bucket_name, policy_type.bucket(self.bucket_name)
+                    )
 
-        elif not self.client.bucket_exists(self.bucket_name):
-            raise OSError(f"The bucket {self.bucket_name} does not exist")
+            elif not self.client.bucket_exists(self.bucket_name):
+                raise OSError(f"The bucket {self.bucket_name} does not exist")
 
     def _sanitize_path(self, name):
         v = posixpath.normpath(name).replace("\\", "/")
@@ -337,6 +342,10 @@
         backup_format = get_setting("MINIO_STORAGE_MEDIA_BACKUP_FORMAT", False)
         backup_bucket = get_setting("MINIO_STORAGE_MEDIA_BACKUP_BUCKET", False)
 
+        assume_bucket_exists = get_setting(
+            "MINIO_STORAGE_ASSUME_MEDIA_BUCKET_EXISTS", False
+        )
+
         super().__init__(
             client,
             bucket_name,
@@ -347,6 +356,7 @@
             presign_urls=presign_urls,
             backup_format=backup_format,
             backup_bucket=backup_bucket,
+            assume_bucket_exists=assume_bucket_exists,
         )
 
 
@@ -370,6 +380,10 @@
 
         presign_urls = get_setting("MINIO_STORAGE_STATIC_USE_PRESIGNED", False)
 
+        assume_bucket_exists = get_setting(
+            "MINIO_STORAGE_ASSUME_STATIC_BUCKET_EXISTS", False
+        )
+
         super().__init__(
             client,
             bucket_name,
@@ -378,4 +392,5 @@
             policy_type=policy_type,
             base_url=base_url,
             presign_urls=presign_urls,
+            assume_bucket_exists=assume_bucket_exists,
         )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/django-minio-storage-0.3.4/tests/test_app/tests/bucket_tests.py 
new/django-minio-storage-0.3.5/tests/test_app/tests/bucket_tests.py
--- old/django-minio-storage-0.3.4/tests/test_app/tests/bucket_tests.py 
2019-10-28 07:17:47.000000000 +0100
+++ new/django-minio-storage-0.3.5/tests/test_app/tests/bucket_tests.py 
2019-12-16 12:38:11.000000000 +0100
@@ -33,6 +33,32 @@
         with self.assertRaises(ImproperlyConfigured):
             get_setting("INEXISTENT_SETTING")
 
+    @override_settings(
+        MINIO_STORAGE_MEDIA_BUCKET_NAME="inexistent",
+        MINIO_STORAGE_AUTO_CREATE_MEDIA_BUCKET=False,
+        MINIO_STORAGE_ASSUME_MEDIA_BUCKET_EXISTS=True,
+    )
+    def test_media_storage_ignore_bucket_check(self):
+        try:
+            MinioMediaStorage()
+        except OSError:
+            self.assertTrue(False)
+        else:
+            pass
+
+    @override_settings(
+        MINIO_STORAGE_STATIC_BUCKET_NAME="inexistent",
+        MINIO_STORAGE_AUTO_CREATE_STATIC_BUCKET=False,
+        MINIO_STORAGE_ASSUME_STATIC_BUCKET_EXISTS=True,
+    )
+    def test_static_storage_ignore_bucket_check(self):
+        try:
+            MinioStaticStorage()
+        except OSError:
+            self.assertTrue(False)
+        else:
+            pass
+
 
 class BucketPolicyTests(BaseTestMixin, TestCase):
     def setUp(self):


Reply via email to