(user=None)
return data
This will set some common parameters for the data dictionary
This will set some common parameters for the data dictionary
This will set some common parameters for the data dictionary
def startData(user=None):
    ''' This will set some common parameters for the data dictionary '''
    data = {}
    if user:
        data['status'] = user.status
        data['username'] = user.username
        data['company'] = user.company
        data['loggedin'] = True
        data['choices'] = app.config['PACKAGES'][user.acttype]['choices']
        data['limit'] = user.subplans
        data['rlimit'] = user.subplans * app.config['PACKAGES'][user.acttype]['reaction_multiplier']
        data['dataret'] = app.config['PACKAGES'][user.acttype]['data_retention']
        data['acttype'] = app.config['PACKAGES'][user.acttype]['acttype']
        data['upgraded'] = app.config['PACKAGES'][user.acttype]['upgraded']
        if data['upgraded'] is True:
            data['subscription_plan'] = app.config['SUBSCRIPTIONS'][user.subscription]
            data['cost'] = data['subscription_plan']['cost'] * user.subplans
        else:
            data['cost'] = 'Free'
            data['subscription_plan'] = app.config['SUBSCRIPTIONS']['default']
        data['stripe_pubkey'] = app.config['STRIPE_PUBKEY']
        data['subplans'] = user.subplans
        data['subscription'] = user.subscription
        data['email_digest'] = hashlib.md5(user.email).hexdigest()
    data['js_bottom'] = []
    data['js_header'] = []
    return data
def startData ( user = None ) : data = { } if user : data [ 'status' ] = user . status data [ 'username' ] = user . username data [ 'company' ] = user . company data [ 'loggedin' ] = True data [ 'choices' ] = app . config [ 'PACKAGES' ] [ user . acttype ] [ 'choices' ] data [ 'limit' ] = user . subplans data [ 'rlimit' ] = user . subplans * app . config [ 'PACKAGES' ] [ user . acttype ] [ 'reaction_multiplier' ] data [ 'dataret' ] = app . config [ 'PACKAGES' ] [ user . acttype ] [ 'data_retention' ] data [ 'acttype' ] = app . config [ 'PACKAGES' ] [ user . acttype ] [ 'acttype' ] data [ 'upgraded' ] = app . config [ 'PACKAGES' ] [ user . acttype ] [ 'upgraded' ] if data [ 'upgraded' ] is True : data [ 'subscription_plan' ] = app . config [ 'SUBSCRIPTIONS' ] [ user . subscription ] data [ 'cost' ] = data [ 'subscription_plan' ] [ 'cost' ] * user . subplans else : data [ 'cost' ] = 'Free' data [ 'subscription_plan' ] = app . config [ 'SUBSCRIPTIONS' ] [ 'default' ] data [ 'stripe_pubkey' ] = app . config [ 'STRIPE_PUBKEY' ] data [ 'subplans' ] = user . subplans data [ 'subscription' ] = user . subscription data [ 'email_digest' ] = hashlib . md5 ( user . email ) . hexdigest ( ) data [ 'js_bottom' ] = [ ] data [ 'js_header' ] = [ ] return data