Move the "empty search for latest" to collections
There is now a "latest" collection (or "latest_nsfw"). The feature didn't look much used, since it didn't work on many backends. Using collections will make it easy to support other things like most viewed, featured, etc. As a bonus, I added tests for every backend with the feature.
This commit is contained in:
parent
4d628112d5
commit
e958c229e6
32 changed files with 366 additions and 112 deletions
|
|
@ -67,7 +67,7 @@ class IndexPage(BasePage):
|
|||
seconds = parts[0]
|
||||
elif len(parts) == 2:
|
||||
hours = 0
|
||||
minutes , seconds = parts
|
||||
minutes, seconds = parts
|
||||
elif len(parts) == 3:
|
||||
hours, minutes, seconds = parts
|
||||
else:
|
||||
|
|
@ -78,7 +78,6 @@ class IndexPage(BasePage):
|
|||
yield video
|
||||
|
||||
|
||||
|
||||
# parser for the video page
|
||||
class VideoPage(BasePage):
|
||||
def get_video(self, video=None):
|
||||
|
|
@ -118,10 +117,12 @@ class CappedBrowser(BaseBrowser):
|
|||
assert self.is_on_page(VideoPage), 'Should be on video page.'
|
||||
return self.page.get_video(video)
|
||||
|
||||
def search_videos(self,pattern):
|
||||
if not pattern:
|
||||
self.home()
|
||||
else:
|
||||
self.location('/search?s=%s' % (urllib.quote_plus(pattern.encode('utf-8'))))
|
||||
def search_videos(self, pattern):
|
||||
self.location('/search?s=%s' % (urllib.quote_plus(pattern.encode('utf-8'))))
|
||||
assert self.is_on_page(IndexPage)
|
||||
return self.page.iter_videos()
|
||||
|
||||
def latest_videos(self):
|
||||
self.home()
|
||||
assert self.is_on_page(IndexPage)
|
||||
return self.page.iter_videos()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue