Skip to content

Commit 031eaa4

Browse files
committed
django-upgrade fixes
1 parent 2ac19ba commit 031eaa4

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

filer/server/backends/default.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def serve(self, request, filer_file, **kwargs):
2424
# Respect the If-Modified-Since header.
2525
statobj = os.stat(fullpath)
2626
response_params = {'content_type': filer_file.mime_type}
27-
if not was_modified_since(request.META.get('HTTP_IF_MODIFIED_SINCE'),
27+
if not was_modified_since(request.headers.get('if-modified-since'),
2828
statobj[stat.ST_MTIME]):
2929
return HttpResponseNotModified(**response_params)
3030
response = HttpResponse(open(fullpath, 'rb').read(), **response_params)

tests/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def create_folder_structure(depth=2, sibling=2, parent=None):
2525
depth_range.reverse()
2626
for d in depth_range:
2727
for s in range(1, sibling + 1):
28-
name = "folder: {} -- {}".format(str(d), str(s))
28+
name = f"folder: {str(d)} -- {str(s)}"
2929
folder = Folder(name=name, parent=parent)
3030
folder.save()
3131
create_folder_structure(depth=d - 1, sibling=sibling, parent=folder)

tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_create_icons(self):
8787
self.assertEqual(len(icons), len(filer_settings.FILER_ADMIN_ICON_SIZES))
8888
for size in filer_settings.FILER_ADMIN_ICON_SIZES:
8989
self.assertEqual(os.path.basename(icons[size]),
90-
file_basename + '__{}x{}_q85_crop_subsampling-2_upscale.jpg'.format(size, size))
90+
file_basename + f'__{size}x{size}_q85_crop_subsampling-2_upscale.jpg')
9191

9292
def test_access_icons_property(self):
9393
"""Test IconsMixin that calls static on a non-existent file"""

tests/utils/test_app/admin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
from .models import MyModel
44

55

6+
@admin.register(MyModel)
67
class MyModelAdmin(admin.ModelAdmin):
78
model = MyModel
8-
9-
10-
admin.site.register(MyModel, MyModelAdmin)

0 commit comments

Comments
 (0)