Refactor code for readability and compatibility.
This commit is contained in:
parent
a09835049b
commit
c6d9c0619e
43 changed files with 129 additions and 112 deletions
|
|
@ -409,6 +409,7 @@ class ObjectDBManager(TypedObjectManager):
|
|||
try:
|
||||
matches = [matches[match_number]]
|
||||
except IndexError:
|
||||
# match number not matching anything
|
||||
pass
|
||||
# return a list (possibly empty)
|
||||
return matches
|
||||
|
|
|
|||
|
|
@ -242,12 +242,14 @@ class ObjectDB(TypedObject):
|
|||
return
|
||||
elif loc == self:
|
||||
raise RuntimeError
|
||||
elif loc == None:
|
||||
elif loc is None:
|
||||
raise RuntimeWarning
|
||||
return is_loc_loop(loc.db_location, depth + 1)
|
||||
try:
|
||||
is_loc_loop(location)
|
||||
except RuntimeWarning:
|
||||
# we caught a infitite location loop!
|
||||
# (location1 is in location2 which is in location1 ...)
|
||||
pass
|
||||
|
||||
# if we get to this point we are ready to change location
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class ObjectSessionHandler(object):
|
|||
if sessid:
|
||||
sessions = [_SESSIONS[sessid] if sessid in _SESSIONS else None] if sessid in self._sessid_cache else []
|
||||
else:
|
||||
sessions = [_SESSIONS[sessid] if sessid in _SESSIONS else None for sessid in self._sessid_cache]
|
||||
sessions = [_SESSIONS[ssid] if ssid in _SESSIONS else None for ssid in self._sessid_cache]
|
||||
if None in sessions:
|
||||
# this happens only if our cache has gone out of sync with the SessionHandler.
|
||||
self._recache()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue