{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/26396506","id":26396506,"diff_hunk":"@@ -1,381 +0,0 @@\n-\"\"\"Python API for user accounts.\n-\n-\n-Account information includes a student's username, password, and email\n-address, but does NOT include user profile information (i.e., demographic\n-information and preferences).\n-\n-\"\"\"\n-from django.conf import settings\n-from django.db import transaction, IntegrityError\n-from django.core.validators import validate_email, validate_slug, ValidationError\n-\n-from ..forms import PasswordResetFormNoActive\n-from ..models import User, UserProfile, Registration, PendingEmailChange\n-from ..helpers import intercept_errors\n-\n-\n-USERNAME_MIN_LENGTH = 2\n-USERNAME_MAX_LENGTH = 30\n-\n-EMAIL_MIN_LENGTH = 3\n-EMAIL_MAX_LENGTH = 254\n-\n-PASSWORD_MIN_LENGTH = 2\n-PASSWORD_MAX_LENGTH = 75\n-\n-\n-class AccountRequestError(Exception):\n-    \"\"\"There was a problem with the request to the account API. \"\"\"\n-    pass\n-\n-\n-class AccountInternalError(Exception):\n-    \"\"\"An internal error occurred in the account API. \"\"\"\n-    pass\n-\n-\n-class AccountUserAlreadyExists(AccountRequestError):\n-    \"\"\"User with the same username and/or email already exists. \"\"\"\n-    pass\n-\n-\n-class AccountUsernameInvalid(AccountRequestError):\n-    \"\"\"The requested username is not in a valid format. \"\"\"\n-    pass\n-\n-\n-class AccountEmailInvalid(AccountRequestError):\n-    \"\"\"The requested email is not in a valid format. \"\"\"\n-    pass\n-\n-\n-class AccountPasswordInvalid(AccountRequestError):\n-    \"\"\"The requested password is not in a valid format. \"\"\"\n-    pass\n-\n-\n-class AccountUserNotFound(AccountRequestError):\n-    \"\"\"The requested user does not exist. \"\"\"\n-    pass\n-\n-\n-class AccountNotAuthorized(AccountRequestError):\n-    \"\"\"The user is not authorized to perform the requested action. \"\"\"\n-    pass\n-\n-\n-class AccountUpdateError(AccountRequestError):\n-    \"\"\"\n-    An update to the account failed. More detailed information is present in developer_message,\n-    and depending on the type of error encountered, there may also be a non-null user_message field.\n-    \"\"\"\n-    def __init__(self, developer_message, user_message=None):\n-        self.developer_message = developer_message\n-        self.user_message = user_message\n-\n-\n-class AccountValidationError(AccountRequestError):\n-    \"\"\"\n-    Validation issues were found with the supplied data. More detailed information is present in field_errors,\n-    a dict with specific information about each field that failed validation. For each field,\n-    there will be at least a developer_message describing the validation issue, and possibly\n-    also a user_message.\n-    \"\"\"\n-    def __init__(self, field_errors):\n-        self.field_errors = field_errors\n-\n-\n-@intercept_errors(AccountInternalError, ignore_errors=[AccountRequestError])\n-@transaction.commit_on_success\n-def create_account(username, password, email):\n-    \"\"\"Create a new user account.\n-\n-    This will implicitly create an empty profile for the user.\n-\n-    WARNING: This function does NOT yet implement all the features\n-    in `student/views.py`.  Until it does, please use this method\n-    ONLY for tests of the account API, not in production code.\n-    In particular, these are currently missing:\n-\n-    * 3rd party auth\n-    * External auth (shibboleth)\n-    * Complex password policies (ENFORCE_PASSWORD_POLICY)\n-\n-    In addition, we assume that some functionality is handled\n-    at higher layers:\n-\n-    * Analytics events\n-    * Activation email\n-    * Terms of service / honor code checking\n-    * Recording demographic info (use profile API)\n-    * Auto-enrollment in courses (if invited via instructor dash)\n-\n-    Args:\n-        username (unicode): The username for the new account.\n-        password (unicode): The user's password.\n-        email (unicode): The email address associated with the account.\n-\n-    Returns:\n-        unicode: an activation key for the account.\n-\n-    Raises:\n-        AccountUserAlreadyExists\n-        AccountUsernameInvalid\n-        AccountEmailInvalid\n-        AccountPasswordInvalid\n-\n-    \"\"\"\n-    # Validate the username, password, and email\n-    # This will raise an exception if any of these are not in a valid format.\n-    _validate_username(username)\n-    _validate_password(password, username)\n-    _validate_email(email)\n-\n-    # Create the user account, setting them to \"inactive\" until they activate their account.\n-    user = User(username=username, email=email, is_active=False)\n-    user.set_password(password)\n-\n-    try:\n-        user.save()\n-    except IntegrityError:\n-        raise AccountUserAlreadyExists\n-\n-    # Create a registration to track the activation process\n-    # This implicitly saves the registration.\n-    registration = Registration()\n-    registration.register(user)\n-\n-    # Create an empty user profile with default values\n-    UserProfile(user=user).save()\n-\n-    # Return the activation key, which the caller should send to the user\n-    return registration.activation_key\n-\n-\n-def check_account_exists(username=None, email=None):\n-    \"\"\"Check whether an account with a particular username or email already exists.\n-\n-    Keyword Arguments:\n-        username (unicode)\n-        email (unicode)\n-\n-    Returns:\n-        list of conflicting fields\n-\n-    Example Usage:\n-        >>> account_api.check_account_exists(username=\"bob\")\n-        []\n-        >>> account_api.check_account_exists(username=\"ted\", email=\"ted@example.com\")\n-        [\"email\", \"username\"]\n-\n-    \"\"\"\n-    conflicts = []\n-\n-    if email is not None and User.objects.filter(email=email).exists():\n-        conflicts.append(\"email\")\n-\n-    if username is not None and User.objects.filter(username=username).exists():\n-        conflicts.append(\"username\")\n-\n-    return conflicts\n-\n-\n-@intercept_errors(AccountInternalError, ignore_errors=[AccountRequestError])\n-def account_info(username):","path":"openedx/core/djangoapps/user_api/api/account.py","position":185,"original_position":185,"commit_id":"634bb98c638021e8ff1ed9795dc1e44efd3206c1","original_commit_id":"634bb98c638021e8ff1ed9795dc1e44efd3206c1","user":{"login":"cahrens","id":484484,"avatar_url":"https://avatars.githubusercontent.com/u/484484?v=3","gravatar_id":"","url":"https://api.github.com/users/cahrens","html_url":"https://github.com/cahrens","followers_url":"https://api.github.com/users/cahrens/followers","following_url":"https://api.github.com/users/cahrens/following{/other_user}","gists_url":"https://api.github.com/users/cahrens/gists{/gist_id}","starred_url":"https://api.github.com/users/cahrens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cahrens/subscriptions","organizations_url":"https://api.github.com/users/cahrens/orgs","repos_url":"https://api.github.com/users/cahrens/repos","events_url":"https://api.github.com/users/cahrens/events{/privacy}","received_events_url":"https://api.github.com/users/cahrens/received_events","type":"User","site_admin":false},"body":"Except this one method was deleted.","created_at":"2015-03-13T15:47:10Z","updated_at":"2015-03-13T15:47:10Z","html_url":"https://github.com/edx/edx-platform/pull/7327#discussion_r26396506","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/7327","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/26396506"},"html":{"href":"https://github.com/edx/edx-platform/pull/7327#discussion_r26396506"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/7327"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/7327","id":31050843,"html_url":"https://github.com/edx/edx-platform/pull/7327","diff_url":"https://github.com/edx/edx-platform/pull/7327.diff","patch_url":"https://github.com/edx/edx-platform/pull/7327.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/7327","number":7327,"state":"open","locked":false,"title":"Implement full preferences API","user":{"login":"cahrens","id":484484,"avatar_url":"https://avatars.githubusercontent.com/u/484484?v=3","gravatar_id":"","url":"https://api.github.com/users/cahrens","html_url":"https://github.com/cahrens","followers_url":"https://api.github.com/users/cahrens/followers","following_url":"https://api.github.com/users/cahrens/following{/other_user}","gists_url":"https://api.github.com/users/cahrens/gists{/gist_id}","starred_url":"https://api.github.com/users/cahrens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cahrens/subscriptions","organizations_url":"https://api.github.com/users/cahrens/orgs","repos_url":"https://api.github.com/users/cahrens/repos","events_url":"https://api.github.com/users/cahrens/events{/privacy}","received_events_url":"https://api.github.com/users/cahrens/received_events","type":"User","site_admin":false},"body":"https://openedx.atlassian.net/browse/TNL-1493\r\n\r\nReplaces #7279.","created_at":"2015-03-12T16:07:59Z","updated_at":"2015-03-13T15:47:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"21e8b60ccf1d351cbe38ac9698fc6faa47af371e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/7327/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/7327/comments","review_comment_url":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/7327/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/634bb98c638021e8ff1ed9795dc1e44efd3206c1","head":{"label":"edx:andya/preferences-api","ref":"andya/preferences-api","sha":"634bb98c638021e8ff1ed9795dc1e44efd3206c1","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2015-03-13T15:19:53Z","pushed_at":"2015-03-13T15:37:12Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://openedx.org/","size":1816027,"stargazers_count":1788,"watchers_count":1788,"language":"Gettext Catalog","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1022,"mirror_url":null,"open_issues_count":143,"forks":1022,"open_issues":143,"watchers":1788,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"4e454ccaed75197c555475978ed3e315f6ee40e4","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2015-03-13T15:19:53Z","pushed_at":"2015-03-13T15:37:12Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://openedx.org/","size":1816027,"stargazers_count":1788,"watchers_count":1788,"language":"Gettext Catalog","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1022,"mirror_url":null,"open_issues_count":143,"forks":1022,"open_issues":143,"watchers":1788,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/7327"},"html":{"href":"https://github.com/edx/edx-platform/pull/7327"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/7327"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/7327/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/7327/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/7327/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/634bb98c638021e8ff1ed9795dc1e44efd3206c1"}}}}