Пример #1
0
 def GET(self, _type, olid=None):
     if olid:
         getter = get_work_availability if _type == 'works' else get_edition_availability
         item = web.ctx.site.get('/%s/%s' % (_type, olid)) or {}
         item['olid'] = olid
         item['availability'] = getter(olid).get(item['olid'])
         item['authors'] = [web.storage(key=a.key, name=a.name or None) for a in item.get_authors()]
         return delegate.RawText(
             render_template('widget', item if _type == 'books' else format_work_data(item)),
             content_type='text/html')
     raise web.seeother('/')
Пример #2
0
 def GET(self, _type, olid=None):
     if olid:
         getter = get_work_availability if _type == 'works' else get_edition_availability
         item = web.ctx.site.get('/%s/%s' % (_type, olid)) or {}
         item['olid'] = olid
         item['availability'] = getter(olid).get(item['olid'])
         item['authors'] = [web.storage(key=a.key, name=a.name or None) for a in item.get_authors()]
         return delegate.RawText(
             render_template("widget", item if _type == 'books' else format_work_data(item)),
             content_type="text/html")
     raise web.seeother("/")