<commit_before>import mysite.profile.controllers

def get_user_ip(request):
    return request.META['REMOTE_ADDR']

class LocationMiddleware(object):
    # called every time a page is queried
    # guesses a user's ip address, if if necessary, and saves it to the database
    def process_request(self, request):
        the_profile = request.user.get_profile()
        if not the_profile.location_confirmed and not the_profile.dont_guess_my_location:
            the_profile.location_display_name = mysite.profile.controllers.get_geoip_guess_for_ip(get_user_ip(request))[1]
            the_profile.save()
        return None
<commit_msg>enclosed ip spoofing in if statement, so it only happens on our machine<commit_after>import mysite.profile.controllers

def get_user_ip(request):
#    return request.META['REMOTE_ADDR']
    if request.META['REMOTE_ADDR'] == '127.0.0.1':
        return "192.168.127.12"
    else:
        return request.META['REMOTE_ADDR'] 

class LocationMiddleware(object):
    # called every time a page is queried
    # guesses a user's ip address, if if necessary, and saves it to the database
    def process_request(self, request):
        the_profile = request.user.get_profile()
        if not the_profile.location_confirmed and not the_profile.dont_guess_my_location:
            the_profile.location_display_name = mysite.profile.controllers.get_geoip_guess_for_ip(get_user_ip(request))[1]
            the_profile.save()
        return None

{'fraction_non_alphanumeric': 0.08152173913043478, 'fraction_numerical': 0.012907608695652174, 'mean_word_length': 3.766990291262136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '7188720', 'n_tokens_mistral': 468, 'n_tokens_neox': 447, 'n_words': 110}