Skip to content

Commit

Permalink
change appendUriParam to pythonic naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
eveleighoj committed Jan 10, 2024
1 parent c89865f commit e76b0ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions application/core/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def uri_encode(uri_template, kwarg_list):

# TODO Non pythonic naming syntax
# Takes a URI and appends a specified parameter to it
def appendUriParam(uri, param):
def append_uri_param(uri, param):
uri_parts = list(urlparse.urlparse(uri))
query = dict(urlparse.parse_qsl(uri_parts[4]))
query.update(param)
Expand Down Expand Up @@ -221,7 +221,7 @@ def hash_file(filename):
def cacheBust(uri):
filename = uri.split("?")[0]
sha = hash_file(filename)
return appendUriParam(uri, {"v": sha})
return append_uri_param(uri, {"v": sha})


def extract_component_key(json_ref):
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/core/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
remove_values_from_param_dict,
make_url_param_str,
cacheBust,
appendUriParam,
append_uri_param,
hash_file,
)

Expand Down Expand Up @@ -102,15 +102,15 @@ def test_cacheBust_params():
assert len(hash) == 40


def test_appendUriParam():
def test_append_uri_param():
uri = "static/javascript/myCookScript.js"
param = {"key": "value"}
result = appendUriParam(uri, param)
result = append_uri_param(uri, param)
assert result == "static/javascript/myCookScript.js?key=value"

uri = "static/javascript/myCookScript.js?key=value"
param = {"differentKey": "differentValue"}
result = appendUriParam(uri, param)
result = append_uri_param(uri, param)
assert (
result
== "static/javascript/myCookScript.js?key=value&differentKey=differentValue"
Expand Down

0 comments on commit e76b0ea

Please sign in to comment.