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-file Add py-django-binar...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c89f116cffc0
branches:  trunk
changeset: 436519:c89f116cffc0
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Tue Aug 04 01:14:36 2020 +0000

description:
Add py-django-binary-database-1.0.10:

This is a storage system for Django that stores uploaded files in binary
fields in the database. Files can be served from the database (usually a
bad idea), the file system, or a CDN.

diffstat:

 www/py-django-binary-database-file/DESCR                                                                                 |   3 +
 www/py-django-binary-database-file/Makefile                                                                              |  30 ++++
 www/py-django-binary-database-file/PLIST                                                                                 |  69 ++++++++++
 www/py-django-binary-database-file/distinfo                                                                              |  10 +
 www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__cleanup.py |  55 +++++++
 www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__dump.py    |  18 ++
 www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__load.py    |  56 ++++++++
 www/py-django-binary-database-file/patches/patch-binary__database__files_views.py                                        |  25 +++
 8 files changed, 266 insertions(+), 0 deletions(-)

diffs (299 lines):

diff -r a65f6acd7cf3 -r c89f116cffc0 www/py-django-binary-database-file/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/py-django-binary-database-file/DESCR  Tue Aug 04 01:14:36 2020 +0000
@@ -0,0 +1,3 @@
+This is a storage system for Django that stores uploaded files in binary
+fields in the database. Files can be served from the database (usually a
+bad idea), the file system, or a CDN.
\ No newline at end of file
diff -r a65f6acd7cf3 -r c89f116cffc0 www/py-django-binary-database-file/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/py-django-binary-database-file/Makefile       Tue Aug 04 01:14:36 2020 +0000
@@ -0,0 +1,30 @@
+# $NetBSD: Makefile,v 1.1 2020/08/04 01:15:13 joerg Exp $
+
+DISTNAME=      django-binary-database-1.0.10
+PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
+CATEGORIES=    www python
+MASTER_SITES=  ${MASTER_SITE_GITHUB:=kimetrica/}
+
+MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=      https://github.com/kimetrica/django-binary-database-files
+COMMENT=       In-database file storage backend for Django
+LICENSE=       modified-bsd
+
+GITHUB_PROJECT=        django-binary-database-files
+GITHUB_TAG=    34afac4439f62e62aefd77cc3438fb9888aa8aa5
+
+DEPENDS+=      ${PYPKGPREFIX}-django>=1.11:../../www/py-django
+
+USE_LANGUAGES=         # none
+TEST_DEPENDS+= ${PYPKGPREFIX}-coverage-[0-9]*:../../devel/py-coverage
+
+USE_LANGUAGES=         # none
+
+do-test:
+       cd ${WRKSRC} && ${PREFIX}/bin/django-admin-${PYVERSSUFFIX} test \
+            --pythonpath=. \
+            --settings=binary_database_files.tests.settings \
+            binary_database_files.tests.tests.DatabaseFilesTestCase
+
+.include "../../lang/python/egg.mk"
+.include "../../mk/bsd.pkg.mk"
diff -r a65f6acd7cf3 -r c89f116cffc0 www/py-django-binary-database-file/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/py-django-binary-database-file/PLIST  Tue Aug 04 01:14:36 2020 +0000
@@ -0,0 +1,69 @@
+@comment $NetBSD: PLIST,v 1.1 2020/08/04 01:15:13 joerg Exp $
+${PYSITELIB}/binary_database_files/__init__.py
+${PYSITELIB}/binary_database_files/__init__.pyc
+${PYSITELIB}/binary_database_files/__init__.pyo
+${PYSITELIB}/binary_database_files/apps.py
+${PYSITELIB}/binary_database_files/apps.pyc
+${PYSITELIB}/binary_database_files/apps.pyo
+${PYSITELIB}/binary_database_files/management/__init__.py
+${PYSITELIB}/binary_database_files/management/__init__.pyc
+${PYSITELIB}/binary_database_files/management/__init__.pyo
+${PYSITELIB}/binary_database_files/management/commands/__init__.py
+${PYSITELIB}/binary_database_files/management/commands/__init__.pyc
+${PYSITELIB}/binary_database_files/management/commands/__init__.pyo
+${PYSITELIB}/binary_database_files/management/commands/database_files_cleanup.py
+${PYSITELIB}/binary_database_files/management/commands/database_files_cleanup.pyc
+${PYSITELIB}/binary_database_files/management/commands/database_files_cleanup.pyo
+${PYSITELIB}/binary_database_files/management/commands/database_files_dump.py
+${PYSITELIB}/binary_database_files/management/commands/database_files_dump.pyc
+${PYSITELIB}/binary_database_files/management/commands/database_files_dump.pyo
+${PYSITELIB}/binary_database_files/management/commands/database_files_load.py
+${PYSITELIB}/binary_database_files/management/commands/database_files_load.pyc
+${PYSITELIB}/binary_database_files/management/commands/database_files_load.pyo
+${PYSITELIB}/binary_database_files/management/commands/database_files_rehash.py
+${PYSITELIB}/binary_database_files/management/commands/database_files_rehash.pyc
+${PYSITELIB}/binary_database_files/management/commands/database_files_rehash.pyo
+${PYSITELIB}/binary_database_files/manager.py
+${PYSITELIB}/binary_database_files/manager.pyc
+${PYSITELIB}/binary_database_files/manager.pyo
+${PYSITELIB}/binary_database_files/migrations/0001_initial.py
+${PYSITELIB}/binary_database_files/migrations/0001_initial.pyc
+${PYSITELIB}/binary_database_files/migrations/0001_initial.pyo
+${PYSITELIB}/binary_database_files/migrations/__init__.py
+${PYSITELIB}/binary_database_files/migrations/__init__.pyc
+${PYSITELIB}/binary_database_files/migrations/__init__.pyo
+${PYSITELIB}/binary_database_files/models.py
+${PYSITELIB}/binary_database_files/models.pyc
+${PYSITELIB}/binary_database_files/models.pyo
+${PYSITELIB}/binary_database_files/settings.py
+${PYSITELIB}/binary_database_files/settings.pyc
+${PYSITELIB}/binary_database_files/settings.pyo
+${PYSITELIB}/binary_database_files/storage.py
+${PYSITELIB}/binary_database_files/storage.pyc
+${PYSITELIB}/binary_database_files/storage.pyo
+${PYSITELIB}/binary_database_files/tests/__init__.py
+${PYSITELIB}/binary_database_files/tests/__init__.pyc
+${PYSITELIB}/binary_database_files/tests/__init__.pyo
+${PYSITELIB}/binary_database_files/tests/models.py
+${PYSITELIB}/binary_database_files/tests/models.pyc
+${PYSITELIB}/binary_database_files/tests/models.pyo
+${PYSITELIB}/binary_database_files/tests/settings.py
+${PYSITELIB}/binary_database_files/tests/settings.pyc
+${PYSITELIB}/binary_database_files/tests/settings.pyo
+${PYSITELIB}/binary_database_files/tests/tests.py
+${PYSITELIB}/binary_database_files/tests/tests.pyc
+${PYSITELIB}/binary_database_files/tests/tests.pyo
+${PYSITELIB}/binary_database_files/urls.py
+${PYSITELIB}/binary_database_files/urls.pyc
+${PYSITELIB}/binary_database_files/urls.pyo
+${PYSITELIB}/binary_database_files/utils.py
+${PYSITELIB}/binary_database_files/utils.pyc
+${PYSITELIB}/binary_database_files/utils.pyo
+${PYSITELIB}/binary_database_files/views.py
+${PYSITELIB}/binary_database_files/views.pyc
+${PYSITELIB}/binary_database_files/views.pyo
+${PYSITELIB}/django_binary_database_files-1.0.12-py${PYVERSSUFFIX}.egg-info/PKG-INFO
+${PYSITELIB}/django_binary_database_files-1.0.12-py${PYVERSSUFFIX}.egg-info/SOURCES.txt
+${PYSITELIB}/django_binary_database_files-1.0.12-py${PYVERSSUFFIX}.egg-info/dependency_links.txt
+${PYSITELIB}/django_binary_database_files-1.0.12-py${PYVERSSUFFIX}.egg-info/requires.txt
+${PYSITELIB}/django_binary_database_files-1.0.12-py${PYVERSSUFFIX}.egg-info/top_level.txt
diff -r a65f6acd7cf3 -r c89f116cffc0 www/py-django-binary-database-file/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/py-django-binary-database-file/distinfo       Tue Aug 04 01:14:36 2020 +0000
@@ -0,0 +1,10 @@
+$NetBSD: distinfo,v 1.1 2020/08/04 01:15:13 joerg Exp $
+
+SHA1 (django-binary-database-1.0.10-34afac4439f62e62aefd77cc3438fb9888aa8aa5.tar.gz) = 72519334e4ccded8a7c03fe281ecff0b858a2580
+RMD160 (django-binary-database-1.0.10-34afac4439f62e62aefd77cc3438fb9888aa8aa5.tar.gz) = a559f719ee61efa5fafdc6f2d5f85985dedc297d
+SHA512 (django-binary-database-1.0.10-34afac4439f62e62aefd77cc3438fb9888aa8aa5.tar.gz) = 
11a87b0e1d17b59a2181203129e56a0dec49c1a8f35b783c7c24c061a5cc6107c80e1715ee6821bb1a3e7264bae312d74ee75066758b7e7412b061006fe1f9b6
+Size (django-binary-database-1.0.10-34afac4439f62e62aefd77cc3438fb9888aa8aa5.tar.gz) = 32005 bytes
+SHA1 (patch-binary__database__files_management_commands_database__files__cleanup.py) = f888dc215cdc1228a5e8119ae181544c73903af0
+SHA1 (patch-binary__database__files_management_commands_database__files__dump.py) = 7e4aaf056773135155290157c9a0263c54a72ac4
+SHA1 (patch-binary__database__files_management_commands_database__files__load.py) = 2cf7ed2e606e9c7705c4d5dc14cdcd9f15d3f8af
+SHA1 (patch-binary__database__files_views.py) = dd0d630527fdf88ffc4a6088fdd8dac3f3401a00
diff -r a65f6acd7cf3 -r c89f116cffc0 www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__cleanup.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__cleanup.py  Tue Aug 04 01:14:36 2020 +0000
@@ -0,0 +1,55 @@
+$NetBSD: patch-binary__database__files_management_commands_database__files__cleanup.py,v 1.1 2020/08/04 01:14:36 joerg Exp $
+
+PR #26
+
+--- binary_database_files/management/commands/database_files_cleanup.py.orig   2020-05-20 16:29:28.000000000 +0000
++++ binary_database_files/management/commands/database_files_cleanup.py
+@@ -4,7 +4,7 @@ from django.conf import settings
+ from django.core.files.storage import default_storage
+ from django.core.management.base import BaseCommand
+ from django.db.models import FileField, ImageField
+-from django.apps.apps import get_models
++from django.apps import apps
+ 
+ from binary_database_files.models import File
+ 
+@@ -15,8 +15,9 @@ class Command(BaseCommand):
+         "Deletes all files in the database that are not referenced by "
+         "any model fields."
+     )
+-    option_list = BaseCommand.option_list + (
+-        make_option(
++
++    def add_arguments(self, parser):
++        parser.add_argument(
+             "--dryrun",
+             action="store_true",
+             dest="dryrun",
+@@ -24,14 +25,13 @@ class Command(BaseCommand):
+             help=(
+                 "If given, only displays the names of orphaned files "
+                 "and does not delete them."
+-            ),
+-        ),
+-        make_option(
++            )
++        )
++        parser.add_argument(
+             "--filenames",
+             default="",
+             help="If given, only files with these names will be checked",
+-        ),
+-    )
++        )
+ 
+     def handle(self, *args, **options):
+         tmp_debug = settings.DEBUG
+@@ -40,7 +40,7 @@ class Command(BaseCommand):
+         dryrun = options["dryrun"]
+         filenames = {_.strip() for _ in options["filenames"].split(",") if _.strip()}
+         try:
+-            for model in get_models():
++            for model in apps.get_models():
+                 print("Checking model %s..." % (model,))
+                 for field in model._meta.fields:
+                     if not isinstance(field, (FileField, ImageField)):
diff -r a65f6acd7cf3 -r c89f116cffc0 www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__dump.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__dump.py     Tue Aug 04 01:14:36 2020 +0000
@@ -0,0 +1,18 @@
+$NetBSD: patch-binary__database__files_management_commands_database__files__dump.py,v 1.1 2020/08/04 01:14:36 joerg Exp $
+
+PR #26
+
+--- binary_database_files/management/commands/database_files_dump.py.orig      2020-08-03 11:40:23.568616679 +0000
++++ binary_database_files/management/commands/database_files_dump.py
+@@ -4,11 +4,6 @@ from binary_database_files.models import
+ 
+ 
+ class Command(BaseCommand):
+-    option_list = BaseCommand.option_list + (
+-        #        make_option('-w', '--overwrite', action='store_true',
+-        #            dest='overwrite', default=False,
+-        #            help='If given, overwrites any existing files.'),
+-    )
+     help = (
+         "Dumps all files in the database referenced by FileFields "
+         "or ImageFields onto the filesystem in the directory specified by "
diff -r a65f6acd7cf3 -r c89f116cffc0 www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__load.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__load.py     Tue Aug 04 01:14:36 2020 +0000
@@ -0,0 +1,56 @@
+$NetBSD: patch-binary__database__files_management_commands_database__files__load.py,v 1.1 2020/08/04 01:14:36 joerg Exp $
+
+PR #26
+
+--- binary_database_files/management/commands/database_files_load.py.orig      2020-05-20 16:29:28.000000000 +0000
++++ binary_database_files/management/commands/database_files_load.py
+@@ -1,28 +1,27 @@
+ import os
+-from optparse import make_option
+ 
+ from django.conf import settings
+ from django.core.management.base import BaseCommand
+ from django.db.models import FileField, ImageField
+-from django.apps.apps import get_models
++from django.apps import apps
+ 
+ 
+ class Command(BaseCommand):
+-    option_list = BaseCommand.option_list + (
+-        make_option(
+-            "-m",
+-            "--models",
+-            dest="models",
+-            default="",
+-            help="A list of models to search for file fields. Default is all.",
+-        ),
+-    )
+     help = (
+         "Loads all files on the filesystem referenced by FileFields "
+         "or ImageFields into the database. This should only need to be "
+         "done once, when initially migrating a legacy system."
+     )
+ 
++    def add_arguments(self, parser):
++        parser.add_argument(
++            "-m",
++            "--models",
++            dest="models",
++            default="",
++            help="A list of models to search for file fields. Default is all."
++        )
++
+     def handle(self, *args, **options):
+         show_files = int(options.get("verbosity", 1)) >= 2
+         all_models = [
+@@ -32,8 +31,8 @@ class Command(BaseCommand):
+         settings.DEBUG = False
+         try:
+             broken = 0  # Number of db records referencing missing files.
+-            for model in get_models():
+-                key = "%s.%s" % (model._meta.app_label, model._meta.module_name)
++            for model in apps.get_models():
++                key = "%s.%s" % (model._meta.app_label, model._meta.model_name)
+                 key = key.lower()
+                 if all_models and key not in all_models:
+                     continue
diff -r a65f6acd7cf3 -r c89f116cffc0 www/py-django-binary-database-file/patches/patch-binary__database__files_views.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/py-django-binary-database-file/patches/patch-binary__database__files_views.py Tue Aug 04 01:14:36 2020 +0000
@@ -0,0 +1,25 @@
+$NetBSD: patch-binary__database__files_views.py,v 1.1 2020/08/04 01:14:36 joerg Exp $
+
+PR #27
+
+--- binary_database_files/views.py.orig        2020-08-03 18:11:14.391876186 +0000
++++ binary_database_files/views.py
+@@ -7,7 +7,7 @@ from django.views.decorators.cache impor
+ from django.views.static import serve as django_serve
+ 
+ from binary_database_files.models import File
+-
++from binary_database_files import settings as _settings
+ 
+ @cache_control(max_age=86400)
+ def serve(request, name):
+@@ -15,7 +15,8 @@ def serve(request, name):
+     Retrieves the file from the database.
+     """
+     f = get_object_or_404(File, name=name)
+-    f.dump()
++    if _settings.DB_FILES_AUTO_EXPORT_DB_TO_FS:
++        f.dump()
+     mimetype = mimetypes.guess_type(name)[0] or "application/octet-stream"
+     # Cast to bytes to work around https://code.djangoproject.com/ticket/30294
+     response = HttpResponse(bytes(f.content), content_type=mimetype)



Home | Main Index | Thread Index | Old Index