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

def guplib::albums::AlbumList::search_id (   self,
  album_id 
)

Search for an album with the specified ID. Returns a new
AlbumList with the album, its parents and its immediate
children.

Definition at line 231 of file albums.py.

00231                                  :
        '''Search for an album with the specified ID. Returns a new
        AlbumList with the album, its parents and its immediate
        children.'''

        try:
            root_album = self.list[album_id]
        except KeyError:
            raise AlbumDoesntExistError

        result = AlbumList()
        result.add(root_album.album_id, root_album.name, root_album.parent)

        # add the parents
        parent = root_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

        # add the child nodes
        for child in root_album.child.itervalues():
            try:
                result.add(child.album_id, child.name, child.parent)
            except AlbumExistsError:
                pass

        return result

def _test():


Generated by  Doxygen 1.6.0   Back to index