Beispiel #1
0
def search_all_resource(name, resource_type = 'All', limit=200):
    "全站搜索"
    if resource_type == 'All':
        return db.select(alldbname, where = 'resource_name like "%' + name + '%"', order = "hotrank DESC", limit = limit).list()
    else:
        return db.select(alldbname, 
            where = 'typeL1 = "' + resource_type + '" and resource_name like "%' + name + '%"', order = "hotrank DESC", limit = limit).list()
Beispiel #2
0
def search_all_resource(name, resource_type='All', limit=200):
    "全站搜索"
    if resource_type == 'All':
        return db.select(alldbname,
                         where='resource_name like "%' + name + '%"',
                         order="hotrank DESC",
                         limit=limit).list()
    else:
        return db.select(alldbname,
                         where='typeL1 = "' + resource_type +
                         '" and resource_name like "%' + name + '%"',
                         order="hotrank DESC",
                         limit=limit).list()
Beispiel #3
0
def get_id_byname(name):

    try:
        return db.select(tb, what="id", where="hostname=$name",
                         vars=locals())[0]
    except IndexError:
        return None
Beispiel #4
0
 def checkLogin(self, username, password):
     password1 = hashlib.md5(password).hexdigest()
     myvar = dict(username=username, password1=password1)
     result = db.select(table,
                        myvar,
                        where='username=$username and password=$password1')
     return result
Beispiel #5
0
def find_user(username):
    try:
        return db.select('users',
                         what="*",
                         where="username=$username",
                         vars=locals())[0]
    except IndexError:
        return None
Beispiel #6
0
def get_status_by_name(username):
    try:
        return db.select('users',
                         what='status',
                         where="username=$username",
                         vars=locals())[0]
    except IndexError:
        return None
Beispiel #7
0
def get_allentries(tb='vserver_info'):
    return db.select(tb, order='hostname ASC', vars=locals())
Beispiel #8
0
def get_tags(tb=tb_ctmgt):
    return db.select(tb, order="tagname ASC", vars=locals())
Beispiel #9
0
def get(table, **kw):
    return db.select(table, **kw)
Beispiel #10
0
def get_asset_by_name(name, tb='asset'):
    return db.select(tb, where='logic_name=$logic_name', vars=locals())
Beispiel #11
0
def get_hosts_orderby_db(order='ASC'):
    return db.select(tb, where="type='host'", order='datacenter ' + order)
Beispiel #12
0
def get_item_text(itemid):
    '''编辑页面,更新信息回显'''
    return db.select('item', what='id, pid, item_order, is_visible, title, text', where='id=$itemid', vars=locals())
Beispiel #13
0
def get_item_text(itemid):
    return db.select('item', what='id, pid, item_order, title, text', where='id=$itemid', vars=locals())
Beispiel #14
0
def get_tags_by_id(id, tb=tb_ctmgt):

    return db.select(tb, where='id=$id', vars=locals())
Beispiel #15
0
def get_hosts():
    return db.select(tb, order='hostname ASC')
Beispiel #16
0
def get_project_list():
    return db.select("project", what="id, name", where="id>=99")
Beispiel #17
0
def get_project_list():
    return db.select('project', what='id, name', where='id>=100')
Beispiel #18
0
def get_item_list(pid, is_visible=1):
    '''左侧显示列表'''
    return db.select('item', what='id, title', where='pid=$pid and is_visible=$is_visible', order="item_order", vars=locals())
Beispiel #19
0
def get_pids_with_itemid():
    return db.select('item', what='id, pid', where='pid>=99')
Beispiel #20
0
def get_maxtag(tb=tb_ctmgt):
    return db.select(tb,
                     what="*",
                     where="tagname=(select max(tagname) from capacity_tags)",
                     vars=locals())
Beispiel #21
0
	def checkLogin(self, username, password):
		password1 = hashlib.md5(password).hexdigest()
		myvar = dict(username=username, password1=password1)
		result = db.select(table, myvar, where='username=$username and password=$password1')
		return result
Beispiel #22
0
def get_hosts():
    return db.select(tb, where="type='host'", order='hostname ASC')
Beispiel #23
0
def getUserList():
	return db.select('users', order="lastlogin DESC")
Beispiel #24
0
def get_tags_by_name(name, tb=tb_ctmgt):

    return db.select(tb, where='tagname=$name', vars=locals())
Beispiel #25
0
def get_item_list(pid):
    return db.select('item', what='id, title', where='pid=$pid', order="item_order", vars=locals())
Beispiel #26
0
def get_entry(id, tb='vserver_info'):
    try:
        return db.select(tb, where='id=$id', vars=locals())[0]
    except IndexError:
        return None
Beispiel #27
0
def get_item_content(itemid):
    '''右侧显示文章区'''
    return db.select('item', what='title, html', where='id=$itemid', vars=locals())
Beispiel #28
0
def get_entries(type='vhost'):
    return db.select(tb,
                     where='type=$type',
                     order='hostname ASC',
                     vars=locals())
Beispiel #29
0
def get_entries_orderby_dc(type='vhost', item='datacenter', order='ASC'):
    return db.select(tb,
                     where='type=$type',
                     order=item + ' ' + order,
                     vars=locals())
Beispiel #30
0
def get_fail_times(name):
    r = db.select('loginfail', what='times', where='name=$name', vars=locals())
    if r:       
        return r[0].times
    else:
        return 0
Beispiel #31
0
def get_assets(tb='asset'):

    return db.select(tb, order="logic_name ASC", vars=locals())
Beispiel #32
0
def getConfig():
	query = db.select('config')
	return query[0]
Beispiel #33
0
def get_asset(id, tb='asset'):

    return db.select(tb, where='id=$id', vars=locals())
Beispiel #34
0
def get_resource_group(resource_info_id):
    "获取相近资源记录"
    return db.select(alldbname, where = 'resource_info_id=' + str(resource_info_id), order = "hotrank DESC").list()
Beispiel #35
0
def get_resource_group(resource_info_id):
    "获取相近资源记录"
    return db.select(alldbname,
                     where='resource_info_id=' + str(resource_info_id),
                     order="hotrank DESC").list()