<commit_before>from datetime import datetime, timedelta
from django.shortcuts import render_to_response
from django.template import RequestContext
import api


def index(request):
    uid = request.COOKIES.get("uid")
    if not uid:
        uid, data = api.create_new_user()
    else:
        data = api.get_saved_cities(uid)

    response = render_to_response(
        "homepage/index.html",
        {"saved_cities": data},
        context_instance=RequestContext(request)
    )

    expires = datetime.utcnow() + timedelta(days=180)
    response.set_cookie("uid", uid, expires=expires)

    return response<commit_msg>Fix create user in homepage view.<commit_after>from datetime import datetime, timedelta
from django.shortcuts import render_to_response
from django.template import RequestContext
import api


def index(request):
    uid = request.COOKIES.get("uid")
    data = None
    if not uid:
        uid, _ = api.create_new_user()
    else:
        data = api.get_saved_cities(uid)

    response = render_to_response(
        "homepage/index.html",
        {"saved_cities": data},
        context_instance=RequestContext(request)
    )

    expires = datetime.utcnow() + timedelta(days=180)
    response.set_cookie("uid", uid, expires=expires)

    return response
{'fraction_non_alphanumeric': 0.09583660644147683, 'fraction_numerical': 0.004713275726630008, 'mean_word_length': 3.4859154929577465, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '4072709', 'n_tokens_mistral': 396, 'n_tokens_neox': 374, 'n_words': 89}