def _createAndSaveDocument(self, pillow, doc): if isinstance(doc, str) or isinstance(doc, unicode): try: doc = yield DocumentChanger.transform(None, doc) except Exception as e: doc = None print "ERROR - Exception: " + str(e) if type(doc) is dict: self._throw(DocumentCache.Out.CreateAndSaveDocument, doc) else: self._throw(DocumentCache.Out.CreateAndSaveDocument, None)
def __create(self, pillow, feathers): if isinstance(feathers, str) or isinstance(feathers, unicode): try: feathers = yield DocumentChanger.transform(None, feathers) except Exception as e: feathers = None print "ERROR - Exception: " + str(e) if type(feathers) is dict: self._throw(Database.In.CreateDocument, feathers) else: self._throw(Database.In.CreateDocument, None)