annotate MoinMoin/action/backup.py @ 2489:fabbb4dbd99e

Merge devel.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Sun, 22 Jul 2007 03:27:45 +0200
parents bb76818db210
children 388204baf00f
rev   line source
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
2 """
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
3 MoinMoin - make or restore a full backup of the wiki
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
4
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
5 Triggering backup action will check if you are authorized to do
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
6 a backup and if yes, just send a
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
7 <siteid>-<date>--<time>.tar.<format> to you.
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
8
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
9 @copyright: 2005 by MoinMoin:ThomasWaldmann
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
10 @license: GNU GPL, see COPYING for details.
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
11 """
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
12
2174
f5f4dbbd0c51 added tarfile.py from py 2.5.1 (backported to work with py 2.3/2.4), fix imports to use it for tests/backup (ported from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1791
diff changeset
13 import os, re, time
1791
6dd2e29acffe Eclipse PyDev Check: fixed lots of its errors and warnings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1777
diff changeset
14
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
15 from MoinMoin import wikiutil
2174
f5f4dbbd0c51 added tarfile.py from py 2.5.1 (backported to work with py 2.3/2.4), fix imports to use it for tests/backup (ported from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1791
diff changeset
16 from MoinMoin.support import tarfile
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
17
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
18 def addFiles(path, tar, exclude):
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
19 """ Add files in path to tar """
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
20 for root, dirs, files in os.walk(path):
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
21 files.sort() # sorted page revs may compress better
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
22 for name in files:
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
23 path = os.path.join(root, name)
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
24 if exclude.search(path):
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
25 continue
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
26 tar.add(path)
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
27
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
28 def sendBackup(request):
949
cbbde07e00c4 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 617
diff changeset
29 """ Send compressed tar file """
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
30 dateStamp = time.strftime("%Y-%m-%d--%H-%M-%S-UTC", time.gmtime())
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
31 filename = "%s-%s.tar.%s" % (request.cfg.siteid, dateStamp, request.cfg.backup_compression)
1068
ecece5db5288 use emit_http_headers
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 949
diff changeset
32 request.emit_http_headers([
949
cbbde07e00c4 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 617
diff changeset
33 "Content-Type: application/octet-stream",
cbbde07e00c4 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 617
diff changeset
34 "Content-Disposition: inline; filename=\"%s\"" % filename, ])
cbbde07e00c4 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 617
diff changeset
35
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
36 tar = tarfile.open(fileobj=request, mode="w|%s" % request.cfg.backup_compression)
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2174
diff changeset
37 # allow GNU tar's longer file/pathnames
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
38 tar.posix = False
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
39 exclude = re.compile("|".join(request.cfg.backup_exclude))
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
40 for path in request.cfg.backup_include:
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
41 addFiles(path, tar, exclude)
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
42 tar.close()
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
43
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
44 def restoreBackup(request, pagename):
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
45 _ = request.getText
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
46 path = request.cfg.backup_storage_dir
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
47 filename = "%s.tar.%s" % (request.cfg.siteid, request.cfg.backup_compression)
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
48 filename = os.path.join(path, filename)
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
49 targetdir = request.cfg.backup_restore_target_dir
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
50 try:
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
51 tar = tarfile.open(fileobj=file(filename), mode="r|%s" % request.cfg.backup_compression)
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2174
diff changeset
52 # allow GNU tar's longer file/pathnames
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
53 tar.posix = False
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
54 files = []
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
55 dirs = []
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
56 for m in tar:
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
57 if m.isdir():
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
58 dirs.append("%s %s %s" % (m.name, m.size, m.mtime))
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
59 else:
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
60 files.append("%s %s %s" % (m.name, m.size, m.mtime))
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
61 tar.extract(m, targetdir)
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
62 tar.close()
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
63 #files = "<br>".join(files)
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
64 filecount = len(files)
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
65 dircount = len(dirs)
2293
bb76818db210 i18n fixes, mostly _('aa'%xx) -> _('aa')%xx
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2286
diff changeset
66 return sendMsg(request, pagename,
bb76818db210 i18n fixes, mostly _('aa'%xx) -> _('aa')%xx
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2286
diff changeset
67 msg=_('Restored Backup: %(filename)s to target dir: %(targetdir)s.\nFiles: %(filecount)d, Directories: %(dircount)d') %
bb76818db210 i18n fixes, mostly _('aa'%xx) -> _('aa')%xx
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2286
diff changeset
68 locals())
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
69 except:
2293
bb76818db210 i18n fixes, mostly _('aa'%xx) -> _('aa')%xx
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2286
diff changeset
70 return sendMsg(request, pagename, msg=_("Restoring backup: %(filename)s to target dir: %(targetdir)s failed.") % locals())
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
71
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
72 def sendBackupForm(request, pagename):
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
73 _ = request.getText
1068
ecece5db5288 use emit_http_headers
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 949
diff changeset
74 request.emit_http_headers()
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
75 request.setContentLanguage(request.lang)
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
76 title = _('Wiki Backup / Restore')
616
3b08d9413589 move send_title/footer from wikiutil to theme.__init__
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 391
diff changeset
77 request.theme.send_title(title, form=request.form, pagename=pagename)
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
78 request.write(request.formatter.startContent("content"))
949
cbbde07e00c4 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 617
diff changeset
79
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
80 request.write(_("""Some hints:
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
81 * To restore a backup:
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
82 * Restoring a backup will overwrite existing data, so be careful.
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
83 * Rename it to <siteid>.tar.<compression> (remove the --date--time--UTC stuff).
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
84 * Put the backup file into the backup_storage_dir (use scp, ftp, ...).
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
85 * Hit the [[GetText(Restore)]] button below.
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
86
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
87 * To make a backup, just hit the [[GetText(Backup)]] button and save the file
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
88 you get to a secure place.
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
89
122
f5f443df60cb remove non-working code from backup action
Thomas Waldmann <tw@waldmann-edv.de>
parents: 99
diff changeset
90 Please make sure your wiki configuration backup_* values are correct and complete.
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
91
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
92 """))
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
93
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
94 request.write("""
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
95 <form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
96 <input type="hidden" name="action" value="backup">
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
97 <input type="hidden" name="do" value="backup">
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
98 <input type="submit" value="%(backup_button)s">
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
99 </form>
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
100
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
101 <form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
102 <input type="hidden" name="action" value="backup">
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
103 <input type="hidden" name="do" value="restore">
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
104 <input type="submit" value="%(restore_button)s">
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
105 </form>
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
106 """ % {
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
107 'baseurl': request.getScriptname(),
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
108 'pagename': wikiutil.quoteWikinameURL(pagename),
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
109 'backup_button': _('Backup'),
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
110 'restore_button': _('Restore'),
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
111 })
949
cbbde07e00c4 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 617
diff changeset
112
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
113 request.write(request.formatter.endContent())
616
3b08d9413589 move send_title/footer from wikiutil to theme.__init__
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 391
diff changeset
114 request.theme.send_footer(pagename)
617
cf420addd95c removed MoinMoinNoFooter at many places, added call to theme.send_closing_html() where needed
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 616
diff changeset
115 request.theme.send_closing_html()
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
116
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
117 def sendMsg(request, pagename, msg):
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
118 from MoinMoin import Page
1777
ed44b93599b5 remove unneeded request param from page.send_page()
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
119 return Page.Page(request, pagename).send_page(msg=msg)
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
120
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
121 def backupAllowed(request):
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
122 """ Return True if backup is allowed """
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
123 action = __name__.split('.')[-1]
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
124 user = request.user
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
125 return (action not in request.cfg.actions_excluded and
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
126 user.valid and user.name in request.cfg.backup_users)
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
127
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
128 def execute(pagename, request):
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
129 _ = request.getText
949
cbbde07e00c4 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 617
diff changeset
130 if not backupAllowed(request):
cbbde07e00c4 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 617
diff changeset
131 return sendMsg(request, pagename,
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
132 msg=_('You are not allowed to do remote backup.'))
949
cbbde07e00c4 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 617
diff changeset
133
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
134 dowhat = request.form.get('do', [None])[0]
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
135 if dowhat == 'backup':
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
136 sendBackup(request)
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
137 elif dowhat == 'restore':
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
138 restoreBackup(request, pagename)
949
cbbde07e00c4 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 617
diff changeset
139 elif dowhat is None:
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
140 sendBackupForm(request, pagename)
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
141 else:
949
cbbde07e00c4 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 617
diff changeset
142 return sendMsg(request, pagename,
2293
bb76818db210 i18n fixes, mostly _('aa'%xx) -> _('aa')%xx
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2286
diff changeset
143 msg=_('Unknown backup subaction: %s.') % dowhat)