Many fixes and docstrings
This commit is contained in:
parent
eb93be38ea
commit
dd67eafd0d
5 changed files with 118 additions and 10 deletions
|
|
@ -3,11 +3,14 @@ import sys
|
|||
from pathlib import Path
|
||||
from paramecio2.libraries.db.corefields import CharField
|
||||
from paramecio2.libraries.db.extraforms.fileform import FileForm
|
||||
from paramecio.citoplasma import httputils
|
||||
from paramecio.citoplasma.keyutils import create_key
|
||||
#from paramecio.citoplasma import httputils
|
||||
from paramecio2.libraries.keyutils import create_key
|
||||
import traceback
|
||||
|
||||
from bottle import request
|
||||
#from bottle import request
|
||||
from flask import request
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
|
||||
|
||||
from uuid import uuid4
|
||||
|
|
@ -42,15 +45,15 @@ class FileField(CharField):
|
|||
pass
|
||||
|
||||
def check(self, value):
|
||||
|
||||
files_uploaded=request.files
|
||||
|
||||
files_uploaded=request.files
|
||||
print(request.files.keys())
|
||||
field_file=self.name+'_file'
|
||||
|
||||
#if not change
|
||||
|
||||
if not field_file in files_uploaded:
|
||||
|
||||
|
||||
if value=='':
|
||||
|
||||
if self.model:
|
||||
|
|
@ -90,10 +93,10 @@ class FileField(CharField):
|
|||
|
||||
# Load image file
|
||||
|
||||
file_bytecode=files_uploaded[field_file].file
|
||||
#file_bytecode=files_uploaded[field_file].file
|
||||
|
||||
filename=secure_filename(files_uploaded[field_file].filename)
|
||||
|
||||
filename=files_uploaded[field_file].filename
|
||||
|
||||
realfilename, ext = os.path.splitext(filename)
|
||||
|
||||
prefix=''
|
||||
|
|
@ -158,6 +161,9 @@ class FileField(CharField):
|
|||
|
||||
self.model.yes_reset_conditions=old_reset
|
||||
|
||||
# Save file
|
||||
|
||||
files_uploaded[field_file].save(save_file)
|
||||
|
||||
#self.model.conditions=old_conditions
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue