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:
|
elif form_create.accepted:
|
||||||
# create a new application
|
# create a new application
|
||||||
appname = cleanpath(form_create.vars.name)
|
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:
|
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)
|
||||||
@@ -214,8 +215,8 @@ def site():
|
|||||||
redirect(URL('design',args=appname))
|
redirect(URL('design',args=appname))
|
||||||
else:
|
else:
|
||||||
session.flash = \
|
session.flash = \
|
||||||
T('unable to create application "%s" (it may exist already)',
|
DIV(T('unable to create application "%s"' % appname),
|
||||||
form_create.vars.name)
|
PRE(error))
|
||||||
redirect(URL(r=request))
|
redirect(URL(r=request))
|
||||||
|
|
||||||
elif form_update.accepted:
|
elif form_update.accepted:
|
||||||
|
|||||||
@@ -83,8 +83,8 @@
|
|||||||
<div class="box">
|
<div class="box">
|
||||||
<h3>{{=T("Multi User Mode")}}</h3>
|
<h3>{{=T("Multi User Mode")}}</h3>
|
||||||
<p>
|
<p>
|
||||||
{{=button(URL('bulk_register'),T('Bulk Register'))}}
|
{{=button(URL('bulk_register'),T('Bulk Register'))}}
|
||||||
{{=button(URL('manage_students'),T('Manage Students'))}}
|
{{=button(URL('manage_students'),T('Manage Students'))}}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{{pass}}
|
{{pass}}
|
||||||
@@ -135,15 +135,13 @@
|
|||||||
{{=form_update.custom.end}}
|
{{=form_update.custom.end}}
|
||||||
</div>
|
</div>
|
||||||
<!-- DEPLOY ON GAE -->
|
<!-- DEPLOY ON GAE -->
|
||||||
{{if not MULTI_USER_MODE or is_manager():}}
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<h3>{{=T("Deploy")}}</h3>
|
<h3>{{=T("Deploy")}}</h3>
|
||||||
<p>
|
<p>
|
||||||
{{=button(URL('gae','deploy'), T('Deploy on Google App Engine'))}}
|
{{=button(URL('gae','deploy'), T('Deploy on Google App Engine'))}}
|
||||||
{{=button(URL('openshift','deploy'),T('Deploy to OpenShift'))}}
|
{{=button(URL('openshift','deploy'),T('Deploy to OpenShift'))}}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div><br/>
|
||||||
{{pass}}
|
|
||||||
{{if TWITTER_HASH:}}
|
{{if TWITTER_HASH:}}
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<h3>{{=T("%s Recent Tweets"%TWITTER_HASH)}}</h3>
|
<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 fileutils import read_file, write_file, parse_version
|
||||||
from restricted import RestrictedError
|
from restricted import RestrictedError
|
||||||
from settings import global_settings
|
from settings import global_settings
|
||||||
|
from http import HTTP
|
||||||
|
|
||||||
if not global_settings.web2py_runtime_gae:
|
if not global_settings.web2py_runtime_gae:
|
||||||
import site
|
import site
|
||||||
@@ -157,7 +158,7 @@ def app_compile(app, request):
|
|||||||
remove_compiled_application(folder)
|
remove_compiled_application(folder)
|
||||||
return tb
|
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
|
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
|
the global request object
|
||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
path = apath(app, request)
|
||||||
path = apath(app, request)
|
if not os.path.exists(path):
|
||||||
os.mkdir(path)
|
try:
|
||||||
except:
|
os.mkdir(path)
|
||||||
if not force:
|
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
|
return False
|
||||||
try:
|
try:
|
||||||
w2p_unpack('welcome.w2p', path)
|
w2p_unpack('welcome.w2p', path)
|
||||||
@@ -189,10 +198,16 @@ def app_create(app, request,force=False,key=None):
|
|||||||
data = data.replace('<your secret key>',
|
data = data.replace('<your secret key>',
|
||||||
'sha512:'+(key or web2py_uuid()))
|
'sha512:'+(key or web2py_uuid()))
|
||||||
write_file(db, data)
|
write_file(db, data)
|
||||||
return True
|
if info:
|
||||||
|
return True, None
|
||||||
|
else:
|
||||||
|
return True
|
||||||
except:
|
except:
|
||||||
rmtree(path)
|
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):
|
def app_install(app, fobj, request, filename, overwrite=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user