Mercurial > p > roundup > code
diff roundup/admin.py @ 6208:74784dd531c8
Add importtables roundup-admin command.
I am surprised this doesn't exist. It's the dual of exporttables.
Output of exporttables can't be imported by import, so I am not sure
why it's useful. I can't find the sourceforge ticket that is
referenced in the creation of exporttables.
I considered trapping the error generated when import can't find file
content, but that's not a great idea as it can mask an
invalid/incorrect export and the loss of data associated with it.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 28 Jun 2020 20:16:26 -0400 |
| parents | 39513b36ca59 |
| children | 95183d73ac64 |
line wrap: on
line diff
--- a/roundup/admin.py Sat Jun 27 20:02:26 2020 -0400 +++ b/roundup/admin.py Sun Jun 28 20:16:26 2020 -0400 @@ -1345,7 +1345,7 @@ """ return self.do_export(args, export_files=False) - def do_import(self, args): + def do_import(self, args, import_files=True): ''"""Usage: import import_dir Import a database from the directory containing CSV files, two per class to import. @@ -1403,7 +1403,7 @@ # do the import and figure the current highest nodeid nodeid = cl.import_list(file_props, r) - if hasattr(cl, 'import_files'): + if hasattr(cl, 'import_files') and import_files: cl.import_files(dir, nodeid) maxid = max(maxid, int(nodeid)) @@ -1427,6 +1427,13 @@ self.db_uncommitted = True return 0 + def do_importtables(self, args): + ''"""Usage: importtables export_dir + + This imports the database tables exported using exporttables. + """ + return self.do_import(args, import_files=False) + def do_pack(self, args): ''"""Usage: pack period | date
