{"action":"created","comment":{"url":"https://api.github.com/repos/dimagi/touchforms/pulls/comments/30694090","id":30694090,"diff_hunk":"@@ -290,7 +290,29 @@ def get_raw_instance(session_id, auth=None):\n             raise InvalidSessionIdException(\"Invalid Touchforms Session Id\")\n         else:\n             raise TouchformsException(error)\n-    return response[\"output\"]\n+    return response\n+\n+\n+def evaluate_xpath(session_id, xpath, auth=None):\n+    \"\"\"\n+    Gets the raw xml instance of the current session regardless of the state that we're in (used for logging partially complete\n+    forms to couch when errors happen).\n+    \"\"\"\n+    data = {\n+        \"action\":\"evaluate-xpath\",\n+        \"session-id\": session_id,\n+        \"xpath\": xpath,\n+        }\n+    response = post_data(json.dumps(data), settings.XFORMS_PLAYER_URL, \"text/json\", auth)\n+    response = json.loads(response)\n+    if \"error\" in response:\n+        error = response[\"error\"]\n+        if error == \"invalid session id\":","path":"touchforms/formplayer/api.py","position":22,"original_position":22,"commit_id":"13aff81027b6ee59234abb3f05c4cfcdc240a723","original_commit_id":"13aff81027b6ee59234abb3f05c4cfcdc240a723","user":{"login":"czue","id":66555,"avatar_url":"https://avatars.githubusercontent.com/u/66555?v=3","gravatar_id":"","url":"https://api.github.com/users/czue","html_url":"https://github.com/czue","followers_url":"https://api.github.com/users/czue/followers","following_url":"https://api.github.com/users/czue/following{/other_user}","gists_url":"https://api.github.com/users/czue/gists{/gist_id}","starred_url":"https://api.github.com/users/czue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czue/subscriptions","organizations_url":"https://api.github.com/users/czue/orgs","repos_url":"https://api.github.com/users/czue/repos","events_url":"https://api.github.com/users/czue/events{/privacy}","received_events_url":"https://api.github.com/users/czue/received_events","type":"User","site_admin":false},"body":"this appears to be copy/pasted from the `get_raw_instance` function (which explains the doc string). I think pull the error handling out into a separate function called `check_for_errors` or something? it looke like `\"invalid session id\"` is also referenced in another place, would be nice to at least reconcile those","created_at":"2015-05-20T12:06:47Z","updated_at":"2015-05-20T12:06:47Z","html_url":"https://github.com/dimagi/touchforms/pull/110#discussion_r30694090","pull_request_url":"https://api.github.com/repos/dimagi/touchforms/pulls/110","_links":{"self":{"href":"https://api.github.com/repos/dimagi/touchforms/pulls/comments/30694090"},"html":{"href":"https://github.com/dimagi/touchforms/pull/110#discussion_r30694090"},"pull_request":{"href":"https://api.github.com/repos/dimagi/touchforms/pulls/110"}}},"pull_request":{"url":"https://api.github.com/repos/dimagi/touchforms/pulls/110","id":35264977,"html_url":"https://github.com/dimagi/touchforms/pull/110","diff_url":"https://github.com/dimagi/touchforms/pull/110.diff","patch_url":"https://github.com/dimagi/touchforms/pull/110.patch","issue_url":"https://api.github.com/repos/dimagi/touchforms/issues/110","number":110,"state":"open","locked":false,"title":"Tf instance viewer feature flag","user":{"login":"wpride","id":2293064,"avatar_url":"https://avatars.githubusercontent.com/u/2293064?v=3","gravatar_id":"","url":"https://api.github.com/users/wpride","html_url":"https://github.com/wpride","followers_url":"https://api.github.com/users/wpride/followers","following_url":"https://api.github.com/users/wpride/following{/other_user}","gists_url":"https://api.github.com/users/wpride/gists{/gist_id}","starred_url":"https://api.github.com/users/wpride/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wpride/subscriptions","organizations_url":"https://api.github.com/users/wpride/orgs","repos_url":"https://api.github.com/users/wpride/repos","events_url":"https://api.github.com/users/wpride/events{/privacy}","received_events_url":"https://api.github.com/users/wpride/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-12T20:06:06Z","updated_at":"2015-05-20T12:06:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2711162b746d62450fe726a9d2910fcdb3cab497","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dimagi/touchforms/pulls/110/commits","review_comments_url":"https://api.github.com/repos/dimagi/touchforms/pulls/110/comments","review_comment_url":"https://api.github.com/repos/dimagi/touchforms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dimagi/touchforms/issues/110/comments","statuses_url":"https://api.github.com/repos/dimagi/touchforms/statuses/13aff81027b6ee59234abb3f05c4cfcdc240a723","head":{"label":"dimagi:tf-instance-viewer-feature-flag","ref":"tf-instance-viewer-feature-flag","sha":"13aff81027b6ee59234abb3f05c4cfcdc240a723","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":1330256,"name":"touchforms","full_name":"dimagi/touchforms","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/touchforms","description":"web-based javarosa xforms player built for touchscreen kiosks","fork":false,"url":"https://api.github.com/repos/dimagi/touchforms","forks_url":"https://api.github.com/repos/dimagi/touchforms/forks","keys_url":"https://api.github.com/repos/dimagi/touchforms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/touchforms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/touchforms/teams","hooks_url":"https://api.github.com/repos/dimagi/touchforms/hooks","issue_events_url":"https://api.github.com/repos/dimagi/touchforms/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/touchforms/events","assignees_url":"https://api.github.com/repos/dimagi/touchforms/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/touchforms/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/touchforms/tags","blobs_url":"https://api.github.com/repos/dimagi/touchforms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/touchforms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/touchforms/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/touchforms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/touchforms/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/touchforms/languages","stargazers_url":"https://api.github.com/repos/dimagi/touchforms/stargazers","contributors_url":"https://api.github.com/repos/dimagi/touchforms/contributors","subscribers_url":"https://api.github.com/repos/dimagi/touchforms/subscribers","subscription_url":"https://api.github.com/repos/dimagi/touchforms/subscription","commits_url":"https://api.github.com/repos/dimagi/touchforms/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/touchforms/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/touchforms/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/touchforms/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimagi/touchforms/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/touchforms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/touchforms/merges","archive_url":"https://api.github.com/repos/dimagi/touchforms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/touchforms/downloads","issues_url":"https://api.github.com/repos/dimagi/touchforms/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/touchforms/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/touchforms/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/touchforms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/touchforms/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/touchforms/releases{/id}","created_at":"2011-02-05T01:25:38Z","updated_at":"2015-05-08T15:14:19Z","pushed_at":"2015-05-19T22:58:09Z","git_url":"git://github.com/dimagi/touchforms.git","ssh_url":"git@github.com:dimagi/touchforms.git","clone_url":"https://github.com/dimagi/touchforms.git","svn_url":"https://github.com/dimagi/touchforms","homepage":"","size":23957,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":7,"forks":9,"open_issues":7,"watchers":5,"default_branch":"master"}},"base":{"label":"dimagi:master","ref":"master","sha":"b35de5fd06630ab8a4439271832258e83b7e9e4f","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":1330256,"name":"touchforms","full_name":"dimagi/touchforms","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/touchforms","description":"web-based javarosa xforms player built for touchscreen kiosks","fork":false,"url":"https://api.github.com/repos/dimagi/touchforms","forks_url":"https://api.github.com/repos/dimagi/touchforms/forks","keys_url":"https://api.github.com/repos/dimagi/touchforms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/touchforms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/touchforms/teams","hooks_url":"https://api.github.com/repos/dimagi/touchforms/hooks","issue_events_url":"https://api.github.com/repos/dimagi/touchforms/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/touchforms/events","assignees_url":"https://api.github.com/repos/dimagi/touchforms/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/touchforms/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/touchforms/tags","blobs_url":"https://api.github.com/repos/dimagi/touchforms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/touchforms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/touchforms/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/touchforms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/touchforms/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/touchforms/languages","stargazers_url":"https://api.github.com/repos/dimagi/touchforms/stargazers","contributors_url":"https://api.github.com/repos/dimagi/touchforms/contributors","subscribers_url":"https://api.github.com/repos/dimagi/touchforms/subscribers","subscription_url":"https://api.github.com/repos/dimagi/touchforms/subscription","commits_url":"https://api.github.com/repos/dimagi/touchforms/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/touchforms/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/touchforms/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/touchforms/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimagi/touchforms/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/touchforms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/touchforms/merges","archive_url":"https://api.github.com/repos/dimagi/touchforms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/touchforms/downloads","issues_url":"https://api.github.com/repos/dimagi/touchforms/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/touchforms/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/touchforms/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/touchforms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/touchforms/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/touchforms/releases{/id}","created_at":"2011-02-05T01:25:38Z","updated_at":"2015-05-08T15:14:19Z","pushed_at":"2015-05-19T22:58:09Z","git_url":"git://github.com/dimagi/touchforms.git","ssh_url":"git@github.com:dimagi/touchforms.git","clone_url":"https://github.com/dimagi/touchforms.git","svn_url":"https://github.com/dimagi/touchforms","homepage":"","size":23957,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":7,"forks":9,"open_issues":7,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dimagi/touchforms/pulls/110"},"html":{"href":"https://github.com/dimagi/touchforms/pull/110"},"issue":{"href":"https://api.github.com/repos/dimagi/touchforms/issues/110"},"comments":{"href":"https://api.github.com/repos/dimagi/touchforms/issues/110/comments"},"review_comments":{"href":"https://api.github.com/repos/dimagi/touchforms/pulls/110/comments"},"review_comment":{"href":"https://api.github.com/repos/dimagi/touchforms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dimagi/touchforms/pulls/110/commits"},"statuses":{"href":"https://api.github.com/repos/dimagi/touchforms/statuses/13aff81027b6ee59234abb3f05c4cfcdc240a723"}}}}