{"action":"created","comment":{"url":"https://api.github.com/repos/tableau/document-api-python/pulls/comments/91891038","pull_request_review_id":12399293,"id":91891038,"diff_hunk":"@@ -235,6 +235,56 @@ def clear_repository_location(self):\n             self._datasourceXML.remove(tag)\n \n     ###########\n+    # Folders\n+    ###########\n+\n+    @property\n+    def folders(self):\n+        \"\"\" Returns all folders.\n+        \"\"\"\n+        return self._datasourceTree.findall('.//folder')\n+\n+    def add_folder(self, name, role, fields):\n+        \"\"\" Adds a folder field with the given fields.\n+\n+        Args:\n+            name:  Name of the new folder. String.\n+            role:  Role of the new folder. String.\n+            fields:  Fields of the new folder. String.\n+\n+        Returns:\n+            The new calculated folder that was created. ET.Element.\n+        \"\"\"\n+        # TODO: It might be better to create a dedicated \"Folder\" object:\n+        # Currently, there is a difference in Folder-Objects (ET.Elements) and\n+        # other Fields (dedicated Field-objects)\n+        folder = ET.Element('folder')\n+        folder.set('name', name)\n+        folder.set('role', role)\n+\n+        for field in fields:\n+            item = ET.Element(\"folder-item\")\n+            item.set(\"name\", field)\n+            item.set(\"type\", \"field\")\n+            folder.append(item)\n+\n+        self._datasourceTree.getroot().append(folder)\n+        return folder\n+\n+    def add_to_folder(self, name, fields):\n+        \"\"\" Adds fields to a folder field with the given fields.\n+        \"\"\"\n+        folder = self._datasourceTree.find(\".//folder/[@name='{}']\".format(name))","path":"tableaudocumentapi/datasource.py","position":43,"original_position":43,"commit_id":"3bf75c07d309c7ab5018451023639394db67a426","original_commit_id":"3bf75c07d309c7ab5018451023639394db67a426","user":{"login":"KernpunktAnalytics","id":23070126,"avatar_url":"https://avatars.githubusercontent.com/u/23070126?v=3","gravatar_id":"","url":"https://api.github.com/users/KernpunktAnalytics","html_url":"https://github.com/KernpunktAnalytics","followers_url":"https://api.github.com/users/KernpunktAnalytics/followers","following_url":"https://api.github.com/users/KernpunktAnalytics/following{/other_user}","gists_url":"https://api.github.com/users/KernpunktAnalytics/gists{/gist_id}","starred_url":"https://api.github.com/users/KernpunktAnalytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KernpunktAnalytics/subscriptions","organizations_url":"https://api.github.com/users/KernpunktAnalytics/orgs","repos_url":"https://api.github.com/users/KernpunktAnalytics/repos","events_url":"https://api.github.com/users/KernpunktAnalytics/events{/privacy}","received_events_url":"https://api.github.com/users/KernpunktAnalytics/received_events","type":"User","site_admin":false},"body":"Definitely! Although I'm not quite sure what you mean by\r\n> (You get to pick the text, the current theme seems to be 'food-item' in another language)\r\n(Sorry, english isn't my first language :) )","created_at":"2016-12-12T06:59:42Z","updated_at":"2016-12-12T06:59:42Z","html_url":"https://github.com/tableau/document-api-python/pull/113#discussion_r91891038","pull_request_url":"https://api.github.com/repos/tableau/document-api-python/pulls/113","_links":{"self":{"href":"https://api.github.com/repos/tableau/document-api-python/pulls/comments/91891038"},"html":{"href":"https://github.com/tableau/document-api-python/pull/113#discussion_r91891038"},"pull_request":{"href":"https://api.github.com/repos/tableau/document-api-python/pulls/113"}}},"pull_request":{"url":"https://api.github.com/repos/tableau/document-api-python/pulls/113","id":92494325,"html_url":"https://github.com/tableau/document-api-python/pull/113","diff_url":"https://github.com/tableau/document-api-python/pull/113.diff","patch_url":"https://github.com/tableau/document-api-python/pull/113.patch","issue_url":"https://api.github.com/repos/tableau/document-api-python/issues/113","number":113,"state":"open","locked":false,"title":"Added the ability to create and modify folders","user":{"login":"KernpunktAnalytics","id":23070126,"avatar_url":"https://avatars.githubusercontent.com/u/23070126?v=3","gravatar_id":"","url":"https://api.github.com/users/KernpunktAnalytics","html_url":"https://github.com/KernpunktAnalytics","followers_url":"https://api.github.com/users/KernpunktAnalytics/followers","following_url":"https://api.github.com/users/KernpunktAnalytics/following{/other_user}","gists_url":"https://api.github.com/users/KernpunktAnalytics/gists{/gist_id}","starred_url":"https://api.github.com/users/KernpunktAnalytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KernpunktAnalytics/subscriptions","organizations_url":"https://api.github.com/users/KernpunktAnalytics/orgs","repos_url":"https://api.github.com/users/KernpunktAnalytics/repos","events_url":"https://api.github.com/users/KernpunktAnalytics/events{/privacy}","received_events_url":"https://api.github.com/users/KernpunktAnalytics/received_events","type":"User","site_admin":false},"body":"Fixes #112 \r\n\r\nAdded the ability to:\r\n* Query all existing folders\r\n* Add folders\r\n* Add fields to folders\r\n\r\nIncluding tests.\r\n\r\nTODO:\r\nIn the current revision, folders are treated as Elementtree.Element objects without any other wrapper around them. This means that folders currently differ from the other \"fields\" (aka <column .../>), which have their own wrapper object (field.py). ","created_at":"2016-11-06T17:01:43Z","updated_at":"2016-12-12T06:59:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c6d1e9ce3b0d9cb19dd3ffbfeae0f3f84e9e5ad9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/tableau/document-api-python/pulls/113/commits","review_comments_url":"https://api.github.com/repos/tableau/document-api-python/pulls/113/comments","review_comment_url":"https://api.github.com/repos/tableau/document-api-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tableau/document-api-python/issues/113/comments","statuses_url":"https://api.github.com/repos/tableau/document-api-python/statuses/3bf75c07d309c7ab5018451023639394db67a426","head":{"label":"KernpunktAnalytics:feature_folders","ref":"feature_folders","sha":"3bf75c07d309c7ab5018451023639394db67a426","user":{"login":"KernpunktAnalytics","id":23070126,"avatar_url":"https://avatars.githubusercontent.com/u/23070126?v=3","gravatar_id":"","url":"https://api.github.com/users/KernpunktAnalytics","html_url":"https://github.com/KernpunktAnalytics","followers_url":"https://api.github.com/users/KernpunktAnalytics/followers","following_url":"https://api.github.com/users/KernpunktAnalytics/following{/other_user}","gists_url":"https://api.github.com/users/KernpunktAnalytics/gists{/gist_id}","starred_url":"https://api.github.com/users/KernpunktAnalytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KernpunktAnalytics/subscriptions","organizations_url":"https://api.github.com/users/KernpunktAnalytics/orgs","repos_url":"https://api.github.com/users/KernpunktAnalytics/repos","events_url":"https://api.github.com/users/KernpunktAnalytics/events{/privacy}","received_events_url":"https://api.github.com/users/KernpunktAnalytics/received_events","type":"User","site_admin":false},"repo":{"id":71985883,"name":"document-api-python","full_name":"KernpunktAnalytics/document-api-python","owner":{"login":"KernpunktAnalytics","id":23070126,"avatar_url":"https://avatars.githubusercontent.com/u/23070126?v=3","gravatar_id":"","url":"https://api.github.com/users/KernpunktAnalytics","html_url":"https://github.com/KernpunktAnalytics","followers_url":"https://api.github.com/users/KernpunktAnalytics/followers","following_url":"https://api.github.com/users/KernpunktAnalytics/following{/other_user}","gists_url":"https://api.github.com/users/KernpunktAnalytics/gists{/gist_id}","starred_url":"https://api.github.com/users/KernpunktAnalytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KernpunktAnalytics/subscriptions","organizations_url":"https://api.github.com/users/KernpunktAnalytics/orgs","repos_url":"https://api.github.com/users/KernpunktAnalytics/repos","events_url":"https://api.github.com/users/KernpunktAnalytics/events{/privacy}","received_events_url":"https://api.github.com/users/KernpunktAnalytics/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/KernpunktAnalytics/document-api-python","description":null,"fork":true,"url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python","forks_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/forks","keys_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/teams","hooks_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/hooks","issue_events_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/issues/events{/number}","events_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/events","assignees_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/assignees{/user}","branches_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/branches{/branch}","tags_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/tags","blobs_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/statuses/{sha}","languages_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/languages","stargazers_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/stargazers","contributors_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/contributors","subscribers_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/subscribers","subscription_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/subscription","commits_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/contents/{+path}","compare_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/merges","archive_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/downloads","issues_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/issues{/number}","pulls_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/pulls{/number}","milestones_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/milestones{/number}","notifications_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/labels{/name}","releases_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/releases{/id}","deployments_url":"https://api.github.com/repos/KernpunktAnalytics/document-api-python/deployments","created_at":"2016-10-26T09:07:23Z","updated_at":"2016-10-26T09:07:25Z","pushed_at":"2016-11-12T11:07:16Z","git_url":"git://github.com/KernpunktAnalytics/document-api-python.git","ssh_url":"git@github.com:KernpunktAnalytics/document-api-python.git","clone_url":"https://github.com/KernpunktAnalytics/document-api-python.git","svn_url":"https://github.com/KernpunktAnalytics/document-api-python","homepage":null,"size":244,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tableau:development","ref":"development","sha":"a426a421b3a581eb3abf978ad9c9ca3b627bc1fb","user":{"login":"tableau","id":828667,"avatar_url":"https://avatars.githubusercontent.com/u/828667?v=3","gravatar_id":"","url":"https://api.github.com/users/tableau","html_url":"https://github.com/tableau","followers_url":"https://api.github.com/users/tableau/followers","following_url":"https://api.github.com/users/tableau/following{/other_user}","gists_url":"https://api.github.com/users/tableau/gists{/gist_id}","starred_url":"https://api.github.com/users/tableau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tableau/subscriptions","organizations_url":"https://api.github.com/users/tableau/orgs","repos_url":"https://api.github.com/users/tableau/repos","events_url":"https://api.github.com/users/tableau/events{/privacy}","received_events_url":"https://api.github.com/users/tableau/received_events","type":"Organization","site_admin":false},"repo":{"id":58406499,"name":"document-api-python","full_name":"tableau/document-api-python","owner":{"login":"tableau","id":828667,"avatar_url":"https://avatars.githubusercontent.com/u/828667?v=3","gravatar_id":"","url":"https://api.github.com/users/tableau","html_url":"https://github.com/tableau","followers_url":"https://api.github.com/users/tableau/followers","following_url":"https://api.github.com/users/tableau/following{/other_user}","gists_url":"https://api.github.com/users/tableau/gists{/gist_id}","starred_url":"https://api.github.com/users/tableau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tableau/subscriptions","organizations_url":"https://api.github.com/users/tableau/orgs","repos_url":"https://api.github.com/users/tableau/repos","events_url":"https://api.github.com/users/tableau/events{/privacy}","received_events_url":"https://api.github.com/users/tableau/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tableau/document-api-python","description":"Create and modify Tableau workbook and datasource files","fork":false,"url":"https://api.github.com/repos/tableau/document-api-python","forks_url":"https://api.github.com/repos/tableau/document-api-python/forks","keys_url":"https://api.github.com/repos/tableau/document-api-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tableau/document-api-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tableau/document-api-python/teams","hooks_url":"https://api.github.com/repos/tableau/document-api-python/hooks","issue_events_url":"https://api.github.com/repos/tableau/document-api-python/issues/events{/number}","events_url":"https://api.github.com/repos/tableau/document-api-python/events","assignees_url":"https://api.github.com/repos/tableau/document-api-python/assignees{/user}","branches_url":"https://api.github.com/repos/tableau/document-api-python/branches{/branch}","tags_url":"https://api.github.com/repos/tableau/document-api-python/tags","blobs_url":"https://api.github.com/repos/tableau/document-api-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tableau/document-api-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tableau/document-api-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/tableau/document-api-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tableau/document-api-python/statuses/{sha}","languages_url":"https://api.github.com/repos/tableau/document-api-python/languages","stargazers_url":"https://api.github.com/repos/tableau/document-api-python/stargazers","contributors_url":"https://api.github.com/repos/tableau/document-api-python/contributors","subscribers_url":"https://api.github.com/repos/tableau/document-api-python/subscribers","subscription_url":"https://api.github.com/repos/tableau/document-api-python/subscription","commits_url":"https://api.github.com/repos/tableau/document-api-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/tableau/document-api-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/tableau/document-api-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/tableau/document-api-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/tableau/document-api-python/contents/{+path}","compare_url":"https://api.github.com/repos/tableau/document-api-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tableau/document-api-python/merges","archive_url":"https://api.github.com/repos/tableau/document-api-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tableau/document-api-python/downloads","issues_url":"https://api.github.com/repos/tableau/document-api-python/issues{/number}","pulls_url":"https://api.github.com/repos/tableau/document-api-python/pulls{/number}","milestones_url":"https://api.github.com/repos/tableau/document-api-python/milestones{/number}","notifications_url":"https://api.github.com/repos/tableau/document-api-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tableau/document-api-python/labels{/name}","releases_url":"https://api.github.com/repos/tableau/document-api-python/releases{/id}","deployments_url":"https://api.github.com/repos/tableau/document-api-python/deployments","created_at":"2016-05-09T20:38:09Z","updated_at":"2016-12-09T20:59:06Z","pushed_at":"2016-12-12T05:06:28Z","git_url":"git://github.com/tableau/document-api-python.git","ssh_url":"git@github.com:tableau/document-api-python.git","clone_url":"https://github.com/tableau/document-api-python.git","svn_url":"https://github.com/tableau/document-api-python","homepage":"","size":349,"stargazers_count":40,"watchers_count":40,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":17,"mirror_url":null,"open_issues_count":32,"forks":17,"open_issues":32,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tableau/document-api-python/pulls/113"},"html":{"href":"https://github.com/tableau/document-api-python/pull/113"},"issue":{"href":"https://api.github.com/repos/tableau/document-api-python/issues/113"},"comments":{"href":"https://api.github.com/repos/tableau/document-api-python/issues/113/comments"},"review_comments":{"href":"https://api.github.com/repos/tableau/document-api-python/pulls/113/comments"},"review_comment":{"href":"https://api.github.com/repos/tableau/document-api-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tableau/document-api-python/pulls/113/commits"},"statuses":{"href":"https://api.github.com/repos/tableau/document-api-python/statuses/3bf75c07d309c7ab5018451023639394db67a426"}}}}
{"actor":{"display_login":"KernpunktAnalytics"}}