def get(restaurant_id): certification = "" try: certification = cert_base.get(int(restaurant_id)) except BaseException as e: raise_user_exc(CERT_NOT_EXISTS_ERR, restaurant_id=restaurant_id) return {"certification": certification}
def get(restaurant_id): certification='' try: certification = cert_base.get(int(restaurant_id)) except BaseException as e: raise_user_exc(CERT_NOT_EXISTS_ERR, restaurant_id=restaurant_id) return {'certification': certification}
def processing(): args = args_parser.parse_all() status_to = int(args.get("status")) comment = args.get("comment", "") restaurant_id = int(args.get("restaurant_id")) cert = cert_base.get(restaurant_id) if status_to != CERTIFICATION_CONST.STATUS_PASSED and status_to != CERTIFICATION_CONST.STATUS_FAILED: raise_user_exc(CERT_PROC_ILL_ERR) if cert.status != CERTIFICATION_CONST.STATUS_PENDING: raise_user_exc(CERT_NOT_PENDING_ERR) cert_base.process_certification(restaurant_id, status_to) record_base.add(restaurant_id, cert.type, cert.status, status_to, comment) return ""
def processing(): args = args_parser.parse_all() status_to = int(args.get('status')) comment = args.get('comment', '') restaurant_id = int(args.get('restaurant_id')) cert = cert_base.get(restaurant_id) if status_to != CERTIFICATION_CONST.STATUS_PASSED and \ status_to != CERTIFICATION_CONST.STATUS_FAILED: raise_user_exc(CERT_PROC_ILL_ERR) if cert.status != CERTIFICATION_CONST.STATUS_PENDING: raise_user_exc(CERT_NOT_PENDING_ERR) cert_base.process_certification(restaurant_id, status_to) record_base.add(restaurant_id, cert.type, cert.status, status_to, comment) return ''
def _get_certification_with_url(restaurant_id): cert = cert_base.get(restaurant_id) file_names = ['identity_card_image_front', 'identity_card_image_back', 'health_card_image_front', 'health_card_image_back', 'license_image', 'restaurant_service_license_copy'] for file_name in file_names: obj = getattr(cert, file_name, None) if obj: try: url=file_base.get_file_url(obj, isprivate=True) if url: setattr( cert, file_name, url) except Exception as e: continue return cert
def _get_certification_with_url(restaurant_id): cert = cert_base.get(restaurant_id) file_names = [ "identity_card_image_front", "identity_card_image_back", "health_card_image_front", "health_card_image_back", "license_image", "restaurant_service_license_copy", ] for file_name in file_names: obj = getattr(cert, file_name, None) if obj: try: url = file_base.get_file_url(obj, isprivate=True) if url: setattr(cert, file_name, url) except Exception as e: continue return cert