def control_editprofile_put_(request): form = request.web_input( full_name="", catchphrase="", profile_text="", set_commish="", set_trade="", set_request="", set_stream="", stream_url="", stream_text="", show_age="", gender="", country="", profile_display="", site_names=[], site_values=[]) if len(form.site_names) != len(form.site_values): raise WeasylError('Unexpected') if 'more' in form: form.sorted_user_links = [(name, [value]) for name, value in zip(form.site_names, form.site_values)] form.settings = form.set_commish + form.set_trade + form.set_request form.config = form.profile_display return Response(define.webpage(request.userid, "control/edit_profile.html", [form, form], title="Edit Profile")) p = orm.Profile() p.full_name = form.full_name p.catchphrase = form.catchphrase p.profile_text = form.profile_text set_trade = profile.get_exchange_setting(profile.EXCHANGE_TYPE_TRADE, form.set_trade) set_request = profile.get_exchange_setting(profile.EXCHANGE_TYPE_REQUEST, form.set_request) set_commission = profile.get_exchange_setting(profile.EXCHANGE_TYPE_COMMISSION, form.set_commish) profile.edit_profile(request.userid, p, set_trade=set_trade, set_request=set_request, set_commission=set_commission, profile_display=form.profile_display) profile.edit_userinfo(request.userid, form) raise HTTPSeeOther(location="/control")
def control_streaming_post_(request): form = request.web_input(target="", set_stream="", stream_length="", stream_url="", stream_text="") if form.target and request.userid not in staff.MODS: raise WeasylError('InsufficientPermissions') if form.target: target = int(form.target) else: target = request.userid stream_length = define.clamp(define.get_int(form.stream_length), 0, 360) p = orm.Profile() p.stream_text = form.stream_text p.stream_url = define.text_fix_url(form.stream_url.strip()) set_stream = form.set_stream profile.edit_streaming_settings(request.userid, target, p, set_stream=set_stream, stream_length=stream_length) if form.target: target_username = define.get_sysname(define.get_display_name(target)) raise HTTPSeeOther(location="/modcontrol/manageuser?name=" + target_username) else: raise HTTPSeeOther(location="/control")
def POST(self): form = web.input(target="", set_stream="", stream_length="", stream_url="", stream_text="") if form.target and self.user_id not in staff.MODS: return define.errorpage(self.user_id, errorcode.permission) if form.target: target = int(form.target) else: target = self.user_id stream_length = define.clamp(define.get_int(form.stream_length), 0, 360) p = orm.Profile() p.stream_text = form.stream_text p.stream_url = define.text_fix_url(form.stream_url.strip()) set_stream = form.set_stream profile.edit_streaming_settings(self.user_id, target, p, set_stream=set_stream, stream_length=stream_length) raise web.seeother("/control")