diff options
author | Erik Johnston <erik@matrix.org> | 2015-03-20 16:31:48 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-03-20 16:31:48 +0000 |
commit | f6583796feeff5a50c0988ce674a1ab861b14e34 (patch) | |
tree | 47f9d5934440eef201c6ab65a0fb8df06631d18d /synapse/util/stringutils.py | |
parent | Rearrange storage modules (diff) | |
parent | Merge pull request #113 from matrix-org/store_rearrangement (diff) | |
download | synapse-f6583796feeff5a50c0988ce674a1ab861b14e34.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into mysql
Diffstat (limited to 'synapse/util/stringutils.py')
-rw-r--r-- | synapse/util/stringutils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/util/stringutils.py b/synapse/util/stringutils.py index ea53a8085c..52e66beaee 100644 --- a/synapse/util/stringutils.py +++ b/synapse/util/stringutils.py @@ -16,6 +16,10 @@ import random import string +_string_with_symbols = ( + string.digits + string.ascii_letters + ".,;:^&*-_+=#~@" +) + def origin_from_ucid(ucid): return ucid.split("@", 1)[1] @@ -23,3 +27,9 @@ def origin_from_ucid(ucid): def random_string(length): return ''.join(random.choice(string.ascii_letters) for _ in xrange(length)) + + +def random_string_with_symbols(length): + return ''.join( + random.choice(_string_with_symbols) for _ in xrange(length) + ) |