On Apr 16, 2010, at 6:39 PM, mdipierro wrote: > I think I fixed it in trunk, please let check it.
It looks right. I'll try to make a test case. Two minor things. You added ", e" to the except clause, but e appears to be unused. Is there a reason for it? Second, while it makes no difference to the logic, I'd return None instead of False in the normal case, for aesthetic reasons. > > Massimo > > On Apr 16, 4:15 pm, Jonathan Lundell <jlund...@pobox.com> wrote: >> In admin/default, we have: >> >> def compile_app(): >> c = app_compile(request.args[0], request) >> if c: >> session.flash = T('application compiled') >> else: >> import traceback >> tb = traceback.format_exc() >> session.flash = DIV(T('Cannot compile: there are errors in your >> app:',CODE(tb))) >> redirect(URL(r=request, f='site')) >> >> It's calling this from gluon/admin: >> >> def app_compile(app, request): >> """ >> Compiles the application >> >> Parameters >> ---------- >> app: >> application name >> request: >> the global request object >> """ >> from compileapp import compile_application, remove_compiled_application >> folder = apath(app, request) >> try: >> compile_application(folder) >> return True >> except (Exception, RestrictedError): >> remove_compiled_application(folder) >> return False >> >> However, CODE(tb) appears to be always empty. I believe that's because >> traceback.format_exc() expects to find a traceback buffer on the stack, but >> since app_compile() has returned after catching the exception, the exception >> isn't on the stack any more. I think it's necessary for app_compile to >> return the traceback to the caller. >> >> -- >> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en