fixed admin url upload, thanks Marin

This commit is contained in:
mdipierro
2012-08-14 20:26:43 -05:00
parent 57aff944b3
commit 360f778ade
2 changed files with 28 additions and 27 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.00.0 (2012-08-14 19:32:03) dev
Version 2.00.0 (2012-08-14 20:26:37) dev
+27 -26
View File
@@ -233,38 +233,39 @@ def site():
elif form_update.vars.url:
# fetch an application via URL or file upload
if form_update.vars.url:
try:
form_update.vars.file = \
urllib.urlopen(form_update.vars.url)
except Exception, e:
session.flash = \
DIV(T('Unable to download app because:'),PRE(str(e)))
redirect(URL(r=request))
fname = form_update.vars.url
try:
f = urllib.urlopen(form_update.vars.url)
if f.code == 404:
raise Exception("404 file not found")
except Exception, e:
session.flash = \
DIV(T('Unable to download app because:'),PRE(str(e)))
redirect(URL(r=request))
fname = form_update.vars.url
elif form_update.accepted and form_update.vars.file:
fname = request.vars.file.filename
f = request.vars.file.file
if f:
appname = cleanpath(form_update.vars.name)
installed = app_install(appname, request.vars.file.file,
installed = app_install(appname, f,
request, fname,
overwrite=form_update.vars.overwrite)
if installed:
msg = 'application %(appname)s installed with md5sum: %(digest)s'
if MULTI_USER_MODE:
db.app.insert(name=appname,owner=auth.user.id)
log_progress(appname)
session.flash = T(msg, dict(appname=appname,
digest=md5_hash(installed)))
elif form_update.vars.overwrite:
msg = 'unable to install application "%(appname)s"'
session.flash = T(msg, dict(appname=form_update.vars.name))
else:
msg = 'unable to install application "%(appname)s"'
session.flash = T(msg, dict(appname=form_update.vars.name))
redirect(URL(r=request))
if f and installed:
msg = 'application %(appname)s installed with md5sum: %(digest)s'
if MULTI_USER_MODE:
db.app.insert(name=appname,owner=auth.user.id)
log_progress(appname)
session.flash = T(msg, dict(appname=appname,
digest=md5_hash(installed)))
elif f and form_update.vars.overwrite:
msg = 'unable to install application "%(appname)s"'
session.flash = T(msg, dict(appname=form_update.vars.name))
else:
msg = 'unable to install application "%(appname)s"'
session.flash = T(msg, dict(appname=form_update.vars.name))
redirect(URL(r=request))
regex = re.compile('^\w+$')