def upload_catalog(self, uploaded_file): ''' End-point for uploading user catalogs ''' try: res = libraries.handle_uploaded_catalog(cherrypy.db, uploaded_file) return res except zipfile.BadZipfile as e: return 'Error during file unzipping :: {}'.format(e) except simplejson.JSONDecodeError as e: return 'Error in JSONDecode :: {}'.format(e) except Exception as e: print traceback.print_exc() return 'oooops, error!'
def upload_catalog_json(self, uploaded_file): ''' End-point for uploading user catalogs in json format Mostly for testing purposes ''' try: res = libraries.handle_uploaded_catalog(cherrypy.db, uploaded_file, zipped=False) return res except simplejson.JSONDecodeError as e: return 'Error in JSONDecode :: {}'.format(e) except Exception as e: print traceback.print_exc() return 'oooops, error!'