@@ -26,8 +26,7 @@ class Command(BaseDbBackupCommand):
2626 make_option (
2727 "-d" ,
2828 "--database" ,
29- help = "Database(s) to backup specified by key separated by"
30- " commas(default: all)" ,
29+ help = "Database(s) to backup specified by key separated by commas(default: all)" ,
3130 ),
3231 make_option (
3332 "-s" ,
@@ -48,18 +47,14 @@ class Command(BaseDbBackupCommand):
4847 default = False ,
4948 help = "Encrypt the backup files" ,
5049 ),
51- make_option (
52- "-o" , "--output-filename" , default = None , help = "Specify filename on storage"
53- ),
50+ make_option ("-o" , "--output-filename" , default = None , help = "Specify filename on storage" ),
5451 make_option (
5552 "-O" ,
5653 "--output-path" ,
5754 default = None ,
5855 help = "Specify where to store on local filesystem" ,
5956 ),
60- make_option (
61- "-x" , "--exclude-tables" , default = None , help = "Exclude tables from backup"
62- ),
57+ make_option ("-x" , "--exclude-tables" , default = None , help = "Exclude tables from backup" ),
6358 make_option (
6459 "-n" ,
6560 "--schema" ,
@@ -92,9 +87,7 @@ def handle(self, **options):
9287 for database_key in self ._get_database_keys ():
9388 self .connector = get_connector (database_key )
9489 if self .connector and self .exclude_tables :
95- self .connector .exclude .extend (
96- list (self .exclude_tables .replace (" " , "" ).split ("," ))
97- )
90+ self .connector .exclude .extend (list (self .exclude_tables .replace (" " , "" ).split ("," )))
9891 database = self .connector .settings
9992 try :
10093 self ._save_new_backup (database )
@@ -106,16 +99,15 @@ def handle(self, **options):
10699 def _get_database_keys (self ):
107100 """
108101 Get the list of database keys to backup.
109-
102+
110103 Returns the databases specified by the -d/--database option,
111104 or falls back to the DBBACKUP_DATABASES setting if no option is provided.
112105 """
113106 if self .database :
114107 # Split by comma and filter out empty strings to prevent
115108 # get_connector('') from being called, which would fall back
116109 # to the 'default' database and ignore DBBACKUP_DATABASES
117- keys = [key .strip () for key in self .database .split ("," )]
118- return [key for key in keys if key ]
110+ return [key .strip () for key in self .database .split ("," ) if key .strip ()]
119111 return settings .DATABASES
120112
121113 def _save_new_backup (self , database ):
0 commit comments