<commit_before>from datetime import datetime
from flask import Blueprint
from flask import Flask, render_template, request, redirect
from cloudmesh.config.cm_keys import cm_keys

from cloudmesh.config.cm_projects import cm_projects
from cloudmesh.config.cm_config import cm_config

profile_module = Blueprint('profile_module', __name__)

#
# ROUTE: PROFILE
#


@profile_module.route('/profile/', methods=['GET', 'POST'])
def profile():
    # bug the global var of the ditc should be used

    config = cm_config()
    configuration = config.get()
    projects = cm_projects()
    person = configuration['profile']
    keys = cm_keys()
    version = "tmp"

    if request.method == 'POST':
        print request.form
        print "p", projects
        # print "c", config
        projects.default = request.form['field-selected-project']
        configuration['security']['default'] = request.form[
            'field-selected-securityGroup']
        config.index = request.form['field-index']
        config.prefix = request.form['field-prefix']
        config.firstname = request.form['field-firstname']
        config.lastname = request.form['field-lastname']
        config.phone = request.form['field-phone']
        config.email = request.form['field-email']

        print "setting the values"
        config.default_cloud = request.form['field-default-cloud']
        # print request.form["field-cloud-activated-" + value]
        print "setting the cloud values"
        # print config
        config.write()
        print "WRITING DONE"

    time_now = datetime.now().strftime("%Y-%m-%d %H:%M")

    address = '<br>'.join(str(x) for x in person['address'])
    return render_template('profile.html',
                           updated=time_now,
                           keys=keys,
                           projects=projects,
                           person=person,
                           address=address,
                           # clouds=clouds,
                           config=config,
                           configuration=configuration,
                           version=version,
                           )<commit_msg>adding hpc username field to user profile data<commit_after>from datetime import datetime
from flask import Blueprint
from flask import Flask, render_template, request, redirect
from cloudmesh.config.cm_keys import cm_keys

from cloudmesh.config.cm_projects import cm_projects
from cloudmesh.config.cm_config import cm_config

profile_module = Blueprint('profile_module', __name__)

#
# ROUTE: PROFILE
#


@profile_module.route('/profile/', methods=['GET', 'POST'])
def profile():
    # bug the global var of the ditc should be used

    config = cm_config()
    user=config.data["cloudmesh"]["hpc"]["username"]
    configuration = config.get()
    projects = cm_projects()
    person = configuration['profile']
    keys = cm_keys()
    version = "tmp"
    
    if request.method == 'POST':
        print request.form
        print "p", projects
        # print "c", config
        projects.default = request.form['field-selected-project']
        configuration['security']['default'] = request.form[
            'field-selected-securityGroup']
        config.index = request.form['field-index']
        config.prefix = request.form['field-prefix']
        config.firstname = request.form['field-firstname']
        config.lastname = request.form['field-lastname']
        config.phone = request.form['field-phone']
        config.email = request.form['field-email']
        print "setting the values"
        config.default_cloud = request.form['field-default-cloud']
        # print request.form["field-cloud-activated-" + value]
        print "setting the cloud values"
        # print config
        config.write()
        print "WRITING DONE"

    time_now = datetime.now().strftime("%Y-%m-%d %H:%M")
    
    address = '<br>'.join(str(x) for x in person['address'])
    return render_template('profile.html',
                           updated=time_now,
                           keys=keys,
                           projects=projects,
                           person=person,
                           address=address,
                           # clouds=clouds,
                           config=config,
                           configuration=configuration,
                           version=version,
         		   user=user,
	                  )
{'fraction_non_alphanumeric': 0.11060743427017226, 'fraction_numerical': 0.0, 'mean_word_length': 2.1476462196861625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1172930', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1130, 'n_words': 263}