本文整理汇总了Python中server.Server.editventprops方法的典型用法代码示例。如果您正苦于以下问题:Python Server.editventprops方法的具体用法?Python Server.editventprops怎么用?Python Server.editventprops使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server.Server
的用法示例。
在下文中一共展示了Server.editventprops方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: vtserver
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import editventprops [as 别名]
def vtserver():
form = VtEditForm()
user = session['username']
serv = Server()
vt = VtOrder.query.filter_by(cust_id=session['userid']).first()
port = Port.query.filter_by(port_id=vt.port_id).first()
server = Serverreserve.query.filter_by(server_id=port.server_id).first()
serverip = server.server_ip
props = serv.readventprops(serverip, user)
if request.method == 'POST':
if request.form['submit'] == 'Start serveren':
serv.startvent(serverip, user)
flash('Serveren starter!')
return render_template('vtserver.html', form=form, props=props)
if request.form['submit'] == 'Stopp serveren':
serv.stopvent(serverip, user)
flash('Serveren stopper!')
return render_template('vtserver.html', form=form, props=props)
if request.form['submit'] == 'Restart serveren':
serv.stopvent(serverip, user)
time.sleep(2)
serv.startvent(serverip, user)
flash(u'Serveren starter p\xe5 nytt!')
return render_template('vtserver.html', form=form, props=props)
if request.form['submit'] == 'Endre instillinger':
serv.editventprops(serverip, user, form.key.data, form.value.data)
return render_template('vtserver.html', form=form, props=props)
示例2: vtresponse
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import editventprops [as 别名]
def vtresponse():
orderref = request.args.get('orderRef')
slots = session['slots']
price = session['price']
months = session['months']
serv = Server()
userid = session['userid']
user = session['username']
openport = VoicePort.query.filter_by(port_used=2).first()
expire = datetime.date.today() + dateutils.relativedelta(months=int(months))
existvent = VtOrder.query.filter_by(cust_id=session['userid']).first()
if orderref is not None and existvent is not None:
extramonths = existvent.expiration + dateutils.relativedelta(months=int(months))
stmt = update(VtOrder).where(VtOrder.cust_id == session['userid']).values(expiration=extramonths).values(slots=slots)
db.session.execute(stmt)
db.session.commit()
#server, user, key, value
serv.editventprops(str(ventserver.server_ip), user, str("port"), str(openport.port_no))
serv.editventprops(str(ventserver.server_ip), user, str("maxclients"), str(slots))
send_email('Din ordrereferanse fra Gameserver.no', ADMINS[0], session['email'],
render_template('receiptvt.txt', subid=str(orderref), ordexp=str(months), slots=str(slots), totprice=session['price'], orderexp=expire),
render_template('receiptvt.html', subid=str(orderref), ordexp=str(months), slots=str(slots), totprice=session['price'], orderexp=expire))
return render_template('vtresponse.html', orderref=orderref, slots=slots, price=price, months=months, ordexp=expire)
elif orderref is not None:
vtadd = VtOrder(slots, price, expire, openport.port_id, userid)
stmt = update(Port).where(Port.port_id == openport.port_id).values(port_used=1)
db.session.execute(stmt)
db.session.add(vtadd)
db.session.commit()
serv.sendvent(ventserver.server_ip, user)
serv.deployvent(user, 'ventpro.zip', ventserver.server_ip)
serv.editventprops(str(ventserver.server_ip), user, str("port"), str(openport.port_no))
serv.editventprops(str(ventserver.server_ip), user, str("maxclients"), str(slots))
userstm = update(User).where(User.cust_id == session['userid']).values(role=2)
db.session.execute(userstm)
db.session.commit()
session['premium'] = 2
send_email('Din ordrereferanse fra Gameserver.no', ADMINS[0], session['email'],
render_template('receiptvt.txt', subid=str(orderref), ordexp=str(months), slots=str(slots), totprice=session['price'], orderexp=expire),
render_template('receiptvt.html', subid=str(orderref), ordexp=str(months), slots=str(slots), totprice=session['price'], orderexp=expire))
return render_template('vtresponse.html', orderref=orderref, slots=slots, price=price, months=months, ordexp=expire)
else:
return render_template('vtresponse.html', orderref=orderref, slots=slots, price=price, months=months)