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

feat: allow Hangul(korean character) in creating and renaming vfolder #59

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

lizable
Copy link
Collaborator

@lizable lizable commented Nov 6, 2020

After This PR, the user can create the vfolder contains with Hangul(a.k.a korean character).

@lizable lizable requested a review from achimnol November 6, 2020 10:35
@codecov
Copy link

codecov bot commented Nov 6, 2020

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.03 🎉

Comparison is base (2c17b58) 75.04% compared to head (8dd2be7) 75.07%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #59      +/-   ##
==========================================
+ Coverage   75.04%   75.07%   +0.03%     
==========================================
  Files          19       19              
  Lines        2500     2504       +4     
==========================================
+ Hits         1876     1880       +4     
  Misses        624      624              
Impacted Files Coverage Δ
src/ai/backend/common/validators.py 62.60% <100.00%> (+0.42%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@achimnol achimnol left a comment

Choose a reason for hiding this comment

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

Let's add an option to this Trafaret, ascii_only: bool, so that users can opt-in unicode-aware alphabets.

src/ai/backend/common/validators.py Outdated Show resolved Hide resolved
@lizable lizable marked this pull request as ready for review November 17, 2020 10:18
Copy link
Member

@achimnol achimnol left a comment

Choose a reason for hiding this comment

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

Please add the news fragment as well.

tests/test_validators.py Outdated Show resolved Hide resolved
src/ai/backend/common/validators.py Outdated Show resolved Hide resolved
src/ai/backend/common/validators.py Outdated Show resolved Hide resolved
Comment on lines +468 to +469
_rx_slug_ascii_only = re.compile(r'^[\w\-_.\s]+$', re.ASCII)
_rx_slug = re.compile(r'^[\w\-_.\s]+$')
Copy link
Member

Choose a reason for hiding this comment

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

It additionally allows whitespaces compared to the previous version.
Please make it to stand out in the news fragment, and reflect that change in the test cases as well.
Also the code has "ascii_only" argument but the fragment says "unicode" mode -- please make them consistent.

Copy link
Member

@achimnol achimnol Mar 25, 2021

Choose a reason for hiding this comment

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

Let's update as follows:

Update the conditions for Slug for existing use cases:

  • disallow the characters outside the regex [\w\-.] (no whitespace allowed!)
  • disallow consecutive dots such as .., ..., ... in any position
  • disallow zero-length (empty) strings

Add a new validator DirectoryNameComponent for vfolder name validation:

  • disallow the characters outside the regex [\w\s\-.] (whitespace allowed!)
  • disallow consecutive dots such as .., ..., ... in any position
  • disallow zero-length (empty) strings

Base automatically changed from master to main February 24, 2021 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants