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])) 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_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_editcommishinfo_(request): form = request.web_input(content="", set_commish="", set_trade="", set_request="") 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_settings(request.userid, set_trade, set_request, set_commission) commishinfo.edit_content(request.userid, form.content) raise HTTPSeeOther(location="/control/editcommissionsettings")
def create_commish_searchable_user(username, commish_status='o', commishclass='badge', minprice="10.00", maxprice="15.00", currency='', submittime=arrow.get(1)): user = db_utils.create_user(username=username) profile.edit_profile_settings( userid=user, set_commission=profile.get_exchange_setting(profile.EXCHANGE_TYPE_COMMISSION, commish_status) ) commishinfo.create_commission_class(user, commishclass) classid = commishinfo.select_list(user)["class"][0]["classid"] assert classid price = orm.CommishPrice() price.title = "test price" price.classid = classid price.amount_min = commishinfo.parse_currency(minprice) price.amount_max = commishinfo.parse_currency(maxprice) commishinfo.create_price(user, price, currency) db_utils.create_submission(user, unixtime=submittime) return user
def create_commish_searchable_user(username, commish_status='o', commishclass='badge', minprice="10.00", maxprice="15.00", currency='', submittime=arrow.get(1)): user = db_utils.create_user(username=username) profile.edit_profile_settings( userid=user, set_commission=profile.get_exchange_setting(profile.EXCHANGE_TYPE_COMMISSION, commish_status) ) commishinfo.create_commission_class(user, commishclass) classid = commishinfo.select_list(user)["class"][0]["classid"] assert classid price = orm.CommishPrice() price.title = "test price" price.classid = classid price.amount_min = commishinfo.parse_currency(minprice) price.amount_max = commishinfo.parse_currency(maxprice) commishinfo.create_price(user, price, currency) db_utils.create_submission(user, unixtime=submittime) return user