From 2a794fa77693a58ed0c2585d3f70f686c38dbe93 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 26 Nov 2014 14:43:56 -0800 Subject: [PATCH] Fix for single role_attr --- database/postgresql/postgresql_user.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/database/postgresql/postgresql_user.py b/database/postgresql/postgresql_user.py index 421831e8165..00001bdcd7b 100644 --- a/database/postgresql/postgresql_user.py +++ b/database/postgresql/postgresql_user.py @@ -400,8 +400,10 @@ def parse_role_attrs(role_attr_flags): """ if ',' in role_attr_flags: flag_set = frozenset(r.upper() for r in role_attr_flags.split(",")) + elif role_attr_flags: + flag_set = frozenset((role_attr_flags.upper(),)) else: - flag_set = frozenset(role_attr_flags.upper()) + flag_set = frozenset() if not flag_set.issubset(VALID_FLAGS): raise InvalidFlagsError('Invalid role_attr_flags specified: %s' % ' '.join(flag_set.difference(VALID_FLAGS))) @@ -431,11 +433,11 @@ def parse_privs(privs, db): if ':' not in token: type_ = 'database' name = db - priv_set = frozenset(x.strip().upper() for x in token.split(',')) + priv_set = frozenset(x.strip().upper() for x in token.split(',') if x.strip()) else: type_ = 'table' name, privileges = token.split(':', 1) - priv_set = frozenset(x.strip().upper() for x in privileges.split(',')) + priv_set = frozenset(x.strip().upper() for x in privileges.split(',') if x.strip()) if not priv_set.issubset(VALID_PRIVS[type_]): raise InvalidPrivsError('Invalid privs specified for %s: %s' %