← Back to team overview

openlp-core team mailing list archive

Re: [Merge] lp:~googol-hush/openlp/trivial into lp:openlp

 

Like Tim said, rather let the database do your work for you:

from sqlalchemy.sql import and_

def checkAuthor(self, new_author, edit=False):
    """
    Returns True when the given Author is already in the list elsewise False.
    """
    authors = self.songmanager.get_objects_filtered(Author,
        and_(
            Author.first_name == new_author.first_name,
            Author.last_name == new_author.last_name,
            Author.display_name == new_author.display_name
        )
    )
    return edit or (len(authors) > 0)

-- 
https://code.launchpad.net/~googol-hush/openlp/trivial/+merge/29642
Your team OpenLP Core is subscribed to branch lp:openlp.



References