Commit 8542fe7d authored by Marc Duez's avatar Marc Duez
Browse files

server : sequence file size are stored as integer

parent c35278be
# coding: utf8 # coding: utf8
import gluon.contrib.simplejson import gluon.contrib.simplejson
import os.path import os.path
import defs
if request.env.http_origin: if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true' response.headers['Access-Control-Allow-Credentials'] = 'true'
...@@ -29,7 +29,7 @@ def repair_missing_files(): ...@@ -29,7 +29,7 @@ def repair_missing_files():
db.sequence_file[row.id] = dict(data_file = None) db.sequence_file[row.id] = dict(data_file = None)
flist += " : " + row.filename flist += " : " + row.filename
else : else :
size = defs.format_size(os.path.getsize(seq_file)) size = os.path.getsize(seq_file)
db.sequence_file[row.id] = dict(size_file = size) db.sequence_file[row.id] = dict(size_file = size)
res = {"success" : "true", "message" : "path of missing files have been removed from the database"+flist} res = {"success" : "true", "message" : "path of missing files have been removed from the database"+flist}
......
...@@ -130,7 +130,7 @@ def upload(): ...@@ -130,7 +130,7 @@ def upload():
mes = f.filename + ": upload finished" mes = f.filename + ": upload finished"
seq_file = defs.DIR_SEQUENCES+db.sequence_file[request.vars["id"]].data_file seq_file = defs.DIR_SEQUENCES+db.sequence_file[request.vars["id"]].data_file
size = vidjil_utils.format_size(os.path.getsize(seq_file)) size = os.path.getsize(seq_file)
db.sequence_file[request.vars["id"]] = dict(size_file = size) db.sequence_file[request.vars["id"]] = dict(size_file = size)
res = {"message": mes} res = {"message": mes}
......
...@@ -113,7 +113,8 @@ db.define_table('sequence_file', ...@@ -113,7 +113,8 @@ db.define_table('sequence_file',
Field('pcr','text'), Field('pcr','text'),
Field('sequencer','text'), Field('sequencer','text'),
Field('producer','text'), Field('producer','text'),
Field('size_file','text'), Field('size_file','integer', default=0),
Field('provider','reference auth_user'),
Field('data_file', 'upload', Field('data_file', 'upload',
uploadfolder=defs.DIR_SEQUENCES, uploadfolder=defs.DIR_SEQUENCES,
length=1000000000000, autodelete=True)) length=1000000000000, autodelete=True))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment