fixed admin url upload, thanks Marin
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.00.0 (2012-08-14 19:32:03) dev
|
Version 2.00.0 (2012-08-14 20:26:37) dev
|
||||||
|
|||||||
@@ -233,38 +233,39 @@ def site():
|
|||||||
|
|
||||||
elif form_update.vars.url:
|
elif form_update.vars.url:
|
||||||
# fetch an application via URL or file upload
|
# fetch an application via URL or file upload
|
||||||
if form_update.vars.url:
|
try:
|
||||||
try:
|
f = urllib.urlopen(form_update.vars.url)
|
||||||
form_update.vars.file = \
|
if f.code == 404:
|
||||||
urllib.urlopen(form_update.vars.url)
|
raise Exception("404 file not found")
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
session.flash = \
|
session.flash = \
|
||||||
DIV(T('Unable to download app because:'),PRE(str(e)))
|
DIV(T('Unable to download app because:'),PRE(str(e)))
|
||||||
redirect(URL(r=request))
|
redirect(URL(r=request))
|
||||||
fname = form_update.vars.url
|
fname = form_update.vars.url
|
||||||
|
|
||||||
elif form_update.accepted and form_update.vars.file:
|
elif form_update.accepted and form_update.vars.file:
|
||||||
fname = request.vars.file.filename
|
fname = request.vars.file.filename
|
||||||
|
f = request.vars.file.file
|
||||||
|
|
||||||
|
if f:
|
||||||
appname = cleanpath(form_update.vars.name)
|
appname = cleanpath(form_update.vars.name)
|
||||||
installed = app_install(appname, request.vars.file.file,
|
installed = app_install(appname, f,
|
||||||
request, fname,
|
request, fname,
|
||||||
overwrite=form_update.vars.overwrite)
|
overwrite=form_update.vars.overwrite)
|
||||||
if installed:
|
if f and installed:
|
||||||
msg = 'application %(appname)s installed with md5sum: %(digest)s'
|
msg = 'application %(appname)s installed with md5sum: %(digest)s'
|
||||||
if MULTI_USER_MODE:
|
if MULTI_USER_MODE:
|
||||||
db.app.insert(name=appname,owner=auth.user.id)
|
db.app.insert(name=appname,owner=auth.user.id)
|
||||||
log_progress(appname)
|
log_progress(appname)
|
||||||
session.flash = T(msg, dict(appname=appname,
|
session.flash = T(msg, dict(appname=appname,
|
||||||
digest=md5_hash(installed)))
|
digest=md5_hash(installed)))
|
||||||
elif form_update.vars.overwrite:
|
elif f and form_update.vars.overwrite:
|
||||||
msg = 'unable to install application "%(appname)s"'
|
msg = 'unable to install application "%(appname)s"'
|
||||||
session.flash = T(msg, dict(appname=form_update.vars.name))
|
session.flash = T(msg, dict(appname=form_update.vars.name))
|
||||||
|
else:
|
||||||
else:
|
msg = 'unable to install application "%(appname)s"'
|
||||||
msg = 'unable to install application "%(appname)s"'
|
session.flash = T(msg, dict(appname=form_update.vars.name))
|
||||||
session.flash = T(msg, dict(appname=form_update.vars.name))
|
redirect(URL(r=request))
|
||||||
|
|
||||||
redirect(URL(r=request))
|
|
||||||
|
|
||||||
regex = re.compile('^\w+$')
|
regex = re.compile('^\w+$')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user