示例#1
0
文件: __main__.py 项目: tbenz9/tory
def main():
    args = parse_input()
    if args.command == 'disks':
        if args.j_flag:
            pprint.pprint(json.dumps(inventory.get_disk_partitions(), sort_keys=True, separators=(',', ': ')))
        else: 
            pprint.pprint(inventory.get_disk_partitions())
    if args.command == 'network':
        if args.j_flag:
            pprint.pprint(json.dumps(network.get_network_info(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            human_read.net_human(network.get_network_info())
        else:
            pprint.pprint(network.get_network_info())
    if args.command == 'cpu':
        if args.j_flag:
            pprint.pprint(json.dumps(cpu.mch_cpu(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            human_read.cpu_human(cpu.mch_cpu())
        else:
            pprint.pprint(cpu.mch_cpu())
    if args.command == 'ram':
        if args.j_flag:
            pprint.pprint(json.dumps(ram.get_ram_partitions(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            human_read.ram_human(ram.get_ram_partitions())
        else:
	    pprint.pprint(ram.get_ram_partitions())
    if args.command == 'user':
        if args.j_flag:
            pprint.pprint(json.dumps(user.get_users(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            human_read.users_human(user.get_users())
        else:
            pprint.pprint(user.get_users())
示例#2
0
文件: api.py 项目: marlier/domino
 def setTeam(self,data):
     if self.id == None or self.id == 0:
         if self.name == None or len(self.name) <= 0:
             self.populate(700,"No name parameter given in team creation")
             return
         newteam = Team.Team()
         newteam.name = self.name
         newteam.email = self.email
         newteam.members = User.get_users(self.members)
         newteam.oncall_count = self.oncall_count
         newteam.catchall = self.catchall
         if len(self.phone) == 11 and self.phone[0:1] != "+": self.phone = "+%s" % (self.phone) 
         newteam.phone = self.phone
         if newteam.save():
             self.populate(200,"OK")
         else:
             self.populate(700, "Failed to save team data")
     else:
         try:
             obj = Team.Team(self.id)
             # save the original members of the team to see if its changed
             orig_members = obj.members
             obj.__dict__.update(data)
             obj.members = User.get_users(self.members)
             if obj.save() == True:
                 # SMS the delta of whose on call
                 obj.notifyOncallChange(orig_members)
                 self.populate(200,"OK")
             else:
                 self.populate(700,"Failed to save team.")
         except Exception, e:
             self.populate(700,e.__str__())
             Util.strace(e)
             return
示例#3
0
文件: API.py 项目: zeagler/tangerine
    def get_users(self, username=None, userid=None, usertype=None):
        if username:   column="username"; value=username
        elif userid:   column="userid";   value=userid
        elif usertype: column="usertype"; value=usertype
        else:          column=None;       value=None

        return user.get_users(column, value)
示例#4
0
def index():
    usersData = get_users()
    studiesData = get_studies()

    return render_template('index.html',
                           users=usersData['_embedded']['user'],
                           studies=studiesData['_embedded']['study'])
示例#5
0
def users():
    #获取所有用户的信息
    # print 'dddd----------',session.get('user')
    if session.get('user') is None:
        return redirect('/')

    _users = user.get_users()
    return render_template('users.html', users=_users, username=session.get('user').get('username'), msg=request.args.get('msg', ''))            #加载渲染users.html模板
示例#6
0
def changeuser():
	updateuser = request.form.get('user')
	updateage = request.form.get('age')
	updatepassword = request.form.get('password')

	user.change_user(updateuser,updateage,updatepassword)
	return redirect('/users/')
	user_list=user.get_users()
示例#7
0
def get_non_friends(user_id):

    all_users = user.get_users()
    friend_ids = friend.get_friends(user_id)
    friends = user.get_user_details_from_list(friend_ids) + \
        user.get_user_details_from_list([user_id])

    non_friends = [user for user in all_users if user not in friends]

    return jsonify(non_friends), 200
示例#8
0
def userdel_index():
	params = request.args if request.method =='GET' else request.form
	user_id = params.get('user_id', '')
	if user_id:
		if user.user_del(user_id):
			flash('删除用户成功')
			return redirect('/users/')
		else:
			return render_template('users.html', user_list=user.get_users(), user_info='抱歉,删除用户失败')
	else:	
		return render_template('userdel.html', user_info='错误,用户信息不存在')	
示例#9
0
def userdel_index():
	params = request.args if request.method =='GET' else request.form
	username = params.get('username', '')
	if username:
		if user.user_del(username):
			return redirect('/users/')
			#return render_template('users.html', user_list=user.get_users(), user_info='User [%s] successfully deleted') % username
		else:
			return render_template('users.html', user_list=user.get_users(), user_info='error, Remove user [%s] failed') % username
	else:	
		return render_template('userdel.html')	
示例#10
0
def users():
    return render_template("users.html", users=get_users(), active='users')
示例#11
0
def users():
    # 获取所有用户
    _users = user.get_users()
    # 返回用户列表页面
    return render_template('users.html', users=_users.values())
示例#12
0
def users():
    users = user.get_users()
    return render_template('users.html', users=users)
示例#13
0
def get_all_users():
    users = user.get_users()
    return jsonify(users)
示例#14
0
def users():
    users = user.get_users()
    return render_template('users.html', users=users)
示例#15
0
def users():
    #获取所有用户的信息
    _users = user.get_users()
    return render_template('users.html', users=_users)            #加载渲染users.html模板
示例#16
0
def user_list():
    return render_template('user_list.html', user_list=user.get_users())
示例#17
0
def users():
	return render_template('users.html', user_list=user.get_users())		
示例#18
0
def users():
	user_list = user.get_users()
	return render_template('users.html',user_list=user_list) #渲染模板 通过for打印所有用户在users.html里面实现
示例#19
0
文件: __main__.py 项目: tbenz9/tory
def main():
    args = parse_input() 

    if args.command == 'disks':
        if args.j_flag:
            pprint.pprint(json.dumps(inventory.get_disk_partitions(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            pass # need to make this
        elif args.d_flag:
            flaskr.insert('disks', json.dumps(inventory.get_disk_partitions(), sort_keys=True, separators=(',', ': ')))
        elif args.s_flag:
            flaskr. retrieve('disks')
        else: 
            pprint.pprint(inventory.get_disk_partitions())
   
    if args.command == 'network':
        if args.j_flag:
            pprint.pprint(json.dumps(network.get_network_info(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            human_read.net_human(network.get_network_info())
        elif args.d_flag:
            flaskr.insert('network', json.dumps(network.get_network_info(), sort_keys=True, separators=(',', ': ')))
        elif args.s_flag:
            flaskr.retrieve('network')
        else:
            pprint.pprint(network.get_network_info())
   
    if args.command == 'cpu':
        if args.j_flag:
            pprint.pprint(json.dumps(cpu.mch_cpu(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            human_read.cpu_human(cpu.mch_cpu())
        elif args.d_flag:
            flaskr.insert('cpu', json.dumps(cpu.mch_cpu(), sort_keys=True, separators=(',', ': ')))
        elif args.s_flag:
            flaskr.retrieve('cpu')
        else:
            pprint.pprint(cpu.mch_cpu())
   
    if args.command == 'ram':
        if args.j_flag:
            pprint.pprint(json.dumps(ram.get_ram_partitions(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            human_read.ram_human(ram.get_ram_partitions())
        elif args.d_flag:
            flaskr.insert('ram', json.dumps(ram.get_ram_partitions(), sort_keys=True, separators=(',', ': ')))
        elif args.s_flag:
            flaskr.retrieve('ram')
        else:
	        pprint.pprint(ram.get_ram_partitions())
   
    if args.command == 'user':
        if args.j_flag:
            pprint.pprint(json.dumps(user.get_users(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
            human_read.users_human(user.get_users())
        elif args.d_flag:
            flaskr.insert('user', json.dumps(user.get_users(), sort_keys=True, separators=(',', ': ')))
        elif args.s_flag:
            flaskr.retrieve('user')
        else:
            pprint.pprint(user.get_users())
   
    if args.command == 'simple':
        if args.j_flag:
	        pprint.pprint(json.dumps(simple.get_simple_info(), sort_keys=True, separators=(',', ': ')))
        elif args.r_flag:
	        human_read.simple_human(simple.get_simple_info())
        elif args.d_flag:
            flaskr.insert('simple', json.dumps(simple.get_simple_info(), sort_keys=True, separators=(',', ': ')))
        elif args.s_flag:
            flaskr.retrieve('simple')
        else:
	        pprint.pprint(simple.get_simple_info())
   
    if args.command == 'pack':
        str_name= ''
        if args.PACKAGE:
            str_name=args.PACKAGE
        pprint.pprint(pack.get_pack(str_name))
示例#20
0
from flask import Flask, request, redirect, render_template, flash
import user
from aautomat import automat
from Automat import automat_class
from dice import dice
from ruleta import ruleta
from time import sleep

app = Flask(__name__, template_folder='templates')
app.secret_key = 'secret key'
Users = user.get_users()
us = Users[0]
bet = 1


@app.route('/', methods=['GET', 'POST'])
def login():
    global Users
    global us
    if request.method == 'POST':
        name = request.form['names']
        for u in Users:
            if u.get_name() == name:
                us = u
                return redirect("/casino")
    names = []
    for i in Users:
        names.append(i.get_name())
    return render_template('login.html', names=names)

示例#21
0
def users():
    # print user.get_users()
    return render_template('users.html', user_list=user.get_users())
示例#22
0
def users():
    #获取所有用户的信息
    _users = user.get_users()
    return render_template('users.html', users=_users)  #加载渲染users.html模板