Merged get_document fix

This commit is contained in:
Ross Lawley 2012-11-27 14:02:50 +00:00
parent 68e4a27aaf
commit f9dd051ec9

View File

@ -9,11 +9,10 @@ _document_registry = {}
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 and '.' in name:
# 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: 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: