Пример #1
0
    def add_photo(self, comp):
        r = comp.call(PhotoCreator())
        if r is not None:
            (title, img) = r

            gallery = GalleryData.get_by(name=self.name)
            gallery.photos.append(PhotoData(title=title, img=img, thumbnail=thumb.thumbnail(img)))
Пример #2
0
    def add_photo(self, comp):
        """This method temporary replaces the Gallery component by a PhotoCreator
           component. Upon submission of a photo, the PhotoCreator answers with
           the title and the uploaded image"""

        # Change the Gallery by a PhotoCreator component
        r = comp.call(PhotoCreator())

        if r is not None:
            # If the user click on the the "Cancel" button, we receive ``None``
            # else we receive the title and the uploaded image
            (title, img) = r

            # Insert these data into the database
            gallery = GalleryData.get_by(name=self.name)
            gallery.photos.append(
                PhotoData(title=title, img=img, thumbnail=img))