def get_givens(request): # Parameters handle = request.POST['handle'] service = request.POST['service'] # The tagger is the logged in user tagger = request.user.get_profile().active_face # The destination is given in the query. It should exist. If it doesn't, # someone made a bad request. Let it throw. target = identity.get_face(handle, service) # Do the lookup tags = tagging.get_tagset(tagger, target) # Send the response return HttpResponse(json.dumps({'tags': tags}))
def register_user(username, password, email, send_email=True): # Doean Agent/Identity exist for this email address? If not, make them. # While we're at it, make sure that the email address is unclaimed. emailface = identity.get_face(email, 'email', create=True) if emailface.owner is not None: raise Exception('Trying to register user, but email address ' + email + ' already claimed.') # Create the user account user = User.objects.create_user(username, email, password=password) user.is_active = False user.save() # Create the user profile (extra rainbeard-specific user data) profile = Profile(user=user) profile.save() # Request a claim on the email address request_claim(profile, emailface, quiet=(not send_email)) return user