This commit is contained in:
Ross Lawley
2012-12-10 15:16:31 +00:00
parent 2459f9b0aa
commit 3b3738b36b
7 changed files with 28 additions and 9 deletions

View File

@@ -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():

View File

@@ -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("""

View File

@@ -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):