def replace_imp(self, account, imp_uuid, struct): ''' Replace Imp ''' try: imp = imps.imp(struct) imp.validate() imp = clean_structure(imp) except Exception, e: logging.error(e) raise e
def new_imp(self, struct): ''' New Imp ''' # if check dir fail remove directory uuid if not struct.get('has_directory', False): struct.pop('directory_uuid', None) try: imp = imps.imp(struct) imp.validate() imp = clean_structure(imp) except Exception, e: logging.error(e) raise e
def get_imp(self, account, imp_uuid): ''' Get Imp ''' message = None logging.info('{0} get imp {1}'.format(account, imp_uuid)) try: result = yield self.db.imps.find_one( {'account':account, 'uuid': imp_uuid}, {'_id':0, 'phone_2':0, 'phone_3':0, 'imp_requests':0} # remove this stuff from db. ) logging.info('{0} this is the result'.format(str(result))) if result: imp = imps.imp(result) imp.validate() message = clean_structure(imp) except Exception, e: logging.exception(e) raise e