0.7.9
This commit is contained in:
		| @@ -2,6 +2,10 @@ | ||||
| Changelog | ||||
| ========= | ||||
|  | ||||
| Changes in 0.7.9 | ||||
| ================ | ||||
| - Better fix handling for old style _types | ||||
| - Embedded SequenceFields follow collection naming convention | ||||
|  | ||||
| Changes in 0.7.8 | ||||
| ================ | ||||
|   | ||||
| @@ -12,7 +12,7 @@ from signals import * | ||||
| __all__ = (document.__all__ + fields.__all__ + connection.__all__ + | ||||
|            queryset.__all__ + signals.__all__) | ||||
|  | ||||
| VERSION = (0, 7, 8) | ||||
| VERSION = (0, 7, 9) | ||||
|  | ||||
|  | ||||
| def get_version(): | ||||
|   | ||||
| @@ -122,9 +122,11 @@ def get_document(name): | ||||
|     doc = _document_registry.get(name, None) | ||||
|     if not doc: | ||||
|         # Possible old style name | ||||
|         end = name.split('.')[-1] | ||||
|         possible_match = [k for k in _document_registry.keys() if k == end] | ||||
|         if len(possible_match) == 1 and end != name: | ||||
|         single_end = name.split('.')[-1] | ||||
|         compound_end = '.%s' % single_end | ||||
|         possible_match = [k for k in _document_registry.keys() | ||||
|                           if k.endswith(compound_end) or k == single_end] | ||||
|         if len(possible_match) == 1: | ||||
|             doc = _document_registry.get(possible_match.pop(), None) | ||||
|     if not doc: | ||||
|         raise NotRegistered(""" | ||||
|   | ||||
| @@ -1364,7 +1364,8 @@ class SequenceField(IntField): | ||||
|         if issubclass(owner, Document): | ||||
|             return owner._get_collection_name() | ||||
|         else: | ||||
|             return owner._class_name | ||||
|             return ''.join('_%s' % c if c.isupper() else c | ||||
|                             for c in owner._class_name).strip('_').lower() | ||||
|  | ||||
|     def __get__(self, instance, owner): | ||||
|  | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| %define srcname mongoengine | ||||
|  | ||||
| Name:           python-%{srcname} | ||||
| Version:        0.7.8 | ||||
| Version:        0.7.9 | ||||
| Release:        1%{?dist} | ||||
| Summary:        A Python Document-Object Mapper for working with MongoDB | ||||
|  | ||||
|   | ||||
| @@ -15,7 +15,7 @@ from datetime import datetime | ||||
| from tests.fixtures import Base, Mixin, PickleEmbedded, PickleTest | ||||
|  | ||||
| from mongoengine import * | ||||
| from mongoengine.base import NotRegistered, InvalidDocumentError | ||||
| from mongoengine.base import NotRegistered, InvalidDocumentError, get_document | ||||
| from mongoengine.queryset import InvalidQueryError | ||||
| from mongoengine.connection import get_db, get_connection | ||||
|  | ||||
| @@ -1336,7 +1336,6 @@ class DocumentTest(unittest.TestCase): | ||||
|  | ||||
|         User.drop_collection() | ||||
|  | ||||
|  | ||||
|     def test_document_not_registered(self): | ||||
|  | ||||
|         class Place(Document): | ||||
| @@ -1361,6 +1360,19 @@ class DocumentTest(unittest.TestCase): | ||||
|             print Place.objects.all() | ||||
|         self.assertRaises(NotRegistered, query_without_importing_nice_place) | ||||
|  | ||||
|     def test_document_registry_regressions(self): | ||||
|  | ||||
|         class Location(Document): | ||||
|             name = StringField() | ||||
|             meta = {'allow_inheritance': True} | ||||
|  | ||||
|         class Area(Location): | ||||
|             location = ReferenceField('Location', dbref=True) | ||||
|  | ||||
|         Location.drop_collection() | ||||
|  | ||||
|         self.assertEquals(Area, get_document("Area")) | ||||
|         self.assertEquals(Area, get_document("Location.Area")) | ||||
|  | ||||
|     def test_creation(self): | ||||
|         """Ensure that document may be created using keyword arguments. | ||||
|   | ||||
| @@ -2201,7 +2201,7 @@ class FieldTest(unittest.TestCase): | ||||
|              comments=[Comment(content="NoSQL Rocks"), | ||||
|                        Comment(content="MongoEngine Rocks")]).save() | ||||
|  | ||||
|         c = self.db['mongoengine.counters'].find_one({'_id': 'Comment.id'}) | ||||
|         c = self.db['mongoengine.counters'].find_one({'_id': 'comment.id'}) | ||||
|         self.assertEqual(c['next'], 2) | ||||
|         post = Post.objects.first() | ||||
|         self.assertEqual(1, post.comments[0].id) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user