Fix a few showstoppers in the Services changes.

This commit is contained in:
2010-10-14 10:41:37 +01:00
parent df1bdde396
commit 130bc0afb3
3 changed files with 9 additions and 9 deletions

View File

@@ -1,5 +1,7 @@
import hashlib
import random
import re
import unicodedata
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
@@ -135,9 +137,7 @@ def service_add(request):
form = clsform(request.POST)
if form.is_valid():
acc = ServiceAccount()
acc.user = request.user
acc.service = form.cleaned_data['service']
acc = ServiceAccount(user=request.user, service=form.cleaned_data['service'])
acc.character = form.cleaned_data['character']
if acc.service.settings['require_password']:
@@ -149,7 +149,7 @@ def service_add(request):
acc.password = None
# Decode unicode and remove invalid characters
username = re.sub('[^a-zA-Z0-9_-]+', '', unicodedata.normalize('NFKD', self.character.name).encode('ASCII', 'ignore'))
username = re.sub('[^a-zA-Z0-9_-]+', '', unicodedata.normalize('NFKD', acc.character.name).encode('ASCII', 'ignore'))
if acc.service.api_class.check_user(username):
error = "Username already exists on the target service, please contact an admin."