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

def guplib::albums::AlbumList::add (   self,
  album_id,
  album_name,
  album_parent 
)

Add an album to the list.

album_id - ID of the album
album_name - Name of the album
album_parent - ID of this album parent

The parent doesn't need to exist before adding the album. If the
parent can't be found, it album will stay on an "orphan" list till
the parent is added.

Definition at line 88 of file albums.py.

00088                                                      :
        '''Add an album to the list.
        
        album_id - ID of the album
        album_name - Name of the album
        album_parent - ID of this album parent
        
        The parent doesn't need to exist before adding the album. If the
        parent can't be found, it album will stay on an "orphan" list till
        the parent is added.'''
        logging.debug('Adding album "%s", id "%s", parent "%s"' % \
                (album_name, album_id, album_parent))
        if self.list.has_key(album_id):
            raise AlbumExistsError

        album_info = Album(album_id, album_name, album_parent)

        # add in the tree
        try:
            album_pos = self.list[album_parent]
        except KeyError:
            # if the parent couldn't be found, we add the child
            # in a list, waiting for a parent to appear and pick
            # them up (and take them to the mall)
            logging.debug('Missing parent: %s', album_parent)
            try:
                self.missing_parents[album_parent].append(album_info)
            except KeyError:
                self.missing_parents[album_parent] = [album_info]
            return

        album_pos.child[album_id] = album_info

        # add in the quick search list
        self.list[album_id] = album_info

        # just check if the kids are waiting
        if self.missing_parents.has_key(album_id):
            logging.debug('New album is a parent: %d childs' % \
                    len(self.missing_parents[album_id]))
            for child in self.missing_parents[album_id]:
                self.add(child.album_id, child.name, child.parent)

    def get_name(self, album_id):


Generated by  Doxygen 1.6.0   Back to index