GitHub PullRequestReviewCommentEvent at 2014-11-03 20:56:09
Repository: XBlock
Actor: cahrens
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/edx/XBlock/pulls/comments/19763221","id":19763221,"diff_hunk":"@@ -0,0 +1,107 @@\n+\"\"\"\n+Validation information for an xblock instance.\n+\"\"\"\n+\n+\n+class ValidationMessageTypes(object):\n+    \"\"\"\n+    Supported validation message types.\n+    \"\"\"\n+    WARNING = \"warning\"\n+    ERROR = \"error\"\n+\n+    @classmethod\n+    def contains(cls, message_type):\n+        \"\"\"\n+        Used to determine if the user-supplied string maps to one of the supported validation types.\n+        \"\"\"\n+        types = [getattr(cls, attr) for attr in dir(cls) if not callable(attr) and not attr.startswith(\"__\")]\n+        return message_type in types\n+\n+\n+class Validation(object):\n+    \"\"\"\n+    An object containing validation information for an xblock instance.\n+\n+    An instance of this class can be used as a boolean to determine if the xblock has validation issues,\n+    where `True` signifies that the xblock passes validation.\n+    \"\"\"\n+\n+    MESSAGE_TYPES = ValidationMessageTypes()\n+\n+    @classmethod\n+    def create_message(cls, message_type, message_text):\n+        \"\"\"\n+        Create a new message to add to the messages stored in a `Validation` instance.\n+\n+        :param message_type: the type associated with this message\n+        :type message_type: one of the types declared in subclass of `ValidationMessageTypes`\n+        :param message_text: the textual message\n+        :type message_text: unicode string\n+        \"\"\"\n+        if not cls.MESSAGE_TYPES.contains(message_type):\n+            raise TypeError(\"Unknown message_type: \" + message_type)\n+        if not isinstance(message_text, unicode):\n+            raise TypeError(\"Message text must be unicode\")\n+        return {\n+            \"type\": message_type,\n+            \"text\": message_text\n+        }","path":"xblock/validation.py","position":49,"original_position":49,"commit_id":"e4a0456023af664b1d765d5c7c7cc116ec0d7091","original_commit_id":"e4a0456023af664b1d765d5c7c7cc116ec0d7091","user":{"login":"cahrens","id":484484,"avatar_url":"https://avatars.githubusercontent.com/u/484484?v=2","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":"I just didn't want to introduce yet another class that needed to be subclassed and have a to_json method. I would still need StudioValidation because in addition to the additional arguments for the individual messages, StudioValidation supports a summary.","created_at":"2014-11-03T20:56:09Z","updated_at":"2014-11-03T20:56:09Z","html_url":"https://github.com/edx/XBlock/pull/250#discussion_r19763221","pull_request_url":"https://api.github.com/repos/edx/XBlock/pulls/250","_links":{"self":{"href":"https://api.github.com/repos/edx/XBlock/pulls/comments/19763221"},"html":{"href":"https://github.com/edx/XBlock/pull/250#discussion_r19763221"},"pull_request":{"href":"https://api.github.com/repos/edx/XBlock/pulls/250"}}},"pull_request":{"url":"https://api.github.com/repos/edx/XBlock/pulls/250","id":23624536,"html_url":"https://github.com/edx/XBlock/pull/250","diff_url":"https://github.com/edx/XBlock/pull/250.diff","patch_url":"https://github.com/edx/XBlock/pull/250.patch","issue_url":"https://api.github.com/repos/edx/XBlock/issues/250","number":250,"state":"open","locked":false,"title":"Introduce validation method and class in XBlock API","user":{"login":"cahrens","id":484484,"avatar_url":"https://avatars.githubusercontent.com/u/484484?v=2","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":"@cpennington and @dmitchell please review\r\n\r\nYou can see the Studio extension of the Validation class in common/lib/xmodule/xmodule/validation.py in https://github.com/edx/edx-platform/pull/5710 (which is still WIP so is not yet commented or tested).","created_at":"2014-10-30T17:51:57Z","updated_at":"2014-11-03T20:56:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8297120b9461f8e6edc36dbad5f7e0bc9976baae","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/XBlock/pulls/250/commits","review_comments_url":"https://api.github.com/repos/edx/XBlock/pulls/250/comments","review_comment_url":"https://api.github.com/repos/edx/XBlock/pulls/comments/{number}","comments_url":"https://api.github.com/repos/edx/XBlock/issues/250/comments","statuses_url":"https://api.github.com/repos/edx/XBlock/statuses/e4a0456023af664b1d765d5c7c7cc116ec0d7091","head":{"label":"edx:christina/xblock-validation","ref":"christina/xblock-validation","sha":"e4a0456023af664b1d765d5c7c7cc116ec0d7091","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","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":8710321,"name":"XBlock","full_name":"edx/XBlock","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","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/XBlock","description":"XBlock courseware component architecture","fork":false,"url":"https://api.github.com/repos/edx/XBlock","forks_url":"https://api.github.com/repos/edx/XBlock/forks","keys_url":"https://api.github.com/repos/edx/XBlock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/XBlock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/XBlock/teams","hooks_url":"https://api.github.com/repos/edx/XBlock/hooks","issue_events_url":"https://api.github.com/repos/edx/XBlock/issues/events{/number}","events_url":"https://api.github.com/repos/edx/XBlock/events","assignees_url":"https://api.github.com/repos/edx/XBlock/assignees{/user}","branches_url":"https://api.github.com/repos/edx/XBlock/branches{/branch}","tags_url":"https://api.github.com/repos/edx/XBlock/tags","blobs_url":"https://api.github.com/repos/edx/XBlock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/XBlock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/XBlock/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/XBlock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/XBlock/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/XBlock/languages","stargazers_url":"https://api.github.com/repos/edx/XBlock/stargazers","contributors_url":"https://api.github.com/repos/edx/XBlock/contributors","subscribers_url":"https://api.github.com/repos/edx/XBlock/subscribers","subscription_url":"https://api.github.com/repos/edx/XBlock/subscription","commits_url":"https://api.github.com/repos/edx/XBlock/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/XBlock/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/XBlock/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/XBlock/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/XBlock/contents/{+path}","compare_url":"https://api.github.com/repos/edx/XBlock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/XBlock/merges","archive_url":"https://api.github.com/repos/edx/XBlock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/XBlock/downloads","issues_url":"https://api.github.com/repos/edx/XBlock/issues{/number}","pulls_url":"https://api.github.com/repos/edx/XBlock/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/XBlock/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/XBlock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/XBlock/labels{/name}","releases_url":"https://api.github.com/repos/edx/XBlock/releases{/id}","created_at":"2013-03-11T18:35:36Z","updated_at":"2014-10-31T23:03:26Z","pushed_at":"2014-11-03T20:07:49Z","git_url":"git://github.com/edx/XBlock.git","ssh_url":"git@github.com:edx/XBlock.git","clone_url":"https://github.com/edx/XBlock.git","svn_url":"https://github.com/edx/XBlock","homepage":null,"size":8971,"stargazers_count":365,"watchers_count":365,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":160,"mirror_url":null,"open_issues_count":26,"forks":160,"open_issues":26,"watchers":365,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"e3e4c3cff6ffb8c4819cad7a2c761fca3c5731fe","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","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":8710321,"name":"XBlock","full_name":"edx/XBlock","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","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/XBlock","description":"XBlock courseware component architecture","fork":false,"url":"https://api.github.com/repos/edx/XBlock","forks_url":"https://api.github.com/repos/edx/XBlock/forks","keys_url":"https://api.github.com/repos/edx/XBlock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/XBlock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/XBlock/teams","hooks_url":"https://api.github.com/repos/edx/XBlock/hooks","issue_events_url":"https://api.github.com/repos/edx/XBlock/issues/events{/number}","events_url":"https://api.github.com/repos/edx/XBlock/events","assignees_url":"https://api.github.com/repos/edx/XBlock/assignees{/user}","branches_url":"https://api.github.com/repos/edx/XBlock/branches{/branch}","tags_url":"https://api.github.com/repos/edx/XBlock/tags","blobs_url":"https://api.github.com/repos/edx/XBlock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/XBlock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/XBlock/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/XBlock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/XBlock/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/XBlock/languages","stargazers_url":"https://api.github.com/repos/edx/XBlock/stargazers","contributors_url":"https://api.github.com/repos/edx/XBlock/contributors","subscribers_url":"https://api.github.com/repos/edx/XBlock/subscribers","subscription_url":"https://api.github.com/repos/edx/XBlock/subscription","commits_url":"https://api.github.com/repos/edx/XBlock/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/XBlock/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/XBlock/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/XBlock/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/XBlock/contents/{+path}","compare_url":"https://api.github.com/repos/edx/XBlock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/XBlock/merges","archive_url":"https://api.github.com/repos/edx/XBlock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/XBlock/downloads","issues_url":"https://api.github.com/repos/edx/XBlock/issues{/number}","pulls_url":"https://api.github.com/repos/edx/XBlock/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/XBlock/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/XBlock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/XBlock/labels{/name}","releases_url":"https://api.github.com/repos/edx/XBlock/releases{/id}","created_at":"2013-03-11T18:35:36Z","updated_at":"2014-10-31T23:03:26Z","pushed_at":"2014-11-03T20:07:49Z","git_url":"git://github.com/edx/XBlock.git","ssh_url":"git@github.com:edx/XBlock.git","clone_url":"https://github.com/edx/XBlock.git","svn_url":"https://github.com/edx/XBlock","homepage":null,"size":8971,"stargazers_count":365,"watchers_count":365,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":160,"mirror_url":null,"open_issues_count":26,"forks":160,"open_issues":26,"watchers":365,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/XBlock/pulls/250"},"html":{"href":"https://github.com/edx/XBlock/pull/250"},"issue":{"href":"https://api.github.com/repos/edx/XBlock/issues/250"},"comments":{"href":"https://api.github.com/repos/edx/XBlock/issues/250/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/XBlock/pulls/250/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/XBlock/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/edx/XBlock/pulls/250/commits"},"statuses":{"href":"https://api.github.com/repos/edx/XBlock/statuses/e4a0456023af664b1d765d5c7c7cc116ec0d7091"}}}}