add aurweb.models.session.Session ORM database object

+ Added aurweb.util module.
    - Added make_random_string function.
+ Added aurweb.db.make_random_value function.
    - Takes a model and a column and introspects them to figure out the
      proper column length to create a random string for; then creates
      a unique string for that column.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2020-12-25 20:55:43 -08:00
parent adc9fccb7d
commit 1922e5380d
4 changed files with 129 additions and 1 deletions

7
aurweb/util.py Normal file
View file

@ -0,0 +1,7 @@
import random
import string
def make_random_string(length):
return ''.join(random.choices(string.ascii_lowercase +
string.digits, k=length))