Beispiel #1
0
 def get(self):
     #logger.debug('testtest')
     #self.write('testtest')
     #print who
     puppet_db = mydb()
     #machines=puppet_db.get_machine_list()
     #self.render("tables.html",machines=({'hostname':'dddd','ip':'testet'},{'hostname':'dfdaf','ip':'etwqtq'}))
     self.render("nodes.html",
                 machines=puppet_db.get_machine_list(),
                 all_node_groups=puppet_db.get_all_node_groups())
Beispiel #2
0
 def get(self, *args, **kwargs):
     qqnum = self.get_cookie('qqnum')
     username = self.get_cookie('username')
     #测试
     # username=u'盛夏光年'
     # qqnum='2634107307'
     d_ = mydb()
     sql = 'SELECT * FROM webqq_msg WHERE to_uin=' + qqnum + ' ORDER BY id DESC;'
     msgs = d_.select(sql)
     self.render('qqshowmsg.html', msgs=msgs, username=username)
Beispiel #3
0
 def post(self, *args, **kwargs):
     searchword = self.get_argument('searchword')
     searchword='%'+searchword+'%'
     d_ = mydb()
     # qqnum = self.get_cookie('qqnum')
     qqnum='2634107307'
     sql = 'SELECT * FROM webqq_msg WHERE to_uin=' + qqnum + ' AND content LIKE %s ORDER BY id DESC;'
     msgs = d_.select(sql,searchword)
     # if len(searchword) == 0 or searchword==None:
     #     self.render('qqmsg.html', msgs=msgs)
     #     return
     # msgs = fuzzyfinder(searchword, msgs)
     print u'搜索:' + searchword + u',搜索结果数目:' + str(len(msgs))
     self.render('qqmsg.html', msgs=msgs)
Beispiel #4
0
 def __init__(self):
     self.db_ = mydb()
Beispiel #5
0
 def __init__(self):
     self.db_ = mydb()
Beispiel #6
0
 def post(self):
     puppet_db = mydb()
     self.write(puppet_db.delmodule(self.get_argument('module')))
Beispiel #7
0
 def post(self):
     puppet_db = mydb()
     self.write(puppet_db.delnode(self.get_argument('node')))
Beispiel #8
0
 def post(self):
     puppet_db = mydb()
     self.write(
         puppet_db.add_module(self.get_argument('classname'),
                              self.get_argument('class_group')))
Beispiel #9
0
 def post(self):
     puppet_db = mydb()
     self.write(
         puppet_db.add_node(self.get_argument('hostname'),
                            self.get_argument('node_group')))
Beispiel #10
0
 def get(self):
     puppet_db = mydb()
     node = self.get_argument('node')
     r = puppet_db.getnodeclass(node.replace('.500x.com', ''))
     #r=puppet_db.getnodeclass(node)
     self.write(r)
Beispiel #11
0
 def get(self):
     puppet_db = mydb()
     self.render("modules.html",
                 classes=puppet_db.getnodetoclass(),
                 allclass=puppet_db.getclass())
Beispiel #12
0
# coding=utf-8
__author__ = 'Administrator'

import sys, json, os, threading

reload(sys)  # Python2.5 初始化后会删除 sys.setdefaultencoding 这个方法,我们需要重新载入
sys.setdefaultencoding('utf-8')

import tornado.web, tornado.escape, tornado.websocket,time
from tornado.web import UIModule
from db import mydb
from lib.QQcopy import QQ

db_ = mydb()


class baseHandler(tornado.web.RequestHandler):
    def get_current_user(self):
        return self.get_secure_cookie('cookieName')

    def write_error(self, status_code, **kwargs):
        print 'error:' + str(status_code)
        if status_code == 404:
            self.render('404.html', )
        elif status_code == 500:
            self.render('404.html')
        else:
            super(baseHandler, self).write_error(status_code, **kwargs)

class nopageHandler(baseHandler):
    '''没有被收集到的错误默认为404'''