From 4afaea5c722d5f36ce1a66abcc61cc273cf7311b Mon Sep 17 00:00:00 2001 From: Gerald Britton Date: Mon, 7 Jul 2008 19:50:35 +0000 Subject: [PATCH] Replace filter with any for performace gain svn: r10847 --- src/DataViews/MediaView.py | 2 +- src/DataViews/NoteView.py | 2 +- src/DataViews/SourceView.py | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/DataViews/MediaView.py b/src/DataViews/MediaView.py index 20e6d32fa..d5e95b9d6 100644 --- a/src/DataViews/MediaView.py +++ b/src/DataViews/MediaView.py @@ -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.') diff --git a/src/DataViews/NoteView.py b/src/DataViews/NoteView.py index 79d669f4c..101163d89 100644 --- a/src/DataViews/NoteView.py +++ b/src/DataViews/NoteView.py @@ -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.') diff --git a/src/DataViews/SourceView.py b/src/DataViews/SourceView.py index f97c18f5f..68a872696 100644 --- a/src/DataViews/SourceView.py +++ b/src/DataViews/SourceView.py @@ -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.')