示例#1
0
 def __init__(self, page):
     self.uri = page.uri
     self.title = page.title
     if getattr(page, 'lastmod', None):
         self.lastmod = page.lastmod
     elif getattr(page, 'modified', None):
         self.lastmod = page.modified
     self.retrieved = datetime.now()
     self.authors = page.authors
     self.authors_apa = citations.format_authors_apa(self.authors['parsed'])
     self.authors_bibtex = citations.format_authors_bibtex(self.authors['parsed'])
     self.authors_chicago = citations.format_authors_chicago(self.authors['parsed'])
     self.authors_cse = citations.format_authors_cse(self.authors['parsed'])
     self.authors_mhra = citations.format_authors_mhra(self.authors['parsed'])
     self.authors_mla = citations.format_authors_mla(self.authors['parsed'])
示例#2
0
 def __init__(self, page, request):
     self.uri = page.absolute_url()
     self.href = 'https://%s%s' % (request.META['HTTP_HOST'], self.uri)
     if getattr(page, 'title', None):
         self.title = page.title
     elif getattr(page, 'caption', None):
         self.title = page.caption
     if getattr(page, 'lastmod', None):
         self.lastmod = page.lastmod
     elif getattr(page, 'modified', None):
         self.lastmod = page.modified
     if getattr(page, 'authors_data', None):
         self.authors = page.authors_data
         self.authors_apa = citations.format_authors_apa(self.authors['parsed'])
         self.authors_bibtex = citations.format_authors_bibtex(self.authors['parsed'])
         self.authors_chicago = citations.format_authors_chicago(self.authors['parsed'])
         self.authors_cse = citations.format_authors_cse(self.authors['parsed'])
         self.authors_mhra = citations.format_authors_mhra(self.authors['parsed'])
         self.authors_mla = citations.format_authors_mla(self.authors['parsed'])
     self.retrieved = datetime.now()