Example #1
0
File: feeds.py Project: lidel/mmda
 def get_object(self, bits):
     try:
         # bits =  "uri_artist/news/mbid/"
         mbid = bits[2]
         artist = get_basic_artist(mbid)
         self.news_stream, self.news_sources = get_populated_artist_news(artist)
     except:
         raise FeedDoesNotExist
     else:
         return artist
Example #2
0
File: views.py Project: lidel/mmda
def show_artist_news(request, uri_artist, mbid):
    """
    Show page with news related to a specified artist.

    @param mbid:        a string containing a MusicBrainz ID of an artist
    @param uri_artist:  a string containing SEO-friendly artist name

    @return: a rendered news page or a redirection to a proper URL
    """
    artist = get_basic_artist(mbid)
    news_stream, news_sources = get_populated_artist_news(artist)
    artist.save_any_changes()

    # basic SEO check
    artist_seo_name = slugify2(artist.name)
    if uri_artist == artist_seo_name:
        return render_to_response('news/show_artist_news.html', locals())
    else:
        return HttpResponsePermanentRedirect(reverse('show-artist-news', args=(artist_seo_name, mbid)))