diff roundup/backends/back_anydbm.py @ 7393:9e612a39547a

Make anydbm indexer handle missing items the same as rdbms backend The anydbm Class::index() method was capturing the IndexError rather than letting it bubble up. This is different from the rdbms backends. In implementing batch/incremental indexing via roundup-admin, I wanted to report any missing items that were specified in the batch. This worked by capturing the IndexError. It worked with rdbms backends but not anydbm. This change makes it work with anydbm as well. Focused testing doesn't show any regressions, so committing the change.
author John Rouillard <rouilj@ieee.org>
date Wed, 24 May 2023 11:44:35 -0400
parents 506c86823abb
children 82bbb95e5690 c8c4514f4c3e
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py	Wed May 24 11:25:47 2023 -0400
+++ b/roundup/backends/back_anydbm.py	Wed May 24 11:44:35 2023 -0400
@@ -2070,12 +2070,8 @@
         for prop, propclass in self.getprops().items():
             if isinstance(propclass, hyperdb.String) and propclass.indexme:
                 # index them under (classname, nodeid, property)
-                try:
-                    value = str(self.get(nodeid, prop))
-                except IndexError:
-                    # node has been destroyed
-                    continue
-                self.db.indexer.add_text((self.classname, nodeid, prop), value)
+                self.db.indexer.add_text((self.classname, nodeid, prop),
+                                         str(self.get(nodeid, prop)))
 
     #
     # import / export support

Roundup Issue Tracker: http://roundup-tracker.org/