Ejemplo n.º 1
0
    def for_slug_id(cls, slug_id):
        """ Returns the Podcast for either an CouchDB-ID for a Slug """

        if utils.is_couchdb_id(slug_id):
            return cls.get(slug_id)
        else:
            return cls.for_slug(slug_id)
Ejemplo n.º 2
0
    def for_slug_id(cls, p_slug_id, e_slug_id):
        """ Returns the Episode for Podcast Slug/Id and Episode Slug/Id """

        # The Episode-Id is unique, so take that
        if utils.is_couchdb_id(e_slug_id):
            return cls.get(e_slug_id)

        # If we search using a slug, we need the Podcast's Id
        if utils.is_couchdb_id(p_slug_id):
            p_id = p_slug_id
        else:
            podcast = Podcast.for_slug_id(p_slug_id)

            if podcast is None:
                return None

            p_id = podcast.get_id()

        return cls.for_slug(p_id, e_slug_id)