Exemple #1
0
 def get(cls, docid, rev=None, db=None, dynamic_properties=True):
     # copied and tweaked from the superclass's method
     if not db:
         db = cls.get_db()
     cls._allow_dynamic_properties = dynamic_properties
     # on cloudant don't get the doc back until all nodes agree
     # on the copy, to avoid race conditions
     extras = get_safe_read_kwargs()
     try:
         if cls == XFormInstance:
             doc = db.get(docid, rev=rev, **extras)
             if doc['doc_type'] in doc_types():
                 return doc_types()[doc['doc_type']].wrap(doc)
             try:
                 return XFormInstance.wrap(doc)
             except WrappingAttributeError:
                 raise ResourceNotFound(
                     "The doc with _id {} and doc_type {} can't be wrapped "
                     "as an XFormInstance".format(docid, doc['doc_type']))
         return db.get(docid, rev=rev, wrapper=cls.wrap, **extras)
     except ResourceNotFound:
         raise XFormNotFound(docid)
Exemple #2
0
def form_not_found(form_id):
    raise XFormNotFound(form_id)