Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/py-django-binary-database-files Fix one more issue...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bcc64705944f
branches:  trunk
changeset: 437233:bcc64705944f
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Wed Aug 19 00:29:46 2020 +0000

description:
Fix one more issue with the path handling. Bump revision.

diffstat:

 www/py-django-binary-database-files/Makefile                                         |   3 +-
 www/py-django-binary-database-files/distinfo                                         |   4 +-
 www/py-django-binary-database-files/patches/patch-binary__database__files_storage.py |  30 ++++++++-
 3 files changed, 29 insertions(+), 8 deletions(-)

diffs (88 lines):

diff -r ca28c1ef6535 -r bcc64705944f www/py-django-binary-database-files/Makefile
--- a/www/py-django-binary-database-files/Makefile      Tue Aug 18 23:38:47 2020 +0000
+++ b/www/py-django-binary-database-files/Makefile      Wed Aug 19 00:29:46 2020 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.1 2020/08/18 14:27:16 joerg Exp $
+# $NetBSD: Makefile,v 1.2 2020/08/19 00:29:46 joerg Exp $
 
 DISTNAME=      django-binary-database-files-1.0.13
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
+PKGREVISION=   1
 CATEGORIES=    www python
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=kimetrica/}
 
diff -r ca28c1ef6535 -r bcc64705944f www/py-django-binary-database-files/distinfo
--- a/www/py-django-binary-database-files/distinfo      Tue Aug 18 23:38:47 2020 +0000
+++ b/www/py-django-binary-database-files/distinfo      Wed Aug 19 00:29:46 2020 +0000
@@ -1,8 +1,8 @@
-$NetBSD: distinfo,v 1.1 2020/08/18 14:27:16 joerg Exp $
+$NetBSD: distinfo,v 1.2 2020/08/19 00:29:46 joerg Exp $
 
 SHA1 (django-binary-database-files-1.0.13-cedd9f4608eb0da343cf15cfcaf5400a0754cc28.tar.gz) = 74c359eff5cd2039a9bc2badf7f4de581439c4ad
 RMD160 (django-binary-database-files-1.0.13-cedd9f4608eb0da343cf15cfcaf5400a0754cc28.tar.gz) = 880660c927751ba1cb0def0b97f3b10915a8f893
 SHA512 (django-binary-database-files-1.0.13-cedd9f4608eb0da343cf15cfcaf5400a0754cc28.tar.gz) = 
a275dc6763f98baf1170c0e160e3b9f2c515af7ee1bfb1229d0106c634c9a77af3b399d8cac781692fad56355f83cc260fd7a22f610600dcd1bbaebd3ce11598
 Size (django-binary-database-files-1.0.13-cedd9f4608eb0da343cf15cfcaf5400a0754cc28.tar.gz) = 31835 bytes
-SHA1 (patch-binary__database__files_storage.py) = a76139fecdee6af2a1fe12d886ad6e76d8ce599a
+SHA1 (patch-binary__database__files_storage.py) = 76eed8510370dd17bddc671b13251581db556181
 SHA1 (patch-binary__database__files_tests_tests.py) = d578a3cbdfb53f8547f689c9e761113abc795fc3
diff -r ca28c1ef6535 -r bcc64705944f www/py-django-binary-database-files/patches/patch-binary__database__files_storage.py
--- a/www/py-django-binary-database-files/patches/patch-binary__database__files_storage.py      Tue Aug 18 23:38:47 2020 +0000
+++ b/www/py-django-binary-database-files/patches/patch-binary__database__files_storage.py      Wed Aug 19 00:29:46 2020 +0000
@@ -1,7 +1,7 @@
-$NetBSD: patch-binary__database__files_storage.py,v 1.1 2020/08/18 14:27:16 joerg Exp $
+$NetBSD: patch-binary__database__files_storage.py,v 1.2 2020/08/19 00:29:46 joerg Exp $
 
 1df96f9f7caf621c4c0d94bc09b27584e1c5aa9d
-b52960824eb95a3e98c8d0a8c8ac08b38a6821ca
+73cd278717a4dd9020979d6d08eb56365a728357
 
 --- binary_database_files/storage.py.orig      2020-08-10 14:31:32.000000000 +0000
 +++ binary_database_files/storage.py
@@ -26,7 +26,16 @@
          return o
  
      def _save(self, name, content):
-@@ -110,15 +115,22 @@ class DatabaseStorage(FileSystemStorage)
+@@ -109,21 +109,31 @@ class DatabaseStorage(FileSystemStorage):
+         full_path = safe_join(self.location, name)
+         return full_path[len(root_path) + 1 :]
+ 
++    def _path(self, instance_name):
++        return safe_join(settings.MEDIA_ROOT, instance_name)
++
+     def path(self, name):
+         """
+         Return a local filesystem path where the file can be retrieved using
          Python's built-in open() function.
  
          File names are normalized to the MEDIA_ROOT.
@@ -35,7 +44,7 @@
 +        be raised.
          """
 -        return safe_join(settings.MEDIA_ROOT, self.get_instance_name(name))
-+        localpath = safe_join(settings.MEDIA_ROOT, self.get_instance_name(name))
++        localpath = self._path(self.get_instance_name(name))
 +        if not os.path.exists(localpath):
 +            raise NotImplementedError
 +        return localpath
@@ -46,8 +55,19 @@
          if models.File.objects.filter(name=name).exists():
              return True
 -        return super(DatabaseStorage, self).exists(name)
-+        localpath = safe_join(settings.MEDIA_ROOT, self.get_instance_name(name))
++        localpath = self._path(name)
 +        return os.path.exists(localpath)
  
      def delete(self, name):
          """Delete the file with filename `name` from the database and filesystem."""
+@@ -135,7 +145,9 @@ class DatabaseStorage(FileSystemStorage):
+                 os.remove(hash_fn)
+         except models.File.DoesNotExist:
+             pass
+-        return super(DatabaseStorage, self).delete(name)
++        localpath = self._path(name)
++        if os.path.exists(localpath):
++            return super(DatabaseStorage, self).delete(name)
+ 
+     def url(self, name):
+         """Return the web-accessible URL for the file with filename `name`.



Home | Main Index | Thread Index | Old Index