mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-02-25 16:00:47 +03:00
Merge pull request #1808 from pydanny/fix-variable-expansions
Avoid '$' in random string generation
This commit is contained in:
commit
809087a848
|
@ -118,9 +118,11 @@ def generate_random_string(
|
|||
if using_ascii_letters:
|
||||
symbols += string.ascii_letters
|
||||
if using_punctuation:
|
||||
symbols += string.punctuation.replace('"', "").replace("'", "").replace(
|
||||
"\\", ""
|
||||
)
|
||||
all_punctuation = set(string.punctuation)
|
||||
# These symbols can cause issues in environment variables
|
||||
unsuitable = {"'", '"', "\\", "$"}
|
||||
suitable = all_punctuation.difference(unsuitable)
|
||||
symbols += "".join(suitable)
|
||||
return "".join([random.choice(symbols) for _ in range(length)])
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user