pkgsrc-Changes archive

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

CVS commit: pkgsrc/www/py-django-binary-database-file/patches



Module Name:    pkgsrc
Committed By:   joerg
Date:           Tue Aug  4 01:14:36 UTC 2020

Added Files:
        pkgsrc/www/py-django-binary-database-file/patches:
            patch-binary__database__files_management_commands_database__files__cleanup.py
            patch-binary__database__files_management_commands_database__files__dump.py
            patch-binary__database__files_management_commands_database__files__load.py
            patch-binary__database__files_views.py

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__cleanup.py \
    pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__dump.py \
    pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__load.py \
    pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_views.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__cleanup.py
diff -u /dev/null pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__cleanup.py:1.1
--- /dev/null   Tue Aug  4 01:14:36 2020
+++ pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__cleanup.py     Tue Aug  4 01:14:36 2020
@@ -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)):
Index: pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__dump.py
diff -u /dev/null pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__dump.py:1.1
--- /dev/null   Tue Aug  4 01:14:36 2020
+++ pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__dump.py        Tue Aug  4 01:14:36 2020
@@ -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 "
Index: pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__load.py
diff -u /dev/null pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__load.py:1.1
--- /dev/null   Tue Aug  4 01:14:36 2020
+++ pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__load.py        Tue Aug  4 01:14:36 2020
@@ -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
Index: pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_views.py
diff -u /dev/null pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_views.py:1.1
--- /dev/null   Tue Aug  4 01:14:36 2020
+++ pkgsrc/www/py-django-binary-database-file/patches/patch-binary__database__files_views.py    Tue Aug  4 01:14:36 2020
@@ -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