def POST(self, format): cgi.maxlen = settings.MAX_UP_FILE_SIZE if not format: format = '.json' input = web.input(file={}) if input.file.file: if not is_mp3(input.file.file): return simplejson.dumps({ 'code': 1, 'error': 'Check file format and try again' }) try: info = get_mp3_info(input.file.file) info['FILENAME'] = input.file.filename except: return simplejson.dumps({ 'code': 2, 'error': 'Error getting file information' }) id = storage.save(info, input.file.file, db.master) search.update(id, info) return simplejson.dumps({'code': 0})
def process(): if request.method == 'POST': doc = json.loads(request.form.get('doc')) timestamp = request.form.get('timestamp') else: doc = json.loads(request.args.get('doc')) timestamp = request.args.get('timestamp') doc['timestamp'] = timestamp processed_doc = process_docs.process(doc, timestamp) search.update('scrapi', doc, doc['source'], doc['id']) return processed_doc
def __init__(self, vars, domains, neighbors, constraints): "Construct a CSP problem. If vars is empty, it becomes domains.keys()." vars = vars or domains.keys() update(self, vars=vars, domains=domains, neighbors=neighbors, constraints=constraints, initial=(), curr_domains=None, nassigns=0)
def POST(self): cgi.maxlen = settings.MAX_UP_FILE_SIZE input = web.input(file={}) if input.file.file: if not is_mp3(input.file.file): raise web.seeother('/upload/error') try: info = get_mp3_info(input.file.file) info['FILENAME'] = input.file.filename except: raise web.seeother('/upload/error') id = storage.save(info, input.file.file, db.master) search.update(id, info) raise web.seeother('/')
def POST(self, format): cgi.maxlen = settings.MAX_UP_FILE_SIZE if not format: format = '.json' input = web.input(file={}) if input.file.file: if not is_mp3(input.file.file): return simplejson.dumps({'code':1, 'error':'Check file format and try again'}) try: info = get_mp3_info(input.file.file) info['FILENAME'] = input.file.filename except: return simplejson.dumps({'code':2, 'error':'Error getting file information'}) id = storage.save(info, input.file.file, db.master) search.update(id, info) return simplejson.dumps({'code':0})
def run(): try: keyword = input("Insert the keyword (e.g. eclipse; main): ") extension = input("Insert the extension (e.g. mtl; ecore; java): ") search.main(keyword, extension) search.update() dictionaryManager.main() modelCreator.main_model_creator() except: search.update() search.update() dictionaryManager.main() modelCreator.main_model_creator() return 0