def obra(slug): obra = fromcache("obra-" + slug) or tocache("obra-" + slug, _get_obras(slug)[0]) if not obra: return abort(404) cacheid = "obratl-%s"%slug timeline = fromcache(cacheid) or tocache(cacheid,wordpress.monitoramento.getObraTimeline(obra['id'])) timeline = adjustCf(timeline) statuses = [ s for s in timeline if s['format'] == 'status' ] cacheid = "page-more-"+slug more = fromcache(cacheid) or tocache(cacheid,wordpress.getPageByPath('more-'+slug)) if more: more = more.content menus = fromcache('menuprincipal') or tocache('menuprincipal', wordpress.exapi.getMenuItens(menu_slug='menu-principal') ) try: twitter_hash_cabecalho = twitts() except KeyError: twitter_hash_cabecalho = "" tos = fromcache('tosobras') or tocache('tosobras',wordpress.getPageByPath('tos-obras')) howto = fromcache('howtoobras') or tocache('howtoobras',wordpress.getPageByPath('howto-obras')) return render_template('obra.html', menu=menus, obra=obra, tos=tos, howto=howto, more=more, timeline=timeline, statuses=statuses, twitter_hash_cabecalho=twitter_hash_cabecalho )
def timelineitem(slug, itemid): obra = fromcache("obra-" + slug) or tocache("obra-" + slug, _get_obras(slug)[0]) if not obra: return abort(404) cacheid = "obratl%s-%s"%(obra['id'],itemid) timeline = fromcache(cacheid) or tocache(cacheid, wordpress.monitoramento.getObraTimeline(obra['id'], int(itemid) )) timeline = adjustCf(timeline) update = timeline[0] menus = fromcache('menuprincipal') or tocache('menuprincipal', wordpress.exapi.getMenuItens(menu_slug='menu-principal') ) howto = fromcache('howtoobras') or tocache('howtoobras',wordpress.getPageByPath('howto-obras')) tos = fromcache('tosobras') or tocache('tosobras',wordpress.getPageByPath('tos-obras')) try: twitter_hash_cabecalho = twitts() except KeyError: twitter_hash_cabecalho = "" cacheid = "cmts-item-obra-%s" % itemid cmts = fromcache(cacheid) or tocache(cacheid, wordpress.getComments(status='approve',post_id=itemid, number=1000)) return render_template('timeline-item.html', base_url = current_app.config['BASE_URL'], menu=menus, obra=obra, howto=howto, tos=tos, update=update, comentarios=cmts[::-1], twitter_hash_cabecalho=twitter_hash_cabecalho )
def timelineitem(slug, itemid): obra = fromcache("obra-" + slug) or tocache("obra-" + slug, _get_obras(slug)[0]) if not obra: return abort(404) cacheid = "obratl%s-%s"%(obra['id'],itemid) timeline = fromcache(cacheid) or tocache(cacheid, wordpress.monitoramento.getObraTimeline(obra['id'], int(itemid) )) timeline = adjustCf(timeline) update = timeline[0] menus = fromcache('menuprincipal') or tocache('menuprincipal', wordpress.exapi.getMenuItens(menu_slug='menu-principal') ) howto = fromcache('howtoobras') or tocache('howtoobras',wordpress.getPageByPath('howto-obras')) tos = fromcache('tosobras') or tocache('tosobras',wordpress.getPageByPath('tos-obras')) try: twitter_hash_cabecalho = twitts() except KeyError: twitter_hash_cabecalho = "" return render_template('timeline-item.html', menu=menus, obra=obra, howto=howto, tos=tos, update=update, twitter_hash_cabecalho=twitter_hash_cabecalho )
def timelineitem(slug, itemid): obra = fromcache("obra-" + slug) or tocache("obra-" + slug, _get_obras(slug)[0]) if not obra: return abort(404) cacheid = "obratl%s-%s" % (obra['id'], itemid) timeline = fromcache(cacheid) or tocache( cacheid, wordpress.monitoramento.getObraTimeline(obra['id'], int(itemid))) timeline = adjustCf(timeline) update = timeline[0] menus = fromcache('menuprincipal') or tocache( 'menuprincipal', wordpress.exapi.getMenuItens(menu_slug='menu-principal')) howto = fromcache('howtoobras') or tocache( 'howtoobras', wordpress.getPageByPath('howto-obras')) tos = fromcache('tosobras') or tocache( 'tosobras', wordpress.getPageByPath('tos-obras')) try: twitter_hash_cabecalho = twitts() except KeyError: twitter_hash_cabecalho = "" return render_template('timeline-item.html', menu=menus, obra=obra, howto=howto, tos=tos, update=update, twitter_hash_cabecalho=twitter_hash_cabecalho)
def comofunciona(): return render_template( 'govresponde_comofunciona.html', **_get_context({ 'page': wordpress.getPageByPath('govresponde/como-funciona'), 'hidesidebar': True, 'hidesidebarright' : True, 'statusedicao': statusedicao }) )
def comofunciona(): return render_template( 'govresponde_comofunciona.html', **_get_context({ 'page': wordpress.getPageByPath('govresponde/como-funciona'), 'hidesidebar': True, 'hidesidebarright' : True, 'statusedicao': statusedicao, 'sidebar':wordpress.getSidebar, 'menu':wordpress.exapi.getMenuItens(menu_slug='menu-principal') }) )
def obra(slug): obra = fromcache("obra-" + slug) or tocache("obra-" + slug, _get_obras(slug)[0]) if not obra: return abort(404) cacheid = "obratl-%s" % slug timeline = fromcache(cacheid) or tocache( cacheid, wordpress.monitoramento.getObraTimeline(obra['id'])) timeline = adjustCf(timeline) statuses = [s for s in timeline if s['format'] == 'status'] cacheid = "page-more-" + slug more = fromcache(cacheid) or tocache( cacheid, wordpress.getPageByPath('more-' + slug)) if more: more = more.content menus = fromcache('menuprincipal') or tocache( 'menuprincipal', wordpress.exapi.getMenuItens(menu_slug='menu-principal')) try: twitter_hash_cabecalho = twitts() except KeyError: twitter_hash_cabecalho = "" tos = fromcache('tosobras') or tocache( 'tosobras', wordpress.getPageByPath('tos-obras')) howto = fromcache('howtoobras') or tocache( 'howtoobras', wordpress.getPageByPath('howto-obras')) return render_template('obra.html', menu=menus, obra=obra, tos=tos, howto=howto, more=more, timeline=timeline, statuses=statuses, twitter_hash_cabecalho=twitter_hash_cabecalho)
def send(): #Temporariamente desabilitado o envio de perguntas return redirect( url_for('govresponde.index') ); form = forms.QuestionForm(csrf_enabled=False) form.theme.choices = [(None, '----')] + \ [(i['id'], i['name']) for i in wordpress.govr.getThemes()] return render_template( 'govresponde_enviar.html', **_get_context({ 'page': wordpress.getPageByPath('govresponde/lembre-se'), 'form': form, 'hidesidebar': True, 'hidesidebarright' : True, 'statusedicao': statusedicao }))