0

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 ?

Remi Guan
  • 20,142
  • 17
  • 60
  • 81
vivekanon
  • 1,704
  • 3
  • 21
  • 39

0 Answers0