Skip to content

Commit

Permalink
closes 67, closes 68, closes 69
Browse files Browse the repository at this point in the history
  • Loading branch information
ialbert committed Feb 29, 2012
1 parent ff1a99b commit cee28d1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
16 changes: 7 additions & 9 deletions biostar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ export MIGRATE_PATH=${MIGRATE_PATH:-"import/se2"}
export MIGRATE_LIMIT=${MIGRATE_LIMIT:-"100"}

# the fixture to dump/load data from
export FIXTURE=${FIXTURE:-"import/datadump.json"}
export FIXTURE_GZ=$FIXTURE.gz
export FIXTURE=${FIXTURE:-"import/datadump.json.gz"}

# the DJANGO_SETTINGS_MODULE needs to be in the python import path
export PYTHONPATH=$PYTHONPATH:$BIOSTAR_HOME
Expand Down Expand Up @@ -91,8 +90,8 @@ while (( "$#" )); do
fi

if [ "$1" = "import" ]; then
echo "*** imports data from $FIXTURE_GZ"
$PYTHON_EXE $DJANGO_ADMIN loaddata $FIXTURE_GZ --settings=$DJANGO_SETTINGS_MODULE
echo "*** imports data from $FIXTURE"
$PYTHON_EXE $DJANGO_ADMIN loaddata $FIXTURE --settings=$DJANGO_SETTINGS_MODULE
echo "*** indexing post content"
$PYTHON_EXE -m main.server.search --settings=$DJANGO_SETTINGS_MODULE
fi
Expand All @@ -117,11 +116,10 @@ while (( "$#" )); do
echo "*** migrating data to a new datadump"
source conf/memory.sh
echo "*** DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE"
echo "*** MIGRATE_PATH=$MIGRATE_PATH, $MIGRATE_LIMIT"
echo "*** FIXTURE=$FIXTURE_GZ"
$PYTHON_EXE -m main.migrate -o $FIXTURE --path $MIGRATE_PATH --limit $MIGRATE_LIMIT
gzip -f $FIXTURE
echo "*** dumped data to $FIXTURE_GZ"
echo "*** MIGRATE_PATH=$MIGRATE_PATH"
echo "*** MIGRATE_LIMIT=$MIGRATE_LIMIT"
echo "*** FIXTURE=$FIXTURE"
$PYTHON_EXE -m main.migrate --path $MIGRATE_PATH --limit $MIGRATE_LIMIT | gzip > $FIXTURE
fi

if [ "$1" = "index" ]; then
Expand Down
Empty file modified libs/django.zip
100755 → 100644
Empty file.
24 changes: 13 additions & 11 deletions libs/django_openid_auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,27 +231,29 @@ def create_user_from_openid(self, openid_response):
url = urlparse(openid_response.identity_url)

# create a list of trusted providers
trusted = False
trusted = False

for provider in ( 'google.com', 'yahoo.com', 'myopenid.com',
'livejournal.com', 'blogspot.com', 'aol.com', 'wordpress.com'):
trusted = trusted or url.netloc.endswith(provider)

try:
# see if this user already exists in the database with the same email
user = User.objects.get(email=email)
# this should be turned off after most users migrate
trusted = trusted and settings.ALLOW_OPENID_MIGRATION

# find users with the the claimed email,
# there could be more than one, merging will be necessary
users = User.objects.filter(email=email)

if trusted and users:
user = users[0]
print "*** found user %s:%s" % (user.id, email)
except User.DoesNotExist:
user = None

# users with trusted email accounts will be merged
if not user or not trusted:
print "*** merging user %s:%s %s" % (user.id, email, user.get_full_name() )
else:
username = self._get_available_username(details['nickname'], openid_response.identity_url)
user = User.objects.create_user(username, email, password=None)
user.profile.display_name = nickname
user.profile.save()
print "*** creating user %s:%s" % (user.id, email)
else:
print "*** merging user %s:%s %s" % (user.id, email, user.get_full_name() )

self.associate_openid(user, openid_response)
self.update_user_details(user, details, openid_response)
Expand Down
Binary file modified libs/libraries.zip
100755 → 100644
Binary file not shown.
2 changes: 1 addition & 1 deletion main/server/templates/post.edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<label class="control-label" for="tag_val">Tags</label>
<div class="controls">
{{form.tag_val}}
<span class="help-inline">{{form.tag_val.errors}}</span>
<div><span class="help-block">separate tags with spaces {{form.tag_val.errors}}</span></div>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def path(*args):
OPENID_USE_AS_ADMIN_LOGIN = True

# allow migration based on user email
ALLOW_MIGRATION = True
ALLOW_OPENID_MIGRATION = True

LOGIN_URL = '/openid/login/'
LOGIN_REDIRECT_URL = '/'
Expand Down

0 comments on commit cee28d1

Please sign in to comment.