Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix colon mis-caching issue #33

Merged
merged 3 commits into from
Jun 18, 2019
Merged

Fix colon mis-caching issue #33

merged 3 commits into from
Jun 18, 2019

Conversation

akx
Copy link
Contributor

@akx akx commented Jun 11, 2019

This PR fixes #32.

The fix itself is inspired by Django's make_template_fragment_key: https://github.com/django/django/blob/76b3fc5c8d8dffb441aaa08f75833888be2107af/django/core/cache/utils.py#L10

@codecov
Copy link

codecov bot commented Jun 11, 2019

Codecov Report

Merging #33 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #33   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          40     41    +1     
=====================================
+ Hits           40     41    +1
Impacted Files Coverage Δ
src/cache_memoize/__init__.py 100% <100%> (ø) ⬆️

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 677c8af...2df4007. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 11, 2019

Codecov Report

Merging #33 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #33   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          40     41    +1     
=====================================
+ Hits           40     41    +1
Impacted Files Coverage Δ
src/cache_memoize/__init__.py 100% <100%> (ø) ⬆️

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 677c8af...3170917. Read the comment docs.

@peterbe
Copy link
Owner

peterbe commented Jun 11, 2019

Linting issues. Anything we can do to help make that easier to work with before making PRs?


fun('a:b', 'c')
fun('a', 'b:c')
assert len(calls_made) == 2
Copy link
Owner

Choose a reason for hiding this comment

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

Can you extend this unit test to do one with non-ascii parameters.
E.g.

fun('a', 'ä:á')

or whatever it is.

Also, what would happen if you pass byte string instead. E.g. b'ë'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing.

@akx
Copy link
Contributor Author

akx commented Jun 12, 2019

Linting issues. Anything we can do to help make that easier to work with before making PRs?

TBH I just forgot to run black (and didn't have therapist installed because I generally run a heavily rebasey workflow and precommit tools slow that down). My bad.

akx added 3 commits June 12, 2019 10:06
The usage of quote() is inspired by Django's own `make_template_fragment_key`.

Fixes peterbe#32
Copy link
Owner

@peterbe peterbe left a comment

Choose a reason for hiding this comment

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

Looks great. I didn't test it manually but tests look good.

@peterbe peterbe merged commit f1c6b84 into peterbe:master Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arguments containing colons can be mis-cached
2 participants