FIxes in imagefield
This commit is contained in:
parent
2f3ee90e26
commit
a741e51a76
2 changed files with 15 additions and 6 deletions
|
|
@ -178,6 +178,13 @@ def start():
|
||||||
|
|
||||||
conf=conf.replace("domain_url='http://localhost:5000'", "domain_url='"+domain_url+"'")
|
conf=conf.replace("domain_url='http://localhost:5000'", "domain_url='"+domain_url+"'")
|
||||||
|
|
||||||
|
# Question about email
|
||||||
|
|
||||||
|
e_q=input('Email for site: ')
|
||||||
|
|
||||||
|
#if e_q=='':
|
||||||
|
|
||||||
|
|
||||||
#domain_url='http://localhost:8080'
|
#domain_url='http://localhost:8080'
|
||||||
|
|
||||||
with open(path_settings+'/config.py', 'w') as f:
|
with open(path_settings+'/config.py', 'w') as f:
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,10 @@ from paramecio2.libraries.db.corefields import CharField
|
||||||
from paramecio2.libraries.db.extraforms.fileform import FileForm
|
from paramecio2.libraries.db.extraforms.fileform import FileForm
|
||||||
from paramecio2.libraries.keyutils import create_key
|
from paramecio2.libraries.keyutils import create_key
|
||||||
import traceback
|
import traceback
|
||||||
|
from flask import request
|
||||||
|
from werkzeug.utils import secure_filename
|
||||||
|
|
||||||
from bottle import request
|
# from bottle import request
|
||||||
try:
|
try:
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
except:
|
except:
|
||||||
|
|
@ -63,7 +65,7 @@ class ImageField(CharField):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def check(self, value):
|
def check(self, value):
|
||||||
|
|
||||||
files_uploaded=request.files
|
files_uploaded=request.files
|
||||||
|
|
||||||
field_file=self.name+'_file'
|
field_file=self.name+'_file'
|
||||||
|
|
@ -71,7 +73,7 @@ class ImageField(CharField):
|
||||||
#if not change
|
#if not change
|
||||||
|
|
||||||
if not field_file in files_uploaded:
|
if not field_file in files_uploaded:
|
||||||
|
|
||||||
if value=='':
|
if value=='':
|
||||||
|
|
||||||
if self.model:
|
if self.model:
|
||||||
|
|
@ -111,13 +113,13 @@ class ImageField(CharField):
|
||||||
|
|
||||||
# Load image file
|
# 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:
|
try:
|
||||||
|
|
||||||
im=Image.open(file_bytecode)
|
im=Image.open(files_uploaded[field_file])
|
||||||
|
|
||||||
except IOError:
|
except IOError:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue