torchbox/django-pattern-library

library doesn't handle windows paths

reedjones opened this issue ยท 0 comments

Found a bug? Please fill out the sections below. ๐Ÿ‘

The url regex doesn't account for windows paths that have '\'

A summary of the issue.

Steps to Reproduce

clone the main repo,
run the server, and you will get a PatternLibraryEmpty error because it can't find the paths
because patterns/atoms won't work on windows

so now we have to change our settings for windows style path

PATTERN_LIBRARY = {
#...
    "SECTIONS": [
        ("atoms", ["patterns\\atoms"]),  # was patterns/atoms 
        ("molecules", ["patterns\\molecules"]), # etc... 
        ("pages", ["patterns\\pages"]),
    ],
}

Now you will get an error about the url not matching because the url also doesn't handle windows paths

basically this r"^pattern/(?P<pattern_template_name>[\w./-]+%s)$"
should be r"^pattern/(?P<pattern_template_name>[\w./-\\]+%s)$"

  • Python version: 3+
  • Django version: 4