Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Jack the Bodiless (Galactic Milieu Trilogy #1)

Cover for Jack the Bodiless (Galactic Milieu Trilogy #1)

Review:

The pliocene ex­ile saga was one of my favourite sci­fi bok se­ries when I was a teenag­er. I had read it all in the wrong or­der be­cause find­ing the books in Ar­genti­na was not easy.

Thanks to goodreads I learned there were a bunch of oth­er books set in the same uni­verse and de­cid­ed read­ing them.

While not as en­joy­able, be­cause these as­sume lots of back­sto­ry, the writ­ing is en­joy­able, and it's fun. I sure would have loved to read these 20 years ago.

Creando un foro de la manera fácil (32 líneas)

Aquí es­tán al­gu­nos de los fea­tu­res que quie­ro:

  • Lo­­­gin via twi­­tter / Fa­­ce­­book / Google / Ope­­nID

  • Nú­­me­­ro ili­­mi­­ta­­do de th­­rea­­ds

  • So­­­po­r­­te de like / dis­­like en th­­rea­­ds y en po­s­­ts

  • Ava­­ta­­res

  • HT­­ML en los po­s­­ts

  • Que man­­de mail al usua­­rio si le res­­po­n­­den

  • Fee­­ds RSS pa­­ra los th­­rea­­ds

Se lo pue­de ver en ac­ción en http://­fo­ro­.­ne­t­ma­na­ger­s.­co­m.ar (por un tiem­po li­mi­ta­do ;-)

Y aquí es­tá el có­di­go:

import bottle
import disqusapi as disqus
import json
shortname = 'magicmisteryforum'
api = disqus.DisqusAPI(open("key").read().strip())

@bottle.route('/', method='GET')
def index():
    msg = bottle.request.GET.get('msg', '')
    threads = api.forums.listThreads(forum=shortname, limit=100)
    print threads[0]
    return bottle.template('main.tpl', threads=threads, shortname=shortname, msg=msg)

@bottle.route('/new', method='POST')
def new():
    title = bottle.request.forms.get('title', None)
    if not title:
        bottle.redirect('/?msg=Missing%20Thread%20Name')
        return
    thread = api.threads.create(forum=shortname, title = title)
    thread_id = thread.__dict__['response']['id']
    # Redirecting to /thread/thread_id doesn't work
    # because threads take a few seconds to appear on the listing
    bottle.redirect('/')

@bottle.route('/thread/:id')
def thread(id):
    t = api.threads.details(thread=id)
    return bottle.template('thread.tpl', shortname=shortname, id=id, thread=t.__dict__['response'])

@bottle.route('/static/:path#.+#')
def server_static(path):
    return bottle.static_file(path, root='./static')

app = bottle.app()
app.catchall = False #Now most exceptions are re-raised within bottle.
bottle.run(host='184.82.108.14', port=80, app=app)

Re­quie­re Bo­ttle y la Dis­qus py­thon API

Por su­pues­to que hay un po­qui­to de tem­pla­tes, acá es­tá mai­n.­tpl y th­rea­d.­tpl. Co­mo apes­to pa­ra el HT­M­L, usa Blue­trip CSS y es sen­ci­llo de cus­to­mi­za­r.

POR SU­PUES­TO QUE HA­GO TRAM­PA!

Es­ta co­sa es ape­nas una ca­pa de pin­tu­ra en­ci­ma de Dis­qus! Más un blog sin pos­ts pe­ro con co­men­ta­rios que un fo­ro! Pe­ro­... qué le fal­ta pa­ra ser un fo­ro de ver­da­d? Fun­cio­na, no? Has­ta se po­drían usar ca­te­go­rías de Dis­qus pa­ra crear su­bfo­ro­s...

Te­nien­do to­do en cuen­ta, creo que es un ha­ck bo­ni­to.

Y si es­pe­rás unos día­s, es­to lle­va a otra co­sa que es mu­cho más má­gi­ca...

Có­di­go fuen­te com­ple­to en http://­ma­gi­cfo­ru­m.­google­co­de.­com


Contents © 2000-2023 Roberto Alsina