Replace filter with any for performace gain
svn: r10847
This commit is contained in:
parent
3cc07e26dd
commit
4afaea5c72
@ -393,7 +393,7 @@ class MediaView(PageView.ListView):
|
|||||||
the_lists = Utils.get_media_referents(handle, self.dbstate.db)
|
the_lists = Utils.get_media_referents(handle, self.dbstate.db)
|
||||||
|
|
||||||
ans = DeleteMediaQuery(self.dbstate, self.uistate, handle, the_lists)
|
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. '
|
msg = _('This media object is currently being used. '
|
||||||
'If you delete this object, it will be removed from '
|
'If you delete this object, it will be removed from '
|
||||||
'the database and from all records that reference it.')
|
'the database and from all records that reference it.')
|
||||||
|
@ -204,7 +204,7 @@ class NoteView(PageView.ListView):
|
|||||||
|
|
||||||
ans = DeleteNoteQuery(self.dbstate, self.uistate, note, the_lists)
|
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 '
|
msg = _('This note is currently being used. Deleting it '
|
||||||
'will remove it from the database and from all '
|
'will remove it from the database and from all '
|
||||||
'other objects that reference it.')
|
'other objects that reference it.')
|
||||||
|
@ -188,8 +188,7 @@ class SourceView(PageView.ListView):
|
|||||||
source = db.get_source_from_handle(source_handle)
|
source = db.get_source_from_handle(source_handle)
|
||||||
|
|
||||||
ans = DelSrcQuery(self.dbstate,self.uistate,source,the_lists)
|
ans = DelSrcQuery(self.dbstate,self.uistate,source,the_lists)
|
||||||
|
if any(the_lists): # quick test for non-emptiness
|
||||||
if filter(None, the_lists): # quick test for non-emptiness
|
|
||||||
msg = _('This source is currently being used. Deleting it '
|
msg = _('This source is currently being used. Deleting it '
|
||||||
'will remove it from the database and from all '
|
'will remove it from the database and from all '
|
||||||
'people and families that reference it.')
|
'people and families that reference it.')
|
||||||
|
Loading…
Reference in New Issue
Block a user