Replace filter with any for performace gain

svn: r10847
This commit is contained in:
Gerald Britton 2008-07-07 19:50:35 +00:00
parent 3cc07e26dd
commit 4afaea5c72
3 changed files with 3 additions and 4 deletions

View File

@ -393,7 +393,7 @@ class MediaView(PageView.ListView):
the_lists = Utils.get_media_referents(handle, self.dbstate.db)
ans = DeleteMediaQuery(self.dbstate, self.uistate, handle, the_lists)
if filter(None, the_lists): # quick test for non-emptiness
if any(the_lists): # quick test for non-emptiness
msg = _('This media object is currently being used. '
'If you delete this object, it will be removed from '
'the database and from all records that reference it.')

View File

@ -204,7 +204,7 @@ class NoteView(PageView.ListView):
ans = DeleteNoteQuery(self.dbstate, self.uistate, note, the_lists)
if filter(None, the_lists): # quick test for non-emptiness
if any(the_lists): # quick test for non-emptiness
msg = _('This note is currently being used. Deleting it '
'will remove it from the database and from all '
'other objects that reference it.')

View File

@ -188,8 +188,7 @@ class SourceView(PageView.ListView):
source = db.get_source_from_handle(source_handle)
ans = DelSrcQuery(self.dbstate,self.uistate,source,the_lists)
if filter(None, the_lists): # quick test for non-emptiness
if any(the_lists): # quick test for non-emptiness
msg = _('This source is currently being used. Deleting it '
'will remove it from the database and from all '
'people and families that reference it.')