Exemplo n.º 1
0
    def media_url(self):
        from base import media


        if self.media_id is not None:
            return media.url_for(media.get(self.media_id))
        return None
Exemplo n.º 2
0
    def serialize(self, json_friendly=False):
        from base import media, tags


        dic = super(Item, self).serialize(json_friendly)
        if json_friendly:
            dic["tags"] = [x.tag for x in tags.get_tags(self)]
            if self.media_id is not None:
                dic["media_url"] = media.url_for(media.get(self.media_id))
            else:
                dic["media_url"] = None

        return dic