{"action":"created","comment":{"url":"https://api.github.com/repos/magenta-aps/mora/pulls/comments/211254286","pull_request_review_id":147634483,"id":211254286,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMTI1NDI4Ng==","diff_hunk":"@@ -473,14 +473,25 @@ def create_org_unit():\n \n     name = common.checked_get(req, keys.NAME, \"\", required=True)\n \n-    parent = common.checked_get(req, keys.PARENT, {}, required=True)\n-    parent_uuid = common.get_uuid(parent)\n+    parent_uuid = common.get_mapping_uuid(req, keys.PARENT, required=True)\n     organisationenhed_get = c.organisationenhed.get(parent_uuid)\n-    org_uuid = organisationenhed_get['relationer']['tilhoerer'][0]['uuid']\n \n-    org_unit_type = common.checked_get(req, keys.ORG_UNIT_TYPE, {},\n-                                       required=True)\n-    org_unit_type_uuid = common.get_uuid(org_unit_type)\n+    if organisationenhed_get:\n+        org_uuid = organisationenhed_get['relationer']['tilhoerer'][0]['uuid']\n+    else:\n+        organisation_get = c.organisation(uuid=parent_uuid)\n+\n+        if organisation_get:\n+            org_uuid = parent_uuid\n+        else:\n+            raise exceptions.HTTPException(\n+                exceptions.ErrorCodes.V_ORG_NOT_FOUND,","path":"mora/service/orgunit.py","position":38,"original_position":22,"commit_id":"a20f4c856c80e2a790a8cbd71001dfa3a3a3b1e6","original_commit_id":"0aba862ac2044f90ceb05ff5721322c94f6e34ab","user":{"login":"cmoesgaard","id":1827127,"node_id":"MDQ6VXNlcjE4MjcxMjc=","avatar_url":"https://avatars3.githubusercontent.com/u/1827127?v=4","gravatar_id":"","url":"https://api.github.com/users/cmoesgaard","html_url":"https://github.com/cmoesgaard","followers_url":"https://api.github.com/users/cmoesgaard/followers","following_url":"https://api.github.com/users/cmoesgaard/following{/other_user}","gists_url":"https://api.github.com/users/cmoesgaard/gists{/gist_id}","starred_url":"https://api.github.com/users/cmoesgaard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmoesgaard/subscriptions","organizations_url":"https://api.github.com/users/cmoesgaard/orgs","repos_url":"https://api.github.com/users/cmoesgaard/repos","events_url":"https://api.github.com/users/cmoesgaard/events{/privacy}","received_events_url":"https://api.github.com/users/cmoesgaard/received_events","type":"User","site_admin":false},"body":"Also, the docstring should be updated to reflect this.","created_at":"2018-08-20T13:07:55Z","updated_at":"2018-08-20T13:07:55Z","html_url":"https://github.com/magenta-aps/mora/pull/131#discussion_r211254286","pull_request_url":"https://api.github.com/repos/magenta-aps/mora/pulls/131","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/magenta-aps/mora/pulls/comments/211254286"},"html":{"href":"https://github.com/magenta-aps/mora/pull/131#discussion_r211254286"},"pull_request":{"href":"https://api.github.com/repos/magenta-aps/mora/pulls/131"}},"in_reply_to_id":211252831},"pull_request":{"url":"https://api.github.com/repos/magenta-aps/mora/pulls/131","id":206668941,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2NjY4OTQx","html_url":"https://github.com/magenta-aps/mora/pull/131","diff_url":"https://github.com/magenta-aps/mora/pull/131.diff","patch_url":"https://github.com/magenta-aps/mora/pull/131.patch","issue_url":"https://api.github.com/repos/magenta-aps/mora/issues/131","number":131,"state":"open","locked":false,"title":"Minor tweaks","user":{"login":"danchr","id":59300,"node_id":"MDQ6VXNlcjU5MzAw","avatar_url":"https://avatars3.githubusercontent.com/u/59300?v=4","gravatar_id":"","url":"https://api.github.com/users/danchr","html_url":"https://github.com/danchr","followers_url":"https://api.github.com/users/danchr/followers","following_url":"https://api.github.com/users/danchr/following{/other_user}","gists_url":"https://api.github.com/users/danchr/gists{/gist_id}","starred_url":"https://api.github.com/users/danchr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danchr/subscriptions","organizations_url":"https://api.github.com/users/danchr/orgs","repos_url":"https://api.github.com/users/danchr/repos","events_url":"https://api.github.com/users/danchr/events{/privacy}","received_events_url":"https://api.github.com/users/danchr/received_events","type":"User","site_admin":false},"body":"Minor tweaks made during or in preparation of the [AAK import](https://redmine.magenta-aps.dk/issues/22604). Tested using the test suite.","created_at":"2018-08-07T11:39:53Z","updated_at":"2018-08-20T13:07:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"251f73a7a54b40b5f2c420e402b23d2fb7234fea","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/magenta-aps/mora/pulls/131/commits","review_comments_url":"https://api.github.com/repos/magenta-aps/mora/pulls/131/comments","review_comment_url":"https://api.github.com/repos/magenta-aps/mora/pulls/comments{/number}","comments_url":"https://api.github.com/repos/magenta-aps/mora/issues/131/comments","statuses_url":"https://api.github.com/repos/magenta-aps/mora/statuses/a20f4c856c80e2a790a8cbd71001dfa3a3a3b1e6","head":{"label":"magenta-aps:feature/minor-tweaks","ref":"feature/minor-tweaks","sha":"a20f4c856c80e2a790a8cbd71001dfa3a3a3b1e6","user":{"login":"magenta-aps","id":996271,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5NjI3MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/996271?v=4","gravatar_id":"","url":"https://api.github.com/users/magenta-aps","html_url":"https://github.com/magenta-aps","followers_url":"https://api.github.com/users/magenta-aps/followers","following_url":"https://api.github.com/users/magenta-aps/following{/other_user}","gists_url":"https://api.github.com/users/magenta-aps/gists{/gist_id}","starred_url":"https://api.github.com/users/magenta-aps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magenta-aps/subscriptions","organizations_url":"https://api.github.com/users/magenta-aps/orgs","repos_url":"https://api.github.com/users/magenta-aps/repos","events_url":"https://api.github.com/users/magenta-aps/events{/privacy}","received_events_url":"https://api.github.com/users/magenta-aps/received_events","type":"Organization","site_admin":false},"repo":{"id":90602092,"node_id":"MDEwOlJlcG9zaXRvcnk5MDYwMjA5Mg==","name":"mora","full_name":"magenta-aps/mora","owner":{"login":"magenta-aps","id":996271,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5NjI3MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/996271?v=4","gravatar_id":"","url":"https://api.github.com/users/magenta-aps","html_url":"https://github.com/magenta-aps","followers_url":"https://api.github.com/users/magenta-aps/followers","following_url":"https://api.github.com/users/magenta-aps/following{/other_user}","gists_url":"https://api.github.com/users/magenta-aps/gists{/gist_id}","starred_url":"https://api.github.com/users/magenta-aps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magenta-aps/subscriptions","organizations_url":"https://api.github.com/users/magenta-aps/orgs","repos_url":"https://api.github.com/users/magenta-aps/repos","events_url":"https://api.github.com/users/magenta-aps/events{/privacy}","received_events_url":"https://api.github.com/users/magenta-aps/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/magenta-aps/mora","description":"OS2MO 2.0 — MO + LoRa","fork":false,"url":"https://api.github.com/repos/magenta-aps/mora","forks_url":"https://api.github.com/repos/magenta-aps/mora/forks","keys_url":"https://api.github.com/repos/magenta-aps/mora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/magenta-aps/mora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/magenta-aps/mora/teams","hooks_url":"https://api.github.com/repos/magenta-aps/mora/hooks","issue_events_url":"https://api.github.com/repos/magenta-aps/mora/issues/events{/number}","events_url":"https://api.github.com/repos/magenta-aps/mora/events","assignees_url":"https://api.github.com/repos/magenta-aps/mora/assignees{/user}","branches_url":"https://api.github.com/repos/magenta-aps/mora/branches{/branch}","tags_url":"https://api.github.com/repos/magenta-aps/mora/tags","blobs_url":"https://api.github.com/repos/magenta-aps/mora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/magenta-aps/mora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/magenta-aps/mora/git/refs{/sha}","trees_url":"https://api.github.com/repos/magenta-aps/mora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/magenta-aps/mora/statuses/{sha}","languages_url":"https://api.github.com/repos/magenta-aps/mora/languages","stargazers_url":"https://api.github.com/repos/magenta-aps/mora/stargazers","contributors_url":"https://api.github.com/repos/magenta-aps/mora/contributors","subscribers_url":"https://api.github.com/repos/magenta-aps/mora/subscribers","subscription_url":"https://api.github.com/repos/magenta-aps/mora/subscription","commits_url":"https://api.github.com/repos/magenta-aps/mora/commits{/sha}","git_commits_url":"https://api.github.com/repos/magenta-aps/mora/git/commits{/sha}","comments_url":"https://api.github.com/repos/magenta-aps/mora/comments{/number}","issue_comment_url":"https://api.github.com/repos/magenta-aps/mora/issues/comments{/number}","contents_url":"https://api.github.com/repos/magenta-aps/mora/contents/{+path}","compare_url":"https://api.github.com/repos/magenta-aps/mora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/magenta-aps/mora/merges","archive_url":"https://api.github.com/repos/magenta-aps/mora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/magenta-aps/mora/downloads","issues_url":"https://api.github.com/repos/magenta-aps/mora/issues{/number}","pulls_url":"https://api.github.com/repos/magenta-aps/mora/pulls{/number}","milestones_url":"https://api.github.com/repos/magenta-aps/mora/milestones{/number}","notifications_url":"https://api.github.com/repos/magenta-aps/mora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/magenta-aps/mora/labels{/name}","releases_url":"https://api.github.com/repos/magenta-aps/mora/releases{/id}","deployments_url":"https://api.github.com/repos/magenta-aps/mora/deployments","created_at":"2017-05-08T08:05:11Z","updated_at":"2018-08-17T11:55:26Z","pushed_at":"2018-08-20T12:21:42Z","git_url":"git://github.com/magenta-aps/mora.git","ssh_url":"git@github.com:magenta-aps/mora.git","clone_url":"https://github.com/magenta-aps/mora.git","svn_url":"https://github.com/magenta-aps/mora","homepage":"https://mora.readthedocs.io","size":9701,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":18,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":2,"open_issues":18,"watchers":1,"default_branch":"development"}},"base":{"label":"magenta-aps:development","ref":"development","sha":"e386bcf105ce26351f96e412bf0263a818f63297","user":{"login":"magenta-aps","id":996271,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5NjI3MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/996271?v=4","gravatar_id":"","url":"https://api.github.com/users/magenta-aps","html_url":"https://github.com/magenta-aps","followers_url":"https://api.github.com/users/magenta-aps/followers","following_url":"https://api.github.com/users/magenta-aps/following{/other_user}","gists_url":"https://api.github.com/users/magenta-aps/gists{/gist_id}","starred_url":"https://api.github.com/users/magenta-aps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magenta-aps/subscriptions","organizations_url":"https://api.github.com/users/magenta-aps/orgs","repos_url":"https://api.github.com/users/magenta-aps/repos","events_url":"https://api.github.com/users/magenta-aps/events{/privacy}","received_events_url":"https://api.github.com/users/magenta-aps/received_events","type":"Organization","site_admin":false},"repo":{"id":90602092,"node_id":"MDEwOlJlcG9zaXRvcnk5MDYwMjA5Mg==","name":"mora","full_name":"magenta-aps/mora","owner":{"login":"magenta-aps","id":996271,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5NjI3MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/996271?v=4","gravatar_id":"","url":"https://api.github.com/users/magenta-aps","html_url":"https://github.com/magenta-aps","followers_url":"https://api.github.com/users/magenta-aps/followers","following_url":"https://api.github.com/users/magenta-aps/following{/other_user}","gists_url":"https://api.github.com/users/magenta-aps/gists{/gist_id}","starred_url":"https://api.github.com/users/magenta-aps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magenta-aps/subscriptions","organizations_url":"https://api.github.com/users/magenta-aps/orgs","repos_url":"https://api.github.com/users/magenta-aps/repos","events_url":"https://api.github.com/users/magenta-aps/events{/privacy}","received_events_url":"https://api.github.com/users/magenta-aps/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/magenta-aps/mora","description":"OS2MO 2.0 — MO + LoRa","fork":false,"url":"https://api.github.com/repos/magenta-aps/mora","forks_url":"https://api.github.com/repos/magenta-aps/mora/forks","keys_url":"https://api.github.com/repos/magenta-aps/mora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/magenta-aps/mora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/magenta-aps/mora/teams","hooks_url":"https://api.github.com/repos/magenta-aps/mora/hooks","issue_events_url":"https://api.github.com/repos/magenta-aps/mora/issues/events{/number}","events_url":"https://api.github.com/repos/magenta-aps/mora/events","assignees_url":"https://api.github.com/repos/magenta-aps/mora/assignees{/user}","branches_url":"https://api.github.com/repos/magenta-aps/mora/branches{/branch}","tags_url":"https://api.github.com/repos/magenta-aps/mora/tags","blobs_url":"https://api.github.com/repos/magenta-aps/mora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/magenta-aps/mora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/magenta-aps/mora/git/refs{/sha}","trees_url":"https://api.github.com/repos/magenta-aps/mora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/magenta-aps/mora/statuses/{sha}","languages_url":"https://api.github.com/repos/magenta-aps/mora/languages","stargazers_url":"https://api.github.com/repos/magenta-aps/mora/stargazers","contributors_url":"https://api.github.com/repos/magenta-aps/mora/contributors","subscribers_url":"https://api.github.com/repos/magenta-aps/mora/subscribers","subscription_url":"https://api.github.com/repos/magenta-aps/mora/subscription","commits_url":"https://api.github.com/repos/magenta-aps/mora/commits{/sha}","git_commits_url":"https://api.github.com/repos/magenta-aps/mora/git/commits{/sha}","comments_url":"https://api.github.com/repos/magenta-aps/mora/comments{/number}","issue_comment_url":"https://api.github.com/repos/magenta-aps/mora/issues/comments{/number}","contents_url":"https://api.github.com/repos/magenta-aps/mora/contents/{+path}","compare_url":"https://api.github.com/repos/magenta-aps/mora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/magenta-aps/mora/merges","archive_url":"https://api.github.com/repos/magenta-aps/mora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/magenta-aps/mora/downloads","issues_url":"https://api.github.com/repos/magenta-aps/mora/issues{/number}","pulls_url":"https://api.github.com/repos/magenta-aps/mora/pulls{/number}","milestones_url":"https://api.github.com/repos/magenta-aps/mora/milestones{/number}","notifications_url":"https://api.github.com/repos/magenta-aps/mora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/magenta-aps/mora/labels{/name}","releases_url":"https://api.github.com/repos/magenta-aps/mora/releases{/id}","deployments_url":"https://api.github.com/repos/magenta-aps/mora/deployments","created_at":"2017-05-08T08:05:11Z","updated_at":"2018-08-17T11:55:26Z","pushed_at":"2018-08-20T12:21:42Z","git_url":"git://github.com/magenta-aps/mora.git","ssh_url":"git@github.com:magenta-aps/mora.git","clone_url":"https://github.com/magenta-aps/mora.git","svn_url":"https://github.com/magenta-aps/mora","homepage":"https://mora.readthedocs.io","size":9701,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":18,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":2,"open_issues":18,"watchers":1,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/magenta-aps/mora/pulls/131"},"html":{"href":"https://github.com/magenta-aps/mora/pull/131"},"issue":{"href":"https://api.github.com/repos/magenta-aps/mora/issues/131"},"comments":{"href":"https://api.github.com/repos/magenta-aps/mora/issues/131/comments"},"review_comments":{"href":"https://api.github.com/repos/magenta-aps/mora/pulls/131/comments"},"review_comment":{"href":"https://api.github.com/repos/magenta-aps/mora/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/magenta-aps/mora/pulls/131/commits"},"statuses":{"href":"https://api.github.com/repos/magenta-aps/mora/statuses/a20f4c856c80e2a790a8cbd71001dfa3a3a3b1e6"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"cmoesgaard"}}