Refactor to use list comprehension instead of filter() for future py3 compatibility.

This commit is contained in:
Griatch 2017-01-10 18:31:21 +01:00
parent 5a4dbea3bb
commit 9d714a9c55

View file

@ -85,7 +85,8 @@ class ScriptDBManager(TypedObjectManager):
script = []
dbref = self.dbref(key)
if dbref or dbref == 0:
script = filter(None, [self.dbref_search(dbref)])
# return either [] or a valid list (never [None])
script = [res for res in [self.dbref_search(dbref)] if res]
if not script:
script = self.filter(db_key=key)
return script