-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.py
30 lines (23 loc) · 1011 Bytes
/
home.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
""" PubRefDb: Publication database web application.
Home page; list of most recent publications.
"""
from .base import *
class Home(MethodMixin, GET):
"The 10 most recent publications."
MOST_RECENT_LIMIT = 10
outreprs = [JsonRepresentation,
MedlineRepresentation,
AtomRepresentation,
PublicationsListHtmlRepresentation]
def get_data_resource(self, request):
publications = self.get_docs('publication/published',
'9999', last='0',
descending=True,
limit=self.MOST_RECENT_LIMIT)
# Already sorted by the index
for publication in publications:
self.normalize_publication(publication, request.application.get_url)
return dict(title='Publication Reference Database',
resource='Home',
publications=publications,
descr=self.__doc__)