()
Dashboard Modify Subscription:
    This will allow a user to modify their subscription and account plan
Dashboard Modify Subscription:
    This will allow a user to modify their subscription and account plan
Dashboard Modify Subscription : This will allow a user to modify their subscription and account plan
def modsub_page():
    '''Dashboard Modify Subscription:
    This will allow a user to modify their subscription and account plan
    '''
    verify = verifyLogin(
        app.config['SECRET_KEY'], app.config['COOKIE_TIMEOUT'], request.cookies)
    if verify:
        user = User()
        user.config = app.config
        user.get('uid', verify, g.rdb_conn)
        data = startData(user)
        data['active'] = 'dashboard'
        data['url'] = '/dashboard/mod-subscription'
        data['uid'] = user.uid
        tmpl = 'member/mod-subscription.html'
        data['js_bottom'].append('forms/subscribe.js')
        form = []
        from generalforms import subscribe

        payment = __import__("payments." + user.payments, globals(),
                             locals(), ['Payments'], -1)

        subscription = payment.Payments(user=user, config=app.config, rdb=g.rdb_conn)
        if request.method == "POST":
            if data['upgraded'] is True:
                result = subscription.adjust(request)
            else:
                result = subscription.create(request)

            if result is True:
                if data['upgraded'] is True:
                    flash('Adjustment to subscription successful', 'success')
                else:
                    data['upgraded'] = True
                    flash('Successfully Subscribed!', 'success')
                newdata = startData(user)
                data['limit'] = newdata['limit']
                data['rlimit'] = newdata['rlimit']
                data['acttype'] = newdata['acttype']
                data['subplans'] = newdata['subplans']
                data['cost'] = newdata['cost']
                data['subscription'] = newdata['subscription']
            else:
                flash('Unable to adjust subscription please notify support', 'danger')
        if data['upgraded'] is True:
            form = subscribe.AddPackForm(request.form)
        page = render_template(tmpl, data=data, form=form)
        return page
    else:
        flash('Please Login.', 'warning')
        return redirect(url_for('user.login_page'))
def modsub_page ( ) : verify = verifyLogin ( app . config [ 'SECRET_KEY' ] , app . config [ 'COOKIE_TIMEOUT' ] , request . cookies ) if verify : user = User ( ) user . config = app . config user . get ( 'uid' , verify , g . rdb_conn ) data = startData ( user ) data [ 'active' ] = 'dashboard' data [ 'url' ] = '/dashboard/mod-subscription' data [ 'uid' ] = user . uid tmpl = 'member/mod-subscription.html' data [ 'js_bottom' ] . append ( 'forms/subscribe.js' ) form = [ ] from generalforms import subscribe payment = __import__ ( "payments." + user . payments , globals ( ) , locals ( ) , [ 'Payments' ] , - 1 ) subscription = payment . Payments ( user = user , config = app . config , rdb = g . rdb_conn ) if request . method == "POST" : if data [ 'upgraded' ] is True : result = subscription . adjust ( request ) else : result = subscription . create ( request ) if result is True : if data [ 'upgraded' ] is True : flash ( 'Adjustment to subscription successful' , 'success' ) else : data [ 'upgraded' ] = True flash ( 'Successfully Subscribed!' , 'success' ) newdata = startData ( user ) data [ 'limit' ] = newdata [ 'limit' ] data [ 'rlimit' ] = newdata [ 'rlimit' ] data [ 'acttype' ] = newdata [ 'acttype' ] data [ 'subplans' ] = newdata [ 'subplans' ] data [ 'cost' ] = newdata [ 'cost' ] data [ 'subscription' ] = newdata [ 'subscription' ] else : flash ( 'Unable to adjust subscription please notify support' , 'danger' ) if data [ 'upgraded' ] is True : form = subscribe . AddPackForm ( request . form ) page = render_template ( tmpl , data = data , form = form ) return page else : flash ( 'Please Login.' , 'warning' ) return redirect ( url_for ( 'user.login_page' ) )