From 270f763c793a3f7f6eb44c6b2f3009a715c69050 Mon Sep 17 00:00:00 2001 From: Serghei MIHAI Date: Thu, 5 Feb 2015 11:26:52 +0100 Subject: [PATCH] Whitespaces replaced by hyphens in organization name. Used and whitespaces removed --- ckanext/ozwillo_organization_api/plugin.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ckanext/ozwillo_organization_api/plugin.py b/ckanext/ozwillo_organization_api/plugin.py index 5aeeb68..7ba299d 100644 --- a/ckanext/ozwillo_organization_api/plugin.py +++ b/ckanext/ozwillo_organization_api/plugin.py @@ -59,24 +59,24 @@ def create_organization(context, data_dict): registration_uri = data_dict.pop('instance_registration_uri') organization = data_dict['organization'] user = data_dict['user'] - org_dict = { - 'type': 'organization', - 'name': organization['name'].lower(), - 'id': instance_id, - 'title': organization['name'], - 'description': organization['type'], - 'user': user['name'] - } - user_dict = { - 'name': user['name'], + 'name': user['name'].lower().replace(' ', ''), 'email': user['email_address'], 'password': user['id'] } user_obj = model.User.get(user_dict['name']) + + org_dict = { + 'type': 'organization', + 'name': organization['name'].lower().replace(' ', '-'), + 'id': instance_id, + 'title': organization['name'], + 'description': organization['type'], + 'user': user_dict['name'] + } + if not user_obj: user_create(context, user_dict) - context['user'] = user_dict['name'] try: