Created
December 24, 2010 16:36
-
-
Save abbaspour/754382 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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