Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • PyI40AAS PyI40AAS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 47
    • Issues 47
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Lehrstuhl für Prozessleittechnik
  • PyI40AASPyI40AAS
  • Merge requests
  • !78

Merged
Created Apr 27, 2021 by Leon Mauritz Möller@leon.moellerDeveloper

model.base: fix id_short validation

  • Overview 0
  • Commits 1
  • Pipelines 3
  • Changes 2

In RegEx, the $ asserts the end of a string or line. When used in re.match() it asserts the end of the string by default, unless the last character is a newline symbol (\n). Then it asserts the end of the string before the newline. Thus the first regex check doesn't filter valid id_shorts ending in a newline, which it should. See https://docs.python.org/3.9/library/re.html#index-2

Using re.fullmatch() instead fixes this issue, making the ^ and $ unnecessary as well.

Next to adding a test for this behaviour this commit also simplifies the check for an alphabetical character at the start of the id_short. And although both checks could also be merged into one, they are left separate to be able to report more accurate errors.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: fix/id_short_validation