better error reporing on app_create failures
This commit is contained in:
@@ -1 +1 @@
|
||||
Version 2.00.0 (2012-08-24 16:36:11) dev
|
||||
Version 2.00.0 (2012-08-24 17:05:15) dev
|
||||
|
||||
@@ -206,7 +206,8 @@ def site():
|
||||
elif form_create.accepted:
|
||||
# create a new application
|
||||
appname = cleanpath(form_create.vars.name)
|
||||
if app_create(appname, request):
|
||||
created, error = app_create(appname, request,info=True)
|
||||
if created:
|
||||
if MULTI_USER_MODE:
|
||||
db.app.insert(name=appname,owner=auth.user.id)
|
||||
log_progress(appname)
|
||||
@@ -214,8 +215,8 @@ def site():
|
||||
redirect(URL('design',args=appname))
|
||||
else:
|
||||
session.flash = \
|
||||
T('unable to create application "%s" (it may exist already)',
|
||||
form_create.vars.name)
|
||||
DIV(T('unable to create application "%s"' % appname),
|
||||
PRE(error))
|
||||
redirect(URL(r=request))
|
||||
|
||||
elif form_update.accepted:
|
||||
|
||||
@@ -83,8 +83,8 @@
|
||||
<div class="box">
|
||||
<h3>{{=T("Multi User Mode")}}</h3>
|
||||
<p>
|
||||
{{=button(URL('bulk_register'),T('Bulk Register'))}}
|
||||
{{=button(URL('manage_students'),T('Manage Students'))}}
|
||||
{{=button(URL('bulk_register'),T('Bulk Register'))}}
|
||||
{{=button(URL('manage_students'),T('Manage Students'))}}
|
||||
</p>
|
||||
</div>
|
||||
{{pass}}
|
||||
@@ -135,15 +135,13 @@
|
||||
{{=form_update.custom.end}}
|
||||
</div>
|
||||
<!-- DEPLOY ON GAE -->
|
||||
{{if not MULTI_USER_MODE or is_manager():}}
|
||||
<div class="box">
|
||||
<h3>{{=T("Deploy")}}</h3>
|
||||
<p>
|
||||
{{=button(URL('gae','deploy'), T('Deploy on Google App Engine'))}}
|
||||
{{=button(URL('openshift','deploy'),T('Deploy to OpenShift'))}}
|
||||
</p>
|
||||
</div>
|
||||
{{pass}}
|
||||
</div><br/>
|
||||
{{if TWITTER_HASH:}}
|
||||
<div class="box">
|
||||
<h3>{{=T("%s Recent Tweets"%TWITTER_HASH)}}</h3>
|
||||
|
||||
+23
-8
@@ -18,6 +18,7 @@ from fileutils import up, fix_newlines, abspath, recursive_unlink
|
||||
from fileutils import read_file, write_file, parse_version
|
||||
from restricted import RestrictedError
|
||||
from settings import global_settings
|
||||
from http import HTTP
|
||||
|
||||
if not global_settings.web2py_runtime_gae:
|
||||
import site
|
||||
@@ -157,7 +158,7 @@ def app_compile(app, request):
|
||||
remove_compiled_application(folder)
|
||||
return tb
|
||||
|
||||
def app_create(app, request,force=False,key=None):
|
||||
def app_create(app, request,force=False,key=None,info=False):
|
||||
"""
|
||||
Create a copy of welcome.w2p (scaffolding) app
|
||||
|
||||
@@ -169,11 +170,19 @@ def app_create(app, request,force=False,key=None):
|
||||
the global request object
|
||||
|
||||
"""
|
||||
try:
|
||||
path = apath(app, request)
|
||||
os.mkdir(path)
|
||||
except:
|
||||
if not force:
|
||||
path = apath(app, request)
|
||||
if not os.path.exists(path):
|
||||
try:
|
||||
os.mkdir(path)
|
||||
except:
|
||||
if info:
|
||||
return False, traceback.format_exc(sys.exc_info)
|
||||
else:
|
||||
return False
|
||||
elif not force:
|
||||
if info:
|
||||
return False, "Application exists"
|
||||
else:
|
||||
return False
|
||||
try:
|
||||
w2p_unpack('welcome.w2p', path)
|
||||
@@ -189,10 +198,16 @@ def app_create(app, request,force=False,key=None):
|
||||
data = data.replace('<your secret key>',
|
||||
'sha512:'+(key or web2py_uuid()))
|
||||
write_file(db, data)
|
||||
return True
|
||||
if info:
|
||||
return True, None
|
||||
else:
|
||||
return True
|
||||
except:
|
||||
rmtree(path)
|
||||
return False
|
||||
if info:
|
||||
return False, traceback.format_exc(sys.exc_info)
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def app_install(app, fobj, request, filename, overwrite=None):
|
||||
|
||||
Reference in New Issue
Block a user