Logo Search packages:      
Sourcecode: gallery-uploader version File versions  Download package

def guplib::albums::AlbumList::search_name (   self,
  name 
)

Search for albums with the specified name. Returns a new
AlbumList object with the albums that have the searched name and
their parents. If no album could be found, a
"AlbumDoesntExistError" is thrown.

Definition at line 191 of file albums.py.

00191                                :
        '''Search for albums with the specified name. Returns a new
        AlbumList object with the albums that have the searched name and
        their parents. If no album could be found, a
        "AlbumDoesntExistError" is thrown.'''

        # build a list of albums with the searched name
        albums_found = []
        name = name.upper()
        for album_info in self.list.itervalues():
            if name in album_info.name.upper():
                albums_found.append(album_info)

        if len(albums_found) == 0:
            raise AlbumDoesntExistError

        # now we create a new AlbumList and put the albums there. It should
        # take care of building the tree by itself.
        result = AlbumList()
        for album in albums_found:
            try:
                result.add(album.album_id, album.name, album.parent)
            except AlbumExistsError:
                pass

            # add the parents!
            parent = album.parent
            while parent != 0:
                parent_album = self.list[parent]

                try:
                    result.add(parent_album.album_id, parent_album.name,
                            parent_album.parent)
                except AlbumExistsError:
                    pass

                parent = parent_album.parent

        return result

    def search_id(self, album_id):


Generated by  Doxygen 1.6.0   Back to index