#119 Return a Conflict error when attempting to create a duplicate project

Future
open
nobody
2013-02-12
2013-02-12
No

Attempting to create a project with a number that already exists should result in a specific Conflict exception and an HTTP response code; not the generic Coils exception. All the MKCOL operator has to do is trap IntegrityError specifically.

awilliam@workstation:~/projects/coils> tail -f /var/log/coils.log 
  File "/home/awilliam/projects/coils/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1646, in _execute_context
    context)
  File "/home/awilliam/projects/coils/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_context
    context)
  File "/home/awilliam/projects/coils/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 330, in do_execute
    cursor.execute(statement, parameters)
IntegrityError: (IntegrityError) duplicate key value violates unique constraint "unique_project_number"
DETAIL:  Key (number)=(test123) already exists.
 'INSERT INTO project (project_id, object_version, owner_id, db_status, url, end_date, kind, name, number, is_fake, parent_project_id, start_date) VALUES (%(project_id)s, %(object_version)s, %(owner_id)s, %(db_status)s, %(url)s, %(end_date)s, %(kind)s, %(name)s, %(number)s, %(is_fake)s, %(parent_project_id)s, %(start_date)s)' {'kind': None, 'parent_project_id': None, 'name': 'test123', 'end_date': datetime.datetime(2032, 12, 31, 18, 59, 59), 'url': None, 'is_fake': 0, 'object_version': 1, 'number': 'test123', 'db_status': 'inserted', 'project_id': 101010L, 'start_date': datetime.datetime(2013, 2, 12, 11, 2, 46, 47434), 'owner_id': 23330}

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks