Ejemplo n.º 1
0
def get_correct_app_class(doc):
    from corehq.apps.app_manager.models import Application, RemoteApp
    try:
        return {
            'Application': Application,
            'Application-Deleted': Application,
            "RemoteApp": RemoteApp,
            "RemoteApp-Deleted": RemoteApp,
        }[doc['doc_type']]
    except KeyError:
        raise DocTypeError()
Ejemplo n.º 2
0
 def wrap(doc):
     doc_type = doc.get(doctype_attr)
     try:
         cls = classes[doc_type]
     except KeyError:
         raise DocTypeError(
             "the document being wrapped has doc type {0!r}. "
             "To wrap it anyway, you must explicitly pass in "
             "classes={{{0!r}: <document class>}} to your view. "
             "This behavior is new starting in 0.6.2.".format(doc_type))
     return cls.wrap(doc)
Ejemplo n.º 3
0
def get_correct_app_class(doc):
    try:
        return app_doc_types()[doc['doc_type']]
    except KeyError:
        raise DocTypeError(doc['doc_type'])