-
Notifications
You must be signed in to change notification settings - Fork 9
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
Ensure entry slugs fit in a slug field. Fixes #35 #38
Conversation
Oops! 😢 Unicode fix coming soon. |
This looks pretty good. Nice testing! I see that this covers both the character restriction and the slash cases. The only case that is sticking in my brain is how the logic will cut off words. For example: >>> slugify("Please tell me where everyone is getting their assumptions about me
?")[:50].strip('-')
u'please-tell-me-where-everyone-is-getting-their-ass' Now something like that of course can happen when words are cut off: >>> slugify("About the incident... You think I am crazy? Well I am not!")[:50].strip('-')
u'about-the-incident-you-think-i-am-crazy-well-i-am' Though the first one is at least preventable. So I think we may as well address it. |
Yeah, good point. I'll try to address this and update the PR in the next day or so. Another option that we haven't talked about is to create a custom |
I have been thinking about this lately as well and I might be able to get some time for it later this week. |
Looks like the max we can go is 256 as I would like to keep the project portable. Increasing the slug to 255 and reducing the title to 255 would be a viable solution on it's own. Otherwise if we only increase the size of the slug field the truncation logic will have to be finished. I am all right with any of these approaches:
|
One more 4th option which is probably the most ideal:
I have a little time today and tomorrow to do it if you prefer 3 or 4 but don't feel comfortable/don't have time to make the change. |
👍 for option 4. It seems like the best approach to me, though you may want to keep the existing technique to prevent duplicate slugs (I altered it slightly so that it would keep the total length of the slug < 50). I'd be happy to do this work, but I won't be available until the weekend. Feel free to take over from here if you want. |
I had missed that you already have the truncation logic finished. Nice. I would like to see your original pull request be merged in so I thought about doing a PR against your branch... That seemed more complicated then just waiting for your weekend time and there isn't much left now. So have at it. :) |
…ping whole words intact
… maximum of 255 characters, and so that the appended timestamp won't include two dashes, eg: some-slug--12345689
…t_timestamp, removing the test for slug creation of long titles (since title and slug now have the same length)
The last few commits add the following:
Let me know if there's anything in there that looks out of place, or if you'd like to do anything differently. |
Thanks! I can take a look at this tommorow afternoon. |
Code looks great. I manually tested the following:
|
Ensure entry slugs fit in a slug field. Fixes #35
This has been released on PyPI. |
Excellent! 👍 |
Here's a first attempt at resolving #35. It does the following:
save
,_slugify_title
.Let me know what you think. I'm open to revising any of this.