def get_all_trees(cur_server_index=0,key=None, db=0, cursor=0): from redis_api import get_all_keys_tree,get_client server = base['servers'][cur_server_index] cl = get_client(host=server['host'], port=server['port'],db=db, password=server.has_key('password') and server['password'] or None ) try: ret = get_all_keys_tree(client=cl,key=key,cursor=cursor) return ret except: return u'Could not connect %s:%s'%(server['host'],server['port'])
def get_all_trees(cur_server_index=0,key=None, db=0): from redis_api import get_all_keys_tree,get_client from config import base server = base['servers'][cur_server_index] cl = get_client(host=server['host'], port=server['port'],db=db, password=server.has_key('password') and server['password'] or None ) try: ret = get_all_keys_tree(client=cl,key=key) return ret except: return u'Could not connect %s:%s'%(server['host'],server['port'])
def get_all_levels(cur_server_index=0): from redis_api import get_all_keys_dict, get_client from config import base server = base['servers'][cur_server_index] cl = get_client(host=server['host'], port=server['port']) try: namespaces = get_all_keys_dict(client=cl) return print_namespace(namespaces, 'Keys', '', bool(namespaces), cl, cur_server_index) except: return u'Could not connect %s:%s' % (server['host'], server['port'])
def get_all_levels(cur_server_index=0): from redis_api import get_all_keys_dict, get_client from config import base server = base["servers"][cur_server_index] cl = get_client(host=server["host"], port=server["port"]) try: namespaces = get_all_keys_dict(client=cl) return print_namespace(namespaces, "Keys", "", bool(namespaces), cl, cur_server_index) except: return u"Could not connect %s:%s" % (server["host"], server["port"])
def get_all_trees(cur_server_index=0,key=None, db=0, cursor=0): from redis_api import get_all_keys_tree,get_client server = base['servers'][cur_server_index] cl = get_client(host=server['host'], port=server['port'],db=db, password=server.has_key('password') and server['password'] or None ) try: ret = get_all_keys_tree(client=cl,key=key,cursor=cursor) return ret except Exception,e: traceback.print_exc() return u'Error to communicate with %s:%s "%s"'%(server['host'],server['port'], e)
def get_cl(): from config import base from redis_api import get_client try: cur_server_index = int(request.GET.get('s', '0')) cur_db_index = int(request.GET.get('db', '0')) except: cur_server_index = 0 cur_db_index = 0 server = base['servers'][cur_server_index] cl = get_client(host=server['host'], port=server['port'],db=cur_db_index, password=server.has_key('password') and server['password'] or None) return cl,cur_server_index,cur_db_index
def get_all_trees(cur_server_index=0, key=None, db=0, cursor=0): from redis_api import get_all_keys_tree, get_client server = base['servers'][cur_server_index] cl = get_client(host=server['host'], port=server['port'], db=db, password=server.has_key('password') and server['password'] or None) try: ret = get_all_keys_tree(client=cl, key=key, cursor=cursor) return ret except Exception, e: traceback.print_exc() return u'Error to communicate with %s:%s "%s"' % (server['host'], server['port'], e)
def get_cl(): from config import base from redis_api import get_client try: cur_server_index = int(request.GET.get("s", "0")) cur_db_index = int(request.GET.get("db", "0")) except: cur_server_index = 0 cur_db_index = 0 server = base["servers"][cur_server_index] cl = get_client( host=server["host"], port=server["port"], db=cur_db_index, password=server.has_key("password") and server["password"] or None, ) return cl, cur_server_index, cur_db_index
def view(): from config import base from redis_api import get_client from data_view import general_html,title_html try: sid = int(request.GET.get('s', '0')) except: sid = 0 fullkey = request.GET.get('key', '') server = base['servers'][sid] cl = get_client()#get_client(host=server['host'], port=server['port']) if cl.exists(fullkey): title_html = title_html(fullkey, sid) general_html = general_html(fullkey, sid, cl) out_html = title_html + general_html #return template('view',template_adapter=Jinja2Template, out_html=out_html ) return template('view', out_html=out_html ) else: return ' This key does not exist.'