Guest User

Untitled

a guest
Jun 28th, 2011
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. @wsgify
  2. def episode_feed(request):
  3.         shows = [s['title'] for s in shows.values()]
  4.         show_pats = [re.compile(r"\b%s\b" % re.escape(show), re.I) for show in shows]
  5.         d = PyQuery(url="http://www.ezrss.it/feed/")                                                                                                                              
  6.  
  7.         def shows_to_remove(i):
  8.             title = PyQuery(this).find("title").text()
  9.             for pat in show_pats:
  10.                 if pat.search(title):
  11.                     return False
  12.             return True
  13.  
  14.         d("item").filter(shows_to_remove).remove()
  15.  
  16.         response = Response()
  17.         response.content_type = "application/xml"
  18.         response.ubody = unicode(d)
  19.         response.cache_control = "no-cache"
  20.         return response
Advertisement
Add Comment
Please, Sign In to add comment