|
32 | 32 | import grab
|
33 | 33 |
|
34 | 34 |
|
35 |
| -__version__ = '2016-03-12.2' |
| 35 | +__version__ = '2016-03-12.3' |
36 | 36 |
|
37 | 37 | CONTENT_DISPOSITION_FILENAME_RE = re.compile(r'^.*filename="(?P<filename>[^"]+)".*$')
|
38 | 38 | DEFAULT_PREFIX_FORMAT = r'%Y-%m-%d--%H-%M-%S-UTC_'
|
39 | 39 |
|
40 | 40 |
|
41 |
| -def download_sql_backup(url, user, password, dry_run=False, overwrite_existing=False, prepend_date=True, basename='', |
| 41 | +def download_sql_backup(url, user, password, dry_run=False, overwrite_existing=False, prepend_date=True, basename=None, |
42 | 42 | output_directory=os.getcwd(), exclude_dbs=None, compression='none', prefix_format=None,
|
43 | 43 | timeout=60, **kwargs):
|
44 | 44 | prefix_format = prefix_format or DEFAULT_PREFIX_FORMAT
|
@@ -74,7 +74,7 @@ def download_sql_backup(url, user, password, dry_run=False, overwrite_existing=F
|
74 | 74 | 'Could not determine SQL backup filename from {}'.format(g.response.headers['Content-Disposition']))
|
75 | 75 |
|
76 | 76 | content_filename = re_match.group('filename')
|
77 |
| - filename = content_filename if not basename else basename + os.path.splitext(content_filename)[1] |
| 77 | + filename = content_filename if basename is None else basename + os.path.splitext(content_filename)[1] |
78 | 78 | if prepend_date:
|
79 | 79 | prefix = datetime.datetime.utcnow().strftime(prefix_format)
|
80 | 80 | filename = prefix + filename
|
@@ -113,8 +113,9 @@ def download_sql_backup(url, user, password, dry_run=False, overwrite_existing=F
|
113 | 113 | help='comma-separated list of database names to exclude from the dump')
|
114 | 114 | parser.add_argument('--compression', default='none', choices=['none', 'zip', 'gzip'],
|
115 | 115 | help='compression method for the output file - must be supported by the server (default: %(default)s)')
|
116 |
| - parser.add_argument('--basename', |
117 |
| - help='the desired basename (without extension) of the SQL dump file (default: the name given by phpMyAdmin)') |
| 116 | + parser.add_argument('--basename', default=None, |
| 117 | + help='the desired basename (without extension) of the SQL dump file (default: the name given by phpMyAdmin); ' |
| 118 | + 'you can also set an empty basename "" in combination with --prepend-date and --prefix-format') |
118 | 119 | parser.add_argument('--timeout', type=int, default=60,
|
119 | 120 | help='timeout in seconds for the requests (default: %(default)s)')
|
120 | 121 | parser.add_argument('--overwrite-existing', action='store_true', default=False,
|
|
0 commit comments