Fixed EmailField so can add extra validation

(MongoEngine/mongoengine#173, MongoEngine/mongoengine#174, MongoEngine/mongoengine#187)
This commit is contained in:
Ross Lawley 2012-12-10 08:23:41 +00:00
parent 155d79ff4d
commit 6997e02476
4 changed files with 8 additions and 2 deletions

View File

@ -106,7 +106,7 @@ that much better:
* Adam Reeve * Adam Reeve
* Anthony Nemitz * Anthony Nemitz
* deignacio * deignacio
* shaunduncan * Shaun Duncan
* Meir Kriheli * Meir Kriheli
* Andrey Fedoseev * Andrey Fedoseev
* aparajita * aparajita

View File

@ -5,6 +5,8 @@ Changelog
Changes in 0.7.8 Changes in 0.7.8
================ ================
- Fixed EmailField so can add extra validation (MongoEngine/mongoengine#173, MongoEngine/mongoengine#174, MongoEngine/mongoengine#187)
- Fixed bulk inserts can now handle custom pk's (MongoEngine/mongoengine#192)
- Added as_pymongo method to return raw or cast results from pymongo (MongoEngine/mongoengine#193) - Added as_pymongo method to return raw or cast results from pymongo (MongoEngine/mongoengine#193)
Changes in 0.7.7 Changes in 0.7.7

View File

@ -929,7 +929,7 @@ class QuerySet(object):
if not isinstance(doc, self._document): if not isinstance(doc, self._document):
msg = "Some documents inserted aren't instances of %s" % str(self._document) msg = "Some documents inserted aren't instances of %s" % str(self._document)
raise OperationError(msg) raise OperationError(msg)
if doc.pk: if doc.pk and not doc._created:
msg = "Some documents have ObjectIds use doc.update() instead" msg = "Some documents have ObjectIds use doc.update() instead"
raise OperationError(msg) raise OperationError(msg)
raw.append(doc.to_mongo()) raw.append(doc.to_mongo())

View File

@ -591,6 +591,10 @@ class QuerySetTest(unittest.TestCase):
self.assertRaises(OperationError, throw_operation_error) self.assertRaises(OperationError, throw_operation_error)
# Test can insert new doc
new_post = Blog(title="code", id=ObjectId())
Blog.objects.insert(new_post)
# test handles other classes being inserted # test handles other classes being inserted
def throw_operation_error_wrong_doc(): def throw_operation_error_wrong_doc():
class Author(Document): class Author(Document):