-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add util for random_string with special characters #1177
Comments
I'm guessing this is required in the context of Aspects, right? Have you considered using the ENV_TEMPLATE_VARIABLES filter? |
Yes for Aspects. I haven't considered that, but I'm not sure if it helps - I still need to generate random strings but with special characters included. This is what we're doing now |
You could implement what you need with the following:
And then, in configuration:
I'm not saying we should not include "random_string_special" in Tutor core. I just want to highlight that if you need it now in Aspects, then you can add to in your plugin. FYI you should be careful about inclusion of such strings in templates. For instance, quote signs will not be escaped, which means that you should always wrap those strings in double quotes "...". But |
Oh, perfect! I was going to just write a new util function but this is cleaner. Thank you! |
If you pass argument: special=True, special characters will be added to the generated random string. Close overhangio#1177
If you pass argument: special=True, special characters will be added to the generated random string. Close overhangio#1177
tutor/tutor/utils.py
Line 69 in 0b934af
Add new util
random_string_special
that includes string.punctuation(https://docs.python.org/3/library/string.html#string.punctuation)This is needed when using random_string to create Clickhouse passwords
The text was updated successfully, but these errors were encountered: