Skip to content
This repository has been archived by the owner on May 26, 2021. It is now read-only.

issue-77: Fix absolute request url in HttpStubAdmin with regex(#77) #78

Merged
merged 30 commits into from
Dec 13, 2020

Conversation

PetrS12
Copy link
Contributor

@PetrS12 PetrS12 commented Dec 2, 2020

Closes #77

@codecov
Copy link

codecov bot commented Dec 2, 2020

Codecov Report

Merging #78 (cbc8aee) into develop (e5d9672) will increase coverage by 0.20%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             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              
Impacted Files Coverage Δ
http_stubs/templatetags/stub_tags.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e5d9672...cbc8aee. Read the comment docs.

"""Tag that returns an absolute url.

:param context: context of request
:param url: relative url
:param fieldset: Fieldset of Django
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed. Thanks!


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:
Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed. Thanks!

@PetrS12 PetrS12 changed the title Fix absolute request url in HttpStubAdmin with regex(#77) issue-77: Fix absolute request url in HttpStubAdmin with regex(#77) Dec 5, 2020
@lowitea lowitea added the bug Something isn't working label Dec 7, 2020
@lowitea lowitea added this to the 1.0.0 milestone Dec 7, 2020
@lowitea
Copy link
Contributor

lowitea commented Dec 12, 2020

@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
@sonarcloud
Copy link

sonarcloud bot commented Dec 13, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@lowitea lowitea merged commit 92725d3 into Uma-Tech:develop Dec 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix absolute request url in HttpStubAdmin with regex
3 participants