Example #1
0
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
Example #2
0
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
Example #3
0
def control_createcommishclass_(request):
    form = request.web_input(title="", titlepreset="", price_title="", min_amount="", max_amount="", currency="")
    title = form.title or form.titlepreset
    form.currency = form.currency.replace("$", "")

    classid = commishinfo.create_commission_class(request.userid, title.strip())
    # Try to create a base price for it. If we fail, try to clean up the class.
    try:
        price = orm.CommishPrice()
        price.title = form.price_title.strip()
        price.classid = classid
        price.amount_min = commishinfo.parse_currency(form.min_amount)
        price.amount_max = commishinfo.parse_currency(form.max_amount)
        commishinfo.create_price(request.userid, price, currency=form.currency)
    except WeasylError as we:
        commishinfo.remove_class(request.userid, classid)
        raise we
    raise HTTPSeeOther(location="/control/editcommissionsettings")
Example #4
0
def control_createcommishclass_(request):
    form = request.web_input(title="")

    commishinfo.create_commission_class(request.userid, form.title.strip())
    raise HTTPSeeOther(location="/control/editcommissionprices")
Example #5
0
    def POST(self):
        form = web.input(title="")

        commishinfo.create_commission_class(self.user_id, form.title.strip())
        raise web.seeother("/control/editcommissionprices")
Example #6
0
def control_createcommishclass_(request):
    form = request.web_input(title="")

    commishinfo.create_commission_class(request.userid, form.title.strip())
    raise HTTPSeeOther(location="/control/editcommissionprices")
Example #7
0
    def POST(self):
        form = web.input(title="")

        commishinfo.create_commission_class(self.user_id, form.title.strip())
        raise web.seeother("/control/editcommissionprices")