Skip to content

Instantly share code, notes, and snippets.

@abbaspour
Created December 24, 2010 16:36
Show Gist options
  • Save abbaspour/754382 to your computer and use it in GitHub Desktop.
Save abbaspour/754382 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import web
from zk import ZooKepperConnection
urls = ('/(.*)', 'node')
render = web.template.render('templates/')
zkc = ZooKepperConnection("192.168.0.71:2181")
class node:
def GET(self, url = ""):
name = url if not url.endswith('/') else url[:-1]
home = web.ctx.homedomain + ('/' + name if name != "" else '')
raw_data = zkc.raw_data(name)
data = raw_data[0]
info = raw_data[1]
children = zkc.children(name)
return render.page(home, name, data, info, children)
app = web.application(urls, globals())
app.internalerror = web.debugerror
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment