hobo notify: use force_str on provisioned attributes (#36515)
This commit is contained in:
parent
4c6c08dcae
commit
fca37a3205
|
@ -23,6 +23,7 @@ from wcs.roles import Role
|
|||
from ..qommon.ctl import Command
|
||||
from ..qommon.publisher import get_cfg
|
||||
from wcs.admin.settings import UserFieldsFormDef
|
||||
from wcs.qommon import force_str
|
||||
from wcs.qommon.misc import json_encode_helper
|
||||
|
||||
|
||||
|
@ -107,17 +108,17 @@ class CmdHoboNotify(Command):
|
|||
for o in data:
|
||||
if 'uuid' not in o:
|
||||
raise KeyError('role without uuid')
|
||||
uuid = o['uuid'].encode(publisher.site_charset)
|
||||
uuid = force_str(o['uuid'])
|
||||
uuids.add(uuid)
|
||||
slug = None
|
||||
name = None
|
||||
if action == 'provision':
|
||||
if not cls.check_valid_role(o):
|
||||
raise ValueError('invalid role')
|
||||
slug = o['slug'].encode(publisher.site_charset)
|
||||
details = o.get('details', '').encode(publisher.site_charset) or None
|
||||
name = o['name'].encode(publisher.site_charset)
|
||||
emails = [email.encode(publisher.site_charset) for email in o['emails']]
|
||||
slug = force_str(o['slug'])
|
||||
details = force_str(o.get('details', '')) or None
|
||||
name = force_str(o['name'])
|
||||
emails = [force_str(email) for email in o['emails']]
|
||||
emails_to_members = o['emails_to_members']
|
||||
# Find existing role
|
||||
role = Role.resolve(uuid, slug, name)
|
||||
|
|
Loading…
Reference in New Issue