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 'title' template filter #443

Merged
merged 2 commits into from May 15, 2017

Conversation

Alex-Sichkar
Copy link
Contributor

Fix issue #438 and make the filter work more correctly with non unicode letters)

Fix issue jieter#438 and make the filter work more correctly with non unicode letters)
Copy link
Owner

@jieter jieter left a comment

Choose a reason for hiding this comment

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

Thanks, I've added two comments.

title = keep_lazy_text(title)
except ImportError:
from django.utils.functional import lazy
title = lazy(title, six.text_type)
Copy link
Owner

Choose a reason for hiding this comment

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

Please add a comment for what version of Django this shim can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

return ' '.join([
any([c.isupper() or c.isdigit() for c in w]) and w or old_title(w)
for w in value.split()
])
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 elaborate on the performance implementation vs the old one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Python 2.7.6, django 1.10.7

image

Copy link
Owner

Choose a reason for hiding this comment

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

looks good!
I guess the lazyness will add a bit of overhead too, but since django is littered with lazy evaluation, it should not be too much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same with keep_lazy_text decorator

image

@jieter jieter merged commit 414e660 into jieter:master May 15, 2017
jieter added a commit that referenced this pull request May 15, 2017
@jieter
Copy link
Owner

jieter commented May 15, 2017

@ygwain merged, thanks!

@jieter
Copy link
Owner

jieter commented Jun 1, 2017

released 1.7.0

@Alex-Sichkar
Copy link
Contributor Author

Alex-Sichkar commented Jun 1, 2017 via email

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.

None yet

2 participants