diff --git a/files/helpers/const.py b/files/helpers/const.py index 8ec161eb1..9d80bec87 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -668,5 +668,5 @@ db = db_session() marseys_const = [x[0] for x in db.query(Marsey.name).all()] + ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','exclamationpoint','period','questionmark'] db.close() -if SITE == 'PCM': valid_username_regex = re.compile("^[a-zA-Z0-9_\-А-я]{3,25}$", flags=re.A) -else: valid_username_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$", flags=re.A) \ No newline at end of file +if SITE == 'PCM': valid_username_regex = re.compile("^[a-zA-Z0-9_\-А-я]{3,25}$") +else: valid_username_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$") \ No newline at end of file diff --git a/files/helpers/get.py b/files/helpers/get.py index e6fc03e7a..7a7255391 100644 --- a/files/helpers/get.py +++ b/files/helpers/get.py @@ -85,7 +85,7 @@ def get_account(id, v=None): UserBlock.target_id == v.id ) ) - ).one_or_none() + ).first() user.is_blocking = block and block.user_id == v.id user.is_blocked = block and block.target_id == v.id @@ -200,7 +200,7 @@ def get_comment(i, v=None, graceful=False): UserBlock.target_id == v.id ) ) - ).one_or_none() + ).first() vts = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id) vt = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id).one_or_none() diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index c8c39ffb1..504b8939a 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -125,7 +125,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): sanitized = re.sub('(^|\s|\n|

)\/?(s\/(\w|-){3,25})', r'\1/\2', sanitized, flags=re.A) - for i in re.finditer(valid_username_regex, sanitized, flags=re.A): + for i in re.finditer(valid_username_regex, sanitized): u = get_user(i.group(2), graceful=True) if u and (not g.v.any_block_exists(u) or g.v.admin_level > 1):