Skip to content

Commit

Permalink
a fix which fixes the test, but doesn't clean up databases comprehens…
Browse files Browse the repository at this point in the history
…ively
  • Loading branch information
glyph committed Jun 6, 2006
1 parent 9077347 commit cf501d0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion axiom/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,22 @@ def getItemByID(self, storeID, default=_noItem, autoUpgrade=True):
attrs = self.querySQL(self.getTableQuery(typename, version),
[storeID])
if len(attrs) != 1:
raise errors.ItemNotFound("No results for known-to-be-good object")
# there was an oid allocation row with a type set to a valid
# type, but no accompanying data row.

# there are cases where items will be deleted but their oid
# allocation rows won't be. normally this should set the type
# to -1 but upgraders or old bugs may have left the database
# in a state where it's still set.

# do cleanup if we're not in a read-only transaction (haha
# there is no such thing as a read-only transaction)
self.executeSchemaSQL(_schema.CHANGE_TYPE, [-1, storeID])

if default is _noItem:
raise KeyError()
return default

attrs = attrs[0]
useMostRecent = False
moreRecentAvailable = False
Expand Down

0 comments on commit cf501d0

Please sign in to comment.