diff --git a/profiles/models.py b/profiles/models.py index 7c120e7..ab44199 100644 --- a/profiles/models.py +++ b/profiles/models.py @@ -6,13 +6,16 @@ the preferred search engin, and if the user is likely to directly use urls or to type in the search engine. """ +import os import random from django.db import models +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + NICKNAMES = open("/usr/share/dict/american-english").read().splitlines() -LASTNAMES = open("../data/lastnames.txt").read().splitlines() -FIRSTNAMES = open("../data/firstnames.txt").read().splitlines() -EMAIL_DOMAINS = open("../data/email_domains.txt").read().splitlines() +LASTNAMES = open(BASE_DIR + "/data/lastnames.txt").read().splitlines() +FIRSTNAMES = open(BASE_DIR + "/data/firstnames.txt").read().splitlines() +EMAIL_DOMAINS = open(BASE_DIR + "/data/email_domains.txt").read().splitlines() class InvalidData(Exception): @@ -223,7 +226,7 @@ def create_profile(nick=None): nick=nick, first_name=first_name, last_name=last_name, - email=email + email=email, uses_url=(random.random() < 0.5), ) profile.search_engine = random.choice(SearchEngine.objects.all())