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

Allow pages to be moved to slugs with Unicode characters in them #193

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

aryamanarora
Copy link
Member

@aryamanarora aryamanarora commented Jun 18, 2020

So that I can move the Hindi pages to the Devanagari slugs. This fixes the regexes that govern moving pages.

(Has been tested locally but testing it again won't hurt)


class WikiSlugField(forms.CharField):
"""
In future versions of Django, we might be able to define this field as
the default field directly on the model. For now, it's used in CreateForm.
"""

default_validators = [validators.validate_slug, validate_slug_numbers]
default_validators = [validate_slug_ss, validate_slug_numbers]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why distinguish validate_slug_ss and validate_unicode_slug_adp here? If this is for article titles in general it shouldn't refer to supersenses and adpositions.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the distinction is Unicode vs. non-Unicode, will validators.validate_slug will continue to work on this line?


def __init__(self, *args, **kwargs):
self.allow_unicode = kwargs.pop('allow_unicode', False)
if self.allow_unicode:
self.default_validators = [
validators.validate_unicode_slug,
validate_unicode_slug_adp,
Copy link
Contributor

Choose a reason for hiding this comment

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

What does the validators.validate_unicode_slug regex look like? I think we just need to make it a tiny bit more permissive to allow modifier characters.

@nschneid nschneid marked this pull request as draft December 18, 2021 02:21
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.

2 participants