Error where new thread could not be created because the check of old was wrong.

This commit is contained in:
Tanshu 2013-06-21 15:12:01 +05:30
parent 89e6f347cd
commit 1bd079ae74

View File

@ -26,7 +26,7 @@ def save(request):
user_id = uuid.UUID(authenticated_userid(request))
user_name = User.by_id(user_id).name
title = request.json_body['Title'].strip()
if Thread.by_title(title) is None:
if Thread.by_title(title) is not None:
raise ValidationError('Message with same title already exists')
thread = Thread(title=title, priority=request.json_body['Priority'], user_id=user_id)
DBSession.add(thread)