Skip to content

Commit

Permalink
fix: Corrected the errors on linter
Browse files Browse the repository at this point in the history
  • Loading branch information
egordidenko committed Sep 18, 2024
1 parent 25d4053 commit 87acee2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/django-widget.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Below is the full default configuration:
"use_legacy_widget": False,
"use_hosted_assets": True,
"widget": {
"version": "0.36.0",
"version": "1",
"variant": "regular",
"build": "min",
"options": {},
Expand Down
20 changes: 11 additions & 9 deletions pyuploadcare/dj/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,13 @@ def get_legacy_widget_js_url() -> str:

def get_widget_js_url() -> str:
widget_config = config["widget"]
filename = "file-uploader.{0}.min.js".format(widget_config["build"]).replace(
"..", "."
)
hosted_url = "https://cdn.jsdelivr.net/npm/@uploadcare/file-uploader@{version}/web/{filename}".format(
version=widget_config["version"], filename=filename
)
filename = "file-uploader.{0}.min.js".format(
widget_config["build"]
).replace("..", ".")
hosted_url = (
"https://cdn.jsdelivr.net/npm/@uploadcare/file-uploader@{version}"
+ "/web/{filename}"
).format(version=widget_config["version"], filename=filename)
local_url = "uploadcare/{filename}".format(filename=filename)
override_url = widget_config["override_js_url"]
if override_url:
Expand All @@ -152,9 +153,10 @@ def get_widget_css_url(variant: WidgetVariantType) -> str:
filename = "uc-file-uploader-{0}.{1}.min.css".format(
variant, widget_config["build"]
).replace("..", ".")
hosted_url = "https://cdn.jsdelivr.net/npm/@uploadcare/file-uploader@{version}/web/{filename}".format(
version=widget_config["version"], filename=filename
)
hosted_url = (
"https://cdn.jsdelivr.net/npm/@uploadcare/file-uploader@{version}"
+ "/web/{filename}"
).format(version=widget_config["version"], filename=filename)
local_url = "uploadcare/{filename}".format(filename=filename)
override_url = widget_config["override_css_url"][variant]
if override_url:
Expand Down
7 changes: 5 additions & 2 deletions tests/dj/test_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def test_hosted_js_url(self):

def test_local_js_url(self):
config["use_hosted_assets"] = False
self.assertEqual(get_widget_js_url(), "uploadcare/file-uploader.min.js")
self.assertEqual(
get_widget_js_url(), "uploadcare/file-uploader.min.js"
)

def test_override_js_url(self):
config["widget"]["override_js_url"] = "https://example.com/blocks.js"
Expand All @@ -86,7 +88,8 @@ def test_hosted_css_url(self):
config["use_hosted_assets"] = True
self.assertEqual(
get_widget_css_url("minimal"),
"https://cdn.jsdelivr.net/npm/@uploadcare/file-uploader@1/web/uc-file-uploader-minimal.min.css"
"https://cdn.jsdelivr.net/npm/@uploadcare/file-uploader@1"
+ "/web/uc-file-uploader-minimal.min.css",
)

def test_local_css_url(self):
Expand Down

0 comments on commit 87acee2

Please sign in to comment.