Skip to content

Commit

Permalink
fix default issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bckohan committed Nov 21, 2023
1 parent f6da0d0 commit e0054b5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ sphinxcontrib-jsmath==1.0.1; python_version >= "3.5"
sphinxcontrib-qthelp==1.0.3; python_version >= "3.5"
sphinxcontrib-serializinghtml==1.1.5; python_version >= "3.5"
sphinx-js==3.2.2; python_version >= "3.5"
django-render-static==2.1.1
django-render-static==2.1.2
6 changes: 6 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Change Log
==========

v2.1.2
======

* Fixed `deepEqual should only be included by ClassURLWriter when Django version is less than 4.1 <https://github.com/bckohan/django-render-static/issues/134>`_
* Fixed `deepEqual generated code in ClassURLWriter has an error <https://github.com/bckohan/django-render-static/issues/133>`_

v2.1.1
======

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-render-static"
version = "2.1.1"
version = "2.1.2"
description = "Use Django's template engine to render static files at deployment or package time. Includes transpilers for extending Django's url reversal and enums to JavaScript."
authors = ["Brian Kohan <bckohan@gmail.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion render_static/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .transpilers.enums_to_js import EnumClassWriter
from .transpilers.urls_to_js import ClassURLWriter, SimpleURLWriter

VERSION = (2, 1, 1)
VERSION = (2, 1, 2)

__title__ = 'Django Render Static'
__version__ = '.'.join(str(i) for i in VERSION)
Expand Down
17 changes: 8 additions & 9 deletions render_static/transpilers/urls_to_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ def impl() -> Generator[str, None, None]:
)
yield 'if ('
self.indent()
yield '(areObjects && !deepEqual(val1, val2)) ||'
yield '(areObjects && !this.deepEqual(val1, val2)) ||'
yield '(!areObjects && val1 !== val2)'
yield ') { return false; }'
self.outdent()
Expand Down Expand Up @@ -1291,9 +1291,7 @@ def impl() -> Generator[str, None, None]:
self.indent()
yield 'if (kwargs.hasOwnProperty(key)) {'
self.indent()
if (
DJANGO_VERSION[0] >= 4 and DJANGO_VERSION[1] >= 1
): # pragma: no cover
if DJANGO_VERSION[0:2] >= (4,1): # pragma: no cover
# there was a change in Django 4.1 that seems to coerce kwargs
# given to the default kwarg type of the same name if one
# exists for the purposes of reversal. Thus 1 will == '1'
Expand All @@ -1305,7 +1303,7 @@ def impl() -> Generator[str, None, None]:
# evidence that previous behavior wasn't considered spec.
yield (
'if (kwargs[key] !== val && '
'kwargs[key].toString() !== val.toString() '
'JSON.stringify(kwargs[key]) !== JSON.stringify(val) '
'&& !expected.includes(key)) '
'{ return false; }'
)
Expand Down Expand Up @@ -1438,10 +1436,11 @@ class code.
yield ''
yield from self.match()
yield ''
yield from self.deep_equal()
yield ''
yield from self.is_object()
yield ''
if DJANGO_VERSION[0:2] < (4, 1): # pragma: no cover
yield from self.deep_equal()
yield ''
yield from self.is_object()
yield ''
yield from self.reverse()
yield ''
yield 'urls = {'
Expand Down

0 comments on commit e0054b5

Please sign in to comment.