Skip to content

format.py string startup crash #7586

@alesan99

Description

@alesan99

Describe the bug
On my windows installations I am getting a crash as soon as I start up specify

PS C:\Users\a114s239\Projects\specify7> docker exec specify7 ve/bin/python manage.py makemigrations
/opt/specify7/specifyweb/backend/stored_queries/format.py:451: SyntaxWarning: invalid escape sequence '\.'
  [(field.op('REGEXP')('^-?[0-9]+(\.[0-9]+)?$'), cast(field, types.Numeric(65)))],
No changes detected

To Reproduce
Steps to reproduce the behavior:

  1. Use a windows docker installation.
  2. Start up specify and see the error.

Expected behavior
(Fix by @melton-jason )
This line:

https://github.com/specify/specify7/blob/548bd8c71ad193319cc649af0c04972c01adea89/specifyweb/backend/stored_queries/format.py#L451C17-L451C97

The string should be made into a raw string

            return case(
                [(field.op('REGEXP')(r'^-?[0-9]+(\.[0-9]+)?$'), cast(field, types.Numeric(65)))],
                else_=field
            )

Crash Report

PS C:\Users\a114s239\Projects\specify7> docker exec specify7 ve/bin/python manage.py makemigrations
/opt/specify7/specifyweb/backend/stored_queries/format.py:451: SyntaxWarning: invalid escape sequence '\.'
  [(field.op('REGEXP')('^-?[0-9]+(\.[0-9]+)?$'), cast(field, types.Numeric(65)))],
No changes detected

Please fill out the following information manually:

  • OS: Windows 11
  • Browser: Chrome
  • Specify 7 Version: 7.12.0
  • Database Name: kubirds

Metadata

Metadata

Assignees

No one assigned

    Labels

    regressionThis is behavior that once worked that has broken. Must be resolved before the next release.

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions