Giter Site home page Giter Site logo

Comments (7)

iapain avatar iapain commented on July 23, 2024

Exceptions should be django like. +1

from mongoengine.

hmarr avatar hmarr commented on July 23, 2024

We're trying not to couple ourselves to a specific framework. Despite the obvious API similarities between Django and MongoEngine, we don't want to introduce Django as a dependency of MongoEngine - I know of a few people using MongoEngine in production with other frameworks.

Something that has been mentioned a few times is moving the Django-related code from MongoEngine into a separate 'glue' project that would also provide adaptors for the Django API, raise Django exceptions, (provide a django.db backend?), etc.

There is some great work on Django integration going on in a fork at http://github.com/aparo/mongoengine

Cheers,

Harry

from mongoengine.

iapain avatar iapain commented on July 23, 2024

@Harry: your justification makes sense but i still see but point is not Django Exceptions. Currently DoesNotExist Exception needs to be imported everywhere and its not documented well. IMO we should raise Document.DoesNotExit as subclass of DoesNotExist Exception. Idea is to contribute DoesNotExist exception to Document class.

Cheers,
D

from mongoengine.

hmarr avatar hmarr commented on July 23, 2024

Ah right, yea that makes sense to me.

Harry

from mongoengine.

iapain avatar iapain commented on July 23, 2024

Implemented. DoesNotExist and MultipleObjectsReturned now contributes to Document base class. Old version still works so

try:
    Person.objects.get(name='name that doesnot exist')
except Person.DoesNotExist:
    print "catch"`

and

try:
   Person.objects.get(name='name that doesnot exist')
except DoesNotExist:
    print "catch"

Both works

from mongoengine.

hmarr avatar hmarr commented on July 23, 2024

Cheers, I've merged this in.

from mongoengine.

m-bd avatar m-bd commented on July 23, 2024

Thank you ! :-)

from mongoengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.