hi,
is it possible to backup web2py application from controller (not from
appadmin)?
i'm trying before and it return an error :
Error snapshot [image: help]
<https://127.0.0.1/admin/default/ticket/lgc/127.0.0.1.2015-03-14.08-12-07.5b9f28ea-1143-4106-b01b-b1bb67fb4bd7#>
<type 'exceptions.WindowsError'>([Error 32] The process cannot access the
file because it is being used by another process:
'C:/web2py/applications/test/sessions/04e\\058\\127.0.0.1-04210647-8180-4e13-8751-2c18b5622969')
code :
*controllers/admin.py*
from gluon.admin import *
def get_app(name=None):
app = name or request.args(0)
if (app and os.path.exists(apath(app, r=request)) and
(not MULTI_USER_MODE or is_manager() or
db(db.app.name == app)(db.app.owner == auth.user.id).count())):
return app
session.flash = T('App does not exist or you are not authorized')
redirect(URL('site'))
def backup():
#app = get_app()
app = request.application
fname = 'web2py.app.%s.w2p' % app
filename = app_pack(app, request, raise_ex=True)
response.headers['Content-Type'] = 'application/w2p'
disposition = 'attachment; filename=%s' % fname
response.headers['Content-Disposition'] = disposition
return safe_read(filename, 'rb')
"""
try:
if len(request.args) == 1:
fname = 'web2py.app.%s.w2p' % app
filename = app_pack(app, request, raise_ex=True)
else:
fname = 'web2py.app.%s.compiled.w2p' % app
filename = app_pack_compiled(app, request, raise_ex=True)
except Exception, e:
filename = None
if filename:
response.headers['Content-Type'] = 'application/w2p'
disposition = 'attachment; filename=%s' % fname
response.headers['Content-Disposition'] = disposition
return safe_read(filename, 'rb')
else:
session.flash = T('internal error: %s', e)
redirect(URL('site'))
"""
thanks and best regards,
stifan
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.