FIxes in imagefield
This commit is contained in:
parent
2f3ee90e26
commit
a741e51a76
2 changed files with 15 additions and 6 deletions
|
|
@ -5,8 +5,10 @@ from paramecio2.libraries.db.corefields import CharField
|
|||
from paramecio2.libraries.db.extraforms.fileform import FileForm
|
||||
from paramecio2.libraries.keyutils import create_key
|
||||
import traceback
|
||||
from flask import request
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
from bottle import request
|
||||
# from bottle import request
|
||||
try:
|
||||
from PIL import Image
|
||||
except:
|
||||
|
|
@ -63,7 +65,7 @@ class ImageField(CharField):
|
|||
pass
|
||||
|
||||
def check(self, value):
|
||||
|
||||
|
||||
files_uploaded=request.files
|
||||
|
||||
field_file=self.name+'_file'
|
||||
|
|
@ -71,7 +73,7 @@ class ImageField(CharField):
|
|||
#if not change
|
||||
|
||||
if not field_file in files_uploaded:
|
||||
|
||||
|
||||
if value=='':
|
||||
|
||||
if self.model:
|
||||
|
|
@ -111,13 +113,13 @@ class ImageField(CharField):
|
|||
|
||||
# Load image file
|
||||
|
||||
file_bytecode=files_uploaded[field_file].file
|
||||
#file_bytecode=files_uploaded[field_file].file
|
||||
|
||||
filename=files_uploaded[field_file].filename
|
||||
filename=secure_filename(files_uploaded[field_file].filename)
|
||||
|
||||
try:
|
||||
|
||||
im=Image.open(file_bytecode)
|
||||
im=Image.open(files_uploaded[field_file])
|
||||
|
||||
except IOError:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue