I'm creating an instance of a Class like this :
def exists(username, password):
try:
user_doc = User.objects(username=username,password=password).exclude('password')
except DoesNotExist, e:
raise e
return user_doc._parse()
The try
block raises this exception when there are no matching records.
But I get syntax error.
How should I catch this exception ?