~sircmpwn/todo.sr.ht

732329c04edba96e3ce351f983ad1523e37fa10c — C├ędric Bonhomme 11 months ago 6ce73b2
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 ._-

~sircmpwn/todo.sr.ht#193
1 files changed, 4 insertions(+), 6 deletions(-)

M todosrht/types/tracker.py
M todosrht/types/tracker.py => todosrht/types/tracker.py +4 -6
@@ 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",