Skip to content

Commit

Permalink
Ignore not existent files on dbdict items
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcutme committed Sep 14, 2016
1 parent 9fd19bf commit ca2a30f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Content/ContentDbDict.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def loadItem(self, key):
content = self.site.storage.loadJson(key)
dict.__setitem__(self, key, content)
except IOError:
dict.__delitem__(self, key) # File not exists anymore
self.__delitem__(key) # File not exists anymore
raise KeyError(key)

self.addCachedKey(key)
Expand Down Expand Up @@ -81,13 +81,11 @@ def iteritems(self):
def items(self):
back = []
for key in dict.keys(self):
val = self[key]
if not val:
try:
val = self.loadItem(key)
except Exception:
self.log.error("Error loading %s: %s" % (key, err))
continue
try:
val = self[key]
except Exception:
self.log.error("Error loading %s: %s" % (key, err))
continue
back.append((key, val))
return back

Expand Down

0 comments on commit ca2a30f

Please sign in to comment.