-
Notifications
You must be signed in to change notification settings - Fork 2
issue-77: Fix absolute request url in HttpStubAdmin with regex(#77) #78
Conversation
Merge develop from uma-tech parrot
# Conflicts: # templates/admin/http_stubs/change_form.html # templates/admin/http_stubs/includes/fieldset.html
Codecov Report
@@ Coverage Diff @@
## develop #78 +/- ##
===========================================
+ Coverage 96.32% 96.52% +0.20%
===========================================
Files 5 5
Lines 136 144 +8
Branches 6 8 +2
===========================================
+ Hits 131 139 +8
Misses 4 4
Partials 1 1
Continue to review full report at Codecov.
|
http_stubs/templatetags/stub_tags.py
Outdated
"""Tag that returns an absolute url. | ||
|
||
:param context: context of request | ||
:param url: relative url | ||
:param fieldset: Fieldset of Django |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such description is opaque to the reader. It is obvious that it would be a django fieldset, but reader would need information why is fieldset needed, when it should be passed. Correct description should be along these lines:
fieldset that is used to get value of the
regex_path
field from the form
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed. Thanks!
http_stubs/templatetags/stub_tags.py
Outdated
|
||
Url = str | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.simple_tag(takes_context=True, name='absolute') | ||
def get_absolute_url_tag(context: Dict, url: Url) -> Url: | ||
def get_absolute_url_tag(context: Dict, url: Url, fieldset: Fieldset) -> Url: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: get_absolute_url_tag
seems too verbose. It consumes 25% of our line length allowance. I suggest one of the variants:
get_absolute_url
absolute_url_tag
absolute_url
That are just as readable but more concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed. Thanks!
@PetrS12 please rebase this branch |
# Conflicts: # http_stubs/templatetags/stub_tags.py # http_stubs/tests/test_tags.py # templates/admin/http_stubs/includes/fieldset_http_stub.html # templates/admin/http_stubs/includes/fieldset_log_entry.html
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Closes #77