~sircmpwn/sr.ht-dev

todo.sr.ht: Aligning the naming constraints with git.sr.ht: - repository name must be at least one character, not two; - fist character can be uppercase (but not a numeric); - in general accepts only alphanumeric characters or ._- v1 PROPOSED

Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/8920/mbox | git am -3
Learn more about email & git

[PATCH todo.sr.ht 1/2] Aligning the naming constraints with git.sr.ht: - repository name must be at least one character, not two; - fist character can be uppercase (but not a numeric); - in general accepts only alphanumeric characters or ._- Export this patch

Cédric Bonhomme
~sircmpwn/todo.sr.ht#193
---
 todosrht/types/tracker.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/todosrht/types/tracker.py b/todosrht/types/tracker.py
index db8d6f0..4ede141 100644
--- a/todosrht/types/tracker.py
+++ b/todosrht/types/tracker.py
@@ -6,7 +6,7 @@ from srht.flagtype import FlagType
 from srht.validation import Validation
 from todosrht.types import TicketAccess, TicketStatus, TicketResolution
 
-name_re = re.compile(r"^([a-z][a-z0-9_.-]*?)+$")
+name_re = re.compile(r"^([A-Za-z._-][A-Za-z._-]*?)+$")
 
 class Tracker(Base):
     __tablename__ = 'tracker'
@@ -63,13 +63,11 @@ class Tracker(Base):
         if not valid.ok:
             return None, valid
 
-        valid.expect(2 <= len(name) < 256,
-                "Must be between 2 and 255 characters",
+        valid.expect(1 <= len(name) < 256,
+                "Must be between 1 and 255 characters",
                 field="name")
-        valid.expect(not valid.ok or name[0] in string.ascii_lowercase,
-                "Must begin with a lowercase letter", field="name")
         valid.expect(not valid.ok or name_re.match(name),
-                "Only lowercase alphanumeric characters or -.",
+                "Only alphanumeric characters or ._-",
                 field="name")
         valid.expect(not desc or len(desc) < 4096,
                 "Must be less than 4096 characters",
-- 
2.20.1

[PATCH todo.sr.ht 2/2] Fix regular expression: Repository name can not start with .-_ Export this patch

Cédric Bonhomme
---
 todosrht/types/tracker.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/todosrht/types/tracker.py b/todosrht/types/tracker.py
index 4ede141..4eb227d 100644
--- a/todosrht/types/tracker.py
+++ b/todosrht/types/tracker.py
@@ -6,7 +6,7 @@ from srht.flagtype import FlagType
 from srht.validation import Validation
 from todosrht.types import TicketAccess, TicketStatus, TicketResolution
 
-name_re = re.compile(r"^([A-Za-z._-][A-Za-z._-]*?)+$")
+name_re = re.compile(r"^([a-zA-Z][a-zA-Z0-9._-]*?)+$")
 
 class Tracker(Base):
     __tablename__ = 'tracker'
-- 
2.20.1
View this thread in the archives