- if (len(res)==1):
- controller_site.tenant_id = res[0]['id']
- controller_site.save()
- elif (len(res)):
- raise Exception('Could not assign roles for user %s'%tenant_fields['tenant'])
- else:
- raise Exception('Could not create or update user %s'%tenant_fields['tenant'])