Fixed handling for old style types

This commit is contained in:
Ross Lawley 2012-11-27 11:59:34 +00:00
parent 9f5ab8149f
commit 653c4259ee
4 changed files with 10 additions and 7 deletions

View File

@ -2,6 +2,10 @@
Changelog Changelog
========= =========
Changes in 0.7.7
================
- Fix handling for old style _types
Changes in 0.7.6 Changes in 0.7.6
================ ================
- Unicode fix for repr (MongoEngine/mongoengine#133) - Unicode fix for repr (MongoEngine/mongoengine#133)

View File

@ -12,7 +12,7 @@ from signals import *
__all__ = (document.__all__ + fields.__all__ + connection.__all__ + __all__ = (document.__all__ + fields.__all__ + connection.__all__ +
queryset.__all__ + signals.__all__) queryset.__all__ + signals.__all__)
VERSION = (0, 7, 6) VERSION = (0, 7, 7)
def get_version(): def get_version():

View File

@ -121,11 +121,10 @@ class ValidationError(AssertionError):
def get_document(name): def get_document(name):
doc = _document_registry.get(name, None) doc = _document_registry.get(name, None)
if not doc: if not doc:
# Possible old style names # Possible old style name
end = ".%s" % name end = name.split('.')[-1]
possible_match = [k for k in _document_registry.keys() possible_match = [k for k in _document_registry.keys() if k == end]
if k.endswith(end)] if len(possible_match) == 1 and end != name:
if len(possible_match) == 1:
doc = _document_registry.get(possible_match.pop(), None) doc = _document_registry.get(possible_match.pop(), None)
if not doc: if not doc:
raise NotRegistered(""" raise NotRegistered("""

View File

@ -5,7 +5,7 @@
%define srcname mongoengine %define srcname mongoengine
Name: python-%{srcname} Name: python-%{srcname}
Version: 0.7.6 Version: 0.7.7
Release: 1%{?dist} Release: 1%{?dist}
Summary: A Python Document-Object Mapper for working with MongoDB Summary: A Python Document-Object Mapper for working with MongoDB