{"action":"created","comment":{"url":"https://api.github.com/repos/indico/indico/pulls/comments/81134438","pull_request_review_id":2136164,"id":81134438,"diff_hunk":"@@ -509,3 +519,74 @@ def serialize_event_for_ical(event, detail_level):\n     if detail_level == 'contributions':\n         data['contributions'] = [serialize_contribution_for_ical(c) for c in event.contributions]\n     return data\n+\n+\n+def get_field_values(form_data):\n+    \"\"\"Split the form fields between custom and static\"\"\"\n+    fields = {x: form_data[x] for x in form_data.iterkeys() if not x.startswith('custom_')}\n+    custom_fields = {x: form_data[x] for x in form_data.iterkeys() if x.startswith('custom_')}\n+    return fields, custom_fields\n+\n+\n+def set_custom_fields(obj, custom_fields_data):\n+    changes = {}\n+    for custom_field_name, custom_field_value in custom_fields_data.iteritems():\n+        custom_field_id = int(custom_field_name[7:])  # Remove the 'custom_' part\n+        old_value = obj.set_custom_field(custom_field_id, custom_field_value)\n+        if old_value != custom_field_value:\n+            changes[custom_field_name] = (old_value, custom_field_value)\n+    return changes\n+\n+\n+class ZipGeneratorMixin:\n+    \"\"\"Mixin for RHs that generate zip with files\"\"\"\n+\n+    def _adjust_path_length(self, segments):\n+        \"\"\"\n+        Shorten the path length to < 260 chars.\n+\n+        Windows' built-in ZIP tool doesn't like files whose\n+        total path exceeds ~260 chars. Here we progressively\n+        shorten the total until it matches that constraint.\n+        \"\"\"\n+        result = []\n+        total_len = sum(len(seg) for seg in segments) + len(segments) - 1\n+        excess = (total_len - 255) if total_len > 255 else 0\n+\n+        for seg in reversed(segments):\n+            fname, ext = path.splitext(seg)\n+            cut = min(excess, (len(fname) - 10) if len(fname) > 14 else 0)\n+            if cut:\n+                excess -= cut\n+                fname = fname[:-cut]\n+            result.append(fname + ext)\n+\n+        return reversed(result)\n+\n+    def _iter_items(self, files_holder):\n+        for f in files_holder:\n+            yield f\n+\n+    def _generate_zip_file(self, files_holder, name_prefix='material', name_suffix=None):","path":"indico/modules/events/util.py","position":107,"original_position":107,"commit_id":"69fa6d058704d3cc1b06df4e1222a2b168d73a6b","original_commit_id":"69fa6d058704d3cc1b06df4e1222a2b168d73a6b","user":{"login":"nop33","id":1579899,"avatar_url":"https://avatars.githubusercontent.com/u/1579899?v=3","gravatar_id":"","url":"https://api.github.com/users/nop33","html_url":"https://github.com/nop33","followers_url":"https://api.github.com/users/nop33/followers","following_url":"https://api.github.com/users/nop33/following{/other_user}","gists_url":"https://api.github.com/users/nop33/gists{/gist_id}","starred_url":"https://api.github.com/users/nop33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nop33/subscriptions","organizations_url":"https://api.github.com/users/nop33/orgs","repos_url":"https://api.github.com/users/nop33/repos","events_url":"https://api.github.com/users/nop33/events{/privacy}","received_events_url":"https://api.github.com/users/nop33/received_events","type":"User","site_admin":false},"body":"It's not always a list, it can be any object that contains an object that cont.... that contains a list of files :stuck_out_tongue: ","created_at":"2016-09-29T13:22:27Z","updated_at":"2016-09-29T13:22:28Z","html_url":"https://github.com/indico/indico/pull/2581#discussion_r81134438","pull_request_url":"https://api.github.com/repos/indico/indico/pulls/2581","_links":{"self":{"href":"https://api.github.com/repos/indico/indico/pulls/comments/81134438"},"html":{"href":"https://github.com/indico/indico/pull/2581#discussion_r81134438"},"pull_request":{"href":"https://api.github.com/repos/indico/indico/pulls/2581"}}},"pull_request":{"url":"https://api.github.com/repos/indico/indico/pulls/2581","id":83071774,"html_url":"https://github.com/indico/indico/pull/2581","diff_url":"https://github.com/indico/indico/pull/2581.diff","patch_url":"https://github.com/indico/indico/pull/2581.patch","issue_url":"https://api.github.com/repos/indico/indico/issues/2581","number":2581,"state":"open","locked":false,"title":"WIP: Abstract list","user":{"login":"ThiefMaster","id":179599,"avatar_url":"https://avatars.githubusercontent.com/u/179599?v=3","gravatar_id":"","url":"https://api.github.com/users/ThiefMaster","html_url":"https://github.com/ThiefMaster","followers_url":"https://api.github.com/users/ThiefMaster/followers","following_url":"https://api.github.com/users/ThiefMaster/following{/other_user}","gists_url":"https://api.github.com/users/ThiefMaster/gists{/gist_id}","starred_url":"https://api.github.com/users/ThiefMaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThiefMaster/subscriptions","organizations_url":"https://api.github.com/users/ThiefMaster/orgs","repos_url":"https://api.github.com/users/ThiefMaster/repos","events_url":"https://api.github.com/users/ThiefMaster/events{/privacy}","received_events_url":"https://api.github.com/users/ThiefMaster/received_events","type":"User","site_admin":false},"body":"Supersedes #2580","created_at":"2016-08-29T09:44:09Z","updated_at":"2016-09-29T13:22:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f28f088a7c4d847ba50de8381d176c20c199e71d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/indico/indico/pulls/2581/commits","review_comments_url":"https://api.github.com/repos/indico/indico/pulls/2581/comments","review_comment_url":"https://api.github.com/repos/indico/indico/pulls/comments{/number}","comments_url":"https://api.github.com/repos/indico/indico/issues/2581/comments","statuses_url":"https://api.github.com/repos/indico/indico/statuses/69fa6d058704d3cc1b06df4e1222a2b168d73a6b","head":{"label":"indico:wip/abstract-list","ref":"wip/abstract-list","sha":"69fa6d058704d3cc1b06df4e1222a2b168d73a6b","user":{"login":"indico","id":715236,"avatar_url":"https://avatars.githubusercontent.com/u/715236?v=3","gravatar_id":"","url":"https://api.github.com/users/indico","html_url":"https://github.com/indico","followers_url":"https://api.github.com/users/indico/followers","following_url":"https://api.github.com/users/indico/following{/other_user}","gists_url":"https://api.github.com/users/indico/gists{/gist_id}","starred_url":"https://api.github.com/users/indico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indico/subscriptions","organizations_url":"https://api.github.com/users/indico/orgs","repos_url":"https://api.github.com/users/indico/repos","events_url":"https://api.github.com/users/indico/events{/privacy}","received_events_url":"https://api.github.com/users/indico/received_events","type":"Organization","site_admin":false},"repo":{"id":2113067,"name":"indico","full_name":"indico/indico","owner":{"login":"indico","id":715236,"avatar_url":"https://avatars.githubusercontent.com/u/715236?v=3","gravatar_id":"","url":"https://api.github.com/users/indico","html_url":"https://github.com/indico","followers_url":"https://api.github.com/users/indico/followers","following_url":"https://api.github.com/users/indico/following{/other_user}","gists_url":"https://api.github.com/users/indico/gists{/gist_id}","starred_url":"https://api.github.com/users/indico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indico/subscriptions","organizations_url":"https://api.github.com/users/indico/orgs","repos_url":"https://api.github.com/users/indico/repos","events_url":"https://api.github.com/users/indico/events{/privacy}","received_events_url":"https://api.github.com/users/indico/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/indico/indico","description":"The Indico Project","fork":false,"url":"https://api.github.com/repos/indico/indico","forks_url":"https://api.github.com/repos/indico/indico/forks","keys_url":"https://api.github.com/repos/indico/indico/keys{/key_id}","collaborators_url":"https://api.github.com/repos/indico/indico/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/indico/indico/teams","hooks_url":"https://api.github.com/repos/indico/indico/hooks","issue_events_url":"https://api.github.com/repos/indico/indico/issues/events{/number}","events_url":"https://api.github.com/repos/indico/indico/events","assignees_url":"https://api.github.com/repos/indico/indico/assignees{/user}","branches_url":"https://api.github.com/repos/indico/indico/branches{/branch}","tags_url":"https://api.github.com/repos/indico/indico/tags","blobs_url":"https://api.github.com/repos/indico/indico/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/indico/indico/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/indico/indico/git/refs{/sha}","trees_url":"https://api.github.com/repos/indico/indico/git/trees{/sha}","statuses_url":"https://api.github.com/repos/indico/indico/statuses/{sha}","languages_url":"https://api.github.com/repos/indico/indico/languages","stargazers_url":"https://api.github.com/repos/indico/indico/stargazers","contributors_url":"https://api.github.com/repos/indico/indico/contributors","subscribers_url":"https://api.github.com/repos/indico/indico/subscribers","subscription_url":"https://api.github.com/repos/indico/indico/subscription","commits_url":"https://api.github.com/repos/indico/indico/commits{/sha}","git_commits_url":"https://api.github.com/repos/indico/indico/git/commits{/sha}","comments_url":"https://api.github.com/repos/indico/indico/comments{/number}","issue_comment_url":"https://api.github.com/repos/indico/indico/issues/comments{/number}","contents_url":"https://api.github.com/repos/indico/indico/contents/{+path}","compare_url":"https://api.github.com/repos/indico/indico/compare/{base}...{head}","merges_url":"https://api.github.com/repos/indico/indico/merges","archive_url":"https://api.github.com/repos/indico/indico/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/indico/indico/downloads","issues_url":"https://api.github.com/repos/indico/indico/issues{/number}","pulls_url":"https://api.github.com/repos/indico/indico/pulls{/number}","milestones_url":"https://api.github.com/repos/indico/indico/milestones{/number}","notifications_url":"https://api.github.com/repos/indico/indico/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/indico/indico/labels{/name}","releases_url":"https://api.github.com/repos/indico/indico/releases{/id}","deployments_url":"https://api.github.com/repos/indico/indico/deployments","created_at":"2011-07-27T13:56:30Z","updated_at":"2016-09-09T15:50:20Z","pushed_at":"2016-09-29T12:21:40Z","git_url":"git://github.com/indico/indico.git","ssh_url":"git@github.com:indico/indico.git","clone_url":"https://github.com/indico/indico.git","svn_url":"https://github.com/indico/indico","homepage":"http://indico-software.org","size":202855,"stargazers_count":164,"watchers_count":164,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":81,"mirror_url":null,"open_issues_count":624,"forks":81,"open_issues":624,"watchers":164,"default_branch":"master"}},"base":{"label":"indico:devel","ref":"devel","sha":"e20002b7bac8cb18990948d09a11ab46bfd95e35","user":{"login":"indico","id":715236,"avatar_url":"https://avatars.githubusercontent.com/u/715236?v=3","gravatar_id":"","url":"https://api.github.com/users/indico","html_url":"https://github.com/indico","followers_url":"https://api.github.com/users/indico/followers","following_url":"https://api.github.com/users/indico/following{/other_user}","gists_url":"https://api.github.com/users/indico/gists{/gist_id}","starred_url":"https://api.github.com/users/indico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indico/subscriptions","organizations_url":"https://api.github.com/users/indico/orgs","repos_url":"https://api.github.com/users/indico/repos","events_url":"https://api.github.com/users/indico/events{/privacy}","received_events_url":"https://api.github.com/users/indico/received_events","type":"Organization","site_admin":false},"repo":{"id":2113067,"name":"indico","full_name":"indico/indico","owner":{"login":"indico","id":715236,"avatar_url":"https://avatars.githubusercontent.com/u/715236?v=3","gravatar_id":"","url":"https://api.github.com/users/indico","html_url":"https://github.com/indico","followers_url":"https://api.github.com/users/indico/followers","following_url":"https://api.github.com/users/indico/following{/other_user}","gists_url":"https://api.github.com/users/indico/gists{/gist_id}","starred_url":"https://api.github.com/users/indico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indico/subscriptions","organizations_url":"https://api.github.com/users/indico/orgs","repos_url":"https://api.github.com/users/indico/repos","events_url":"https://api.github.com/users/indico/events{/privacy}","received_events_url":"https://api.github.com/users/indico/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/indico/indico","description":"The Indico Project","fork":false,"url":"https://api.github.com/repos/indico/indico","forks_url":"https://api.github.com/repos/indico/indico/forks","keys_url":"https://api.github.com/repos/indico/indico/keys{/key_id}","collaborators_url":"https://api.github.com/repos/indico/indico/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/indico/indico/teams","hooks_url":"https://api.github.com/repos/indico/indico/hooks","issue_events_url":"https://api.github.com/repos/indico/indico/issues/events{/number}","events_url":"https://api.github.com/repos/indico/indico/events","assignees_url":"https://api.github.com/repos/indico/indico/assignees{/user}","branches_url":"https://api.github.com/repos/indico/indico/branches{/branch}","tags_url":"https://api.github.com/repos/indico/indico/tags","blobs_url":"https://api.github.com/repos/indico/indico/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/indico/indico/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/indico/indico/git/refs{/sha}","trees_url":"https://api.github.com/repos/indico/indico/git/trees{/sha}","statuses_url":"https://api.github.com/repos/indico/indico/statuses/{sha}","languages_url":"https://api.github.com/repos/indico/indico/languages","stargazers_url":"https://api.github.com/repos/indico/indico/stargazers","contributors_url":"https://api.github.com/repos/indico/indico/contributors","subscribers_url":"https://api.github.com/repos/indico/indico/subscribers","subscription_url":"https://api.github.com/repos/indico/indico/subscription","commits_url":"https://api.github.com/repos/indico/indico/commits{/sha}","git_commits_url":"https://api.github.com/repos/indico/indico/git/commits{/sha}","comments_url":"https://api.github.com/repos/indico/indico/comments{/number}","issue_comment_url":"https://api.github.com/repos/indico/indico/issues/comments{/number}","contents_url":"https://api.github.com/repos/indico/indico/contents/{+path}","compare_url":"https://api.github.com/repos/indico/indico/compare/{base}...{head}","merges_url":"https://api.github.com/repos/indico/indico/merges","archive_url":"https://api.github.com/repos/indico/indico/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/indico/indico/downloads","issues_url":"https://api.github.com/repos/indico/indico/issues{/number}","pulls_url":"https://api.github.com/repos/indico/indico/pulls{/number}","milestones_url":"https://api.github.com/repos/indico/indico/milestones{/number}","notifications_url":"https://api.github.com/repos/indico/indico/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/indico/indico/labels{/name}","releases_url":"https://api.github.com/repos/indico/indico/releases{/id}","deployments_url":"https://api.github.com/repos/indico/indico/deployments","created_at":"2011-07-27T13:56:30Z","updated_at":"2016-09-09T15:50:20Z","pushed_at":"2016-09-29T12:21:40Z","git_url":"git://github.com/indico/indico.git","ssh_url":"git@github.com:indico/indico.git","clone_url":"https://github.com/indico/indico.git","svn_url":"https://github.com/indico/indico","homepage":"http://indico-software.org","size":202855,"stargazers_count":164,"watchers_count":164,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":81,"mirror_url":null,"open_issues_count":624,"forks":81,"open_issues":624,"watchers":164,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/indico/indico/pulls/2581"},"html":{"href":"https://github.com/indico/indico/pull/2581"},"issue":{"href":"https://api.github.com/repos/indico/indico/issues/2581"},"comments":{"href":"https://api.github.com/repos/indico/indico/issues/2581/comments"},"review_comments":{"href":"https://api.github.com/repos/indico/indico/pulls/2581/comments"},"review_comment":{"href":"https://api.github.com/repos/indico/indico/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/indico/indico/pulls/2581/commits"},"statuses":{"href":"https://api.github.com/repos/indico/indico/statuses/69fa6d058704d3cc1b06df4e1222a2b168d73a6b"}}}}
{"actor":{"display_login":"nop33"}}