Mercurial > p > roundup > code
comparison roundup/admin.py @ 8541:7a7f6ee0a09e
bug: import/importables fail to set newid correctly.
Looks like I broke import when I was fixing a scandir
issue. Overindented a couple of lines. This prevented the next used id
from being set properly.
It also resulted in wierd output when importing (bunches of newlines).
Also fixed the two export/import tests to verify the new nextid for
all the classes is equal or higher than the old one. Ideally they
should be equal, but there is a bug somewhere where we get a double
increment in the export/import cycle dropping a number or two.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 23 Mar 2026 22:22:24 -0400 |
| parents | e8d1da6e3571 |
| children | f80c566f5726 |
comparison
equal
deleted
inserted
replaced
| 8540:e8d1da6e3571 | 8541:7a7f6ee0a09e |
|---|---|
| 1315 with open(filepath, 'r') as f: | 1315 with open(filepath, 'r') as f: |
| 1316 reader = csv.reader(f, csv_format_class, lineterminator='\n') | 1316 reader = csv.reader(f, csv_format_class, lineterminator='\n') |
| 1317 file_props = None | 1317 file_props = None |
| 1318 # loop through the file and create a node for each entry | 1318 # loop through the file and create a node for each entry |
| 1319 for n, r in enumerate(reader): | 1319 for n, r in enumerate(reader): |
| 1320 # read the file header | |
| 1320 if file_props is None: | 1321 if file_props is None: |
| 1321 file_props = r | 1322 file_props = r |
| 1322 continue | 1323 continue |
| 1323 | 1324 |
| 1324 if self.verbose: | 1325 if self.verbose: |
| 1328 | 1329 |
| 1329 # do the import and figure the current highest nodeid | 1330 # do the import and figure the current highest nodeid |
| 1330 nodeid = hyperdb_class.import_list(file_props, r) | 1331 nodeid = hyperdb_class.import_list(file_props, r) |
| 1331 if hasattr(hyperdb_class, 'import_files') and import_files: | 1332 if hasattr(hyperdb_class, 'import_files') and import_files: |
| 1332 hyperdb_class.import_files(import_dir, nodeid) | 1333 hyperdb_class.import_files(import_dir, nodeid) |
| 1333 maxid = max(maxid, int(nodeid)) | 1334 |
| 1334 | 1335 maxid = max(maxid, int(nodeid)) |
| 1335 # (print to sys.stdout here to allow tests to squash it .. ugh) | 1336 |
| 1336 print(file=sys.stdout) | 1337 # (print to sys.stdout here to allow tests to squash it .. ugh) |
| 1338 print(file=sys.stdout) | |
| 1337 | 1339 |
| 1338 return maxid | 1340 return maxid |
| 1339 | 1341 |
| 1340 def do_importtables(self, args): | 1342 def do_importtables(self, args): |
| 1341 ''"""Usage: importtables export_dir | 1343 ''"""Usage: importtables export_dir |
