-
Notifications
You must be signed in to change notification settings - Fork 6
/
StartPage.py
75 lines (56 loc) · 1.95 KB
/
StartPage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env python
# -*- mode: python; indent-tabs-mode: nil; -*- coding: utf-8 -*-
"""
StartPage.py
Copyright 2009-2012 by Marcello Perathoner
Distributable under the GNU General Public License Version 3 or newer.
The Search Start Page.
"""
from __future__ import unicode_literals
import BaseSearcher
import Page
from i18n_tool import ugettext as _
class Start (Page.Page):
""" The start page. """
def index (self, **dummy_kwargs):
""" Output the start page. """
os = BaseSearcher.OpenSearch ()
os.log_request ('start')
os.search_terms = ''
os.title = {
'opds': _('Project Gutenberg'),
'stanza': _('Project Gutenberg')
}.get (os.format, _('Search Project Gutenberg'))
cat = BaseSearcher.Cat ()
cat.header = _(
'Welcome to Project Gutenberg. Use the search box to find your book or pick a link.')
cat.title = _('Popular')
cat.subtitle = _('Our most popular books.')
cat.url = os.url ('search', sort_order = 'downloads')
cat.class_ += 'navlink'
cat.icon = 'popular'
cat.order = 2
os.entries.append (cat)
cat = BaseSearcher.Cat ()
cat.title = _('Latest')
cat.subtitle = _('Our latest releases.')
cat.url = os.url ('search', sort_order = 'release_date')
cat.class_ += 'navlink'
cat.icon = 'date'
cat.order = 3
os.entries.append (cat)
cat = BaseSearcher.Cat ()
cat.title = _('Random')
cat.subtitle = _('Random books.')
cat.url = os.url ('search', sort_order = 'random')
cat.class_ += 'navlink'
cat.icon = 'random'
cat.order = 4
os.entries.append (cat)
os.total_results = 0
os.template = 'results'
os.page = 'start'
os.url_share = os.url ('/', host = os.file_host)
os.twit = os.tagline
os.finalize ()
return self.format (os)