question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

decouple.Csv() makes raw strings not-raw, incorrectly

See original GitHub issue

The django-cors-headers middleware has two ways to control Access-Control-Allow-Origin. One of them is via a regular expression CORS_ALLOWED_ORIGIN_REGEXES, which is a list of strings that are regular expressions. Unfortunately, we’ve been struggling to use a regex like r"^https://\w+\.example\.com$". That is, we tried

>>> CORS_ALLOWED_ORIGIN_REGEXES: List[str] = config('CORS_ALLOWED_ORIGIN_REGEXES', r"^https://\w+\.example\.com$", cast=Csv())

and set the value in the environment, and that didn’t work because…

>>> Csv()(r"^https://\w+\.example\.com$")
['^https://w+.example.com$']

which is not the same regular expression we entered. Honestly, the other side of our problem is helmfile, which makes it difficult to set environment variables with backslashes in them, but we thought at least the default in pure python should work, and would be worth reporting.

If you don’t use Csv(), the raw string behaves as expected:

>>> config('XYZZY', r'abc\def')
'abc\\def'

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
henriquebastoscommented, Sep 27, 2021

Yes. But this is not an CSV issue. It’s more general. I’ll need to write the proper tests to make sure all the corners are covered.

0reactions
kojiromikecommented, Apr 22, 2021

Hi, any chance of getting traction on this issue? I think the code is all ready to go in #103.

Read more comments on GitHub >

github_iconTop Results From Across the Web

decouple.Csv() makes raw strings not-raw, incorrectly #102
The django-cors-headers middleware has two ways to control Access-Control-Allow-Origin. One of them is via a regular expression CORS_ALLOWED_ORIGIN_REGEXES, ...
Read more >
Releases - Pandoc
Support text/markdown , which is now a supported mime type for raw output ... AttributeList() constructor, which creates the associative attribute list that ......
Read more >
Big Data Beyond the Hype - TDWI
Decisions to purchase any IBM software should not be made based on the features said to be available in this book. In addition,...
Read more >
pandoc-2.9.2.1-bp152.1.1 - SUSE Package Hub -
The CSV table is converted into a pandoc simple table. A new module Text.Pandoc.Readers.CSV exports `readCSV` [API change]. ... The module Text.Pandoc.Writers.
Read more >
A Distributed Common Ground Segment for Educational ...
This makes the distributed ground segment ... Export telemetry as CSV files for MATLAB ... Array of Strings List of all satellitePath.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found