{"action":"created","comment":{"url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/pulls/comments/54583513","id":54583513,"diff_hunk":"@@ -0,0 +1,77 @@\n+# -*- coding: utf-8 -*-\n+#\n+# This file is part of Invenio.\n+# Copyright (C) 2016 CERN.\n+#\n+# Invenio is free software; you can redistribute it\n+# and/or modify it under the terms of the GNU General Public License as\n+# published by the Free Software Foundation; either version 2 of the\n+# License, or (at your option) any later version.\n+#\n+# Invenio is distributed in the hope that it will be\n+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+# General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with Invenio; if not, write to the\n+# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,\n+# MA 02111-1307, USA.\n+#\n+# In applying this license, CERN does not\n+# waive the privileges and immunities granted to it by virtue of its status\n+# as an Intergovernmental Organization or submit itself to any jurisdiction.\n+\n+\"\"\"MARC21 based serializer.\"\"\"\n+\n+from __future__ import absolute_import, print_function\n+\n+from dojson.contrib.to_marc21.utils import dumps\n+\n+from .dojson import DoJSONSerializer\n+\n+\n+class MARCXMLSerializer(DoJSONSerializer):\n+    \"\"\"DoJSON based MARCXML serializer for records.\n+\n+    Note: This serializer is not suitable for serializing large number of\n+    records due to high memory usage.\n+    \"\"\"\n+\n+    def __init__(self, dojson_model, xslt_filename=None, schema_class=None):\n+        \"\"\".\"\"\"\n+        self.xslt_filename = xslt_filename\n+        self.schema_class = schema_class\n+        super(MARCXMLSerializer, self).__init__(dojson_model)\n+\n+    def dump(self, obj):\n+        \"\"\"Dump object.\"\"\"\n+        if self.schema_class:\n+            obj = self.schema_class().dump(obj).data\n+        return super(MARCXMLSerializer, self).dump(obj)\n+\n+    def serialize(self, pid, record, links=None):\n+        \"\"\"Serialize a single record and persistent identifier.\n+\n+        :param pid: Persistent identifier instance.\n+        :param record: Record instance.\n+        :param links: Dictionary of links to add to response.\n+        \"\"\"\n+        kwargs = dict(xslt_filename=self.xslt_filename) if self.xslt_filename \\\n+            else dict()\n+        return dumps(self.transform_record(pid, record), **kwargs)\n+\n+    def serialize_search(self, pid_fetcher, search_result, links=None):","path":"invenio_marc21/serializers/marcxml.py","position":64,"original_position":64,"commit_id":"57fd4f87a0b5389667e95c363345687555aca4e2","original_commit_id":"57fd4f87a0b5389667e95c363345687555aca4e2","user":{"login":"switowski","id":4835412,"avatar_url":"https://avatars.githubusercontent.com/u/4835412?v=3","gravatar_id":"","url":"https://api.github.com/users/switowski","html_url":"https://github.com/switowski","followers_url":"https://api.github.com/users/switowski/followers","following_url":"https://api.github.com/users/switowski/following{/other_user}","gists_url":"https://api.github.com/users/switowski/gists{/gist_id}","starred_url":"https://api.github.com/users/switowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/switowski/subscriptions","organizations_url":"https://api.github.com/users/switowski/orgs","repos_url":"https://api.github.com/users/switowski/repos","events_url":"https://api.github.com/users/switowski/events{/privacy}","received_events_url":"https://api.github.com/users/switowski/received_events","type":"User","site_admin":false},"body":"ditto","created_at":"2016-03-01T15:34:03Z","updated_at":"2016-03-01T15:34:03Z","html_url":"https://github.com/inveniosoftware/invenio-marc21/pull/10#discussion_r54583513","pull_request_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/inveniosoftware/invenio-marc21/pulls/comments/54583513"},"html":{"href":"https://github.com/inveniosoftware/invenio-marc21/pull/10#discussion_r54583513"},"pull_request":{"href":"https://api.github.com/repos/inveniosoftware/invenio-marc21/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/pulls/10","id":61077514,"html_url":"https://github.com/inveniosoftware/invenio-marc21/pull/10","diff_url":"https://github.com/inveniosoftware/invenio-marc21/pull/10.diff","patch_url":"https://github.com/inveniosoftware/invenio-marc21/pull/10.patch","issue_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/issues/10","number":10,"state":"open","locked":false,"title":"global: adds marcxml serializers","user":{"login":"krzysztof","id":656365,"avatar_url":"https://avatars.githubusercontent.com/u/656365?v=3","gravatar_id":"","url":"https://api.github.com/users/krzysztof","html_url":"https://github.com/krzysztof","followers_url":"https://api.github.com/users/krzysztof/followers","following_url":"https://api.github.com/users/krzysztof/following{/other_user}","gists_url":"https://api.github.com/users/krzysztof/gists{/gist_id}","starred_url":"https://api.github.com/users/krzysztof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krzysztof/subscriptions","organizations_url":"https://api.github.com/users/krzysztof/orgs","repos_url":"https://api.github.com/users/krzysztof/repos","events_url":"https://api.github.com/users/krzysztof/events{/privacy}","received_events_url":"https://api.github.com/users/krzysztof/received_events","type":"User","site_admin":false},"body":"* Adds marxml serializer and tests.\r\n\r\nSigned-off-by: Krzysztof Nowak <k.nowak@cern.ch>\r\nCo-authored-by: Lars Holm Nielsen <lars.holm.nielsen@cern.ch>","created_at":"2016-02-29T13:29:19Z","updated_at":"2016-03-01T15:34:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76a5b993f69cb0725d913c8e4f8d0aabec238c0c","assignee":{"login":"switowski","id":4835412,"avatar_url":"https://avatars.githubusercontent.com/u/4835412?v=3","gravatar_id":"","url":"https://api.github.com/users/switowski","html_url":"https://github.com/switowski","followers_url":"https://api.github.com/users/switowski/followers","following_url":"https://api.github.com/users/switowski/following{/other_user}","gists_url":"https://api.github.com/users/switowski/gists{/gist_id}","starred_url":"https://api.github.com/users/switowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/switowski/subscriptions","organizations_url":"https://api.github.com/users/switowski/orgs","repos_url":"https://api.github.com/users/switowski/repos","events_url":"https://api.github.com/users/switowski/events{/privacy}","received_events_url":"https://api.github.com/users/switowski/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/pulls/10/commits","review_comments_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/pulls/10/comments","review_comment_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/pulls/comments{/number}","comments_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/issues/10/comments","statuses_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/statuses/57fd4f87a0b5389667e95c363345687555aca4e2","head":{"label":"krzysztof:serializers","ref":"serializers","sha":"57fd4f87a0b5389667e95c363345687555aca4e2","user":{"login":"krzysztof","id":656365,"avatar_url":"https://avatars.githubusercontent.com/u/656365?v=3","gravatar_id":"","url":"https://api.github.com/users/krzysztof","html_url":"https://github.com/krzysztof","followers_url":"https://api.github.com/users/krzysztof/followers","following_url":"https://api.github.com/users/krzysztof/following{/other_user}","gists_url":"https://api.github.com/users/krzysztof/gists{/gist_id}","starred_url":"https://api.github.com/users/krzysztof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krzysztof/subscriptions","organizations_url":"https://api.github.com/users/krzysztof/orgs","repos_url":"https://api.github.com/users/krzysztof/repos","events_url":"https://api.github.com/users/krzysztof/events{/privacy}","received_events_url":"https://api.github.com/users/krzysztof/received_events","type":"User","site_admin":false},"repo":{"id":52341536,"name":"invenio-marc21","full_name":"krzysztof/invenio-marc21","owner":{"login":"krzysztof","id":656365,"avatar_url":"https://avatars.githubusercontent.com/u/656365?v=3","gravatar_id":"","url":"https://api.github.com/users/krzysztof","html_url":"https://github.com/krzysztof","followers_url":"https://api.github.com/users/krzysztof/followers","following_url":"https://api.github.com/users/krzysztof/following{/other_user}","gists_url":"https://api.github.com/users/krzysztof/gists{/gist_id}","starred_url":"https://api.github.com/users/krzysztof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krzysztof/subscriptions","organizations_url":"https://api.github.com/users/krzysztof/orgs","repos_url":"https://api.github.com/users/krzysztof/repos","events_url":"https://api.github.com/users/krzysztof/events{/privacy}","received_events_url":"https://api.github.com/users/krzysztof/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/krzysztof/invenio-marc21","description":"Nice defaults for Invenio overlays using MARC21.","fork":true,"url":"https://api.github.com/repos/krzysztof/invenio-marc21","forks_url":"https://api.github.com/repos/krzysztof/invenio-marc21/forks","keys_url":"https://api.github.com/repos/krzysztof/invenio-marc21/keys{/key_id}","collaborators_url":"https://api.github.com/repos/krzysztof/invenio-marc21/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/krzysztof/invenio-marc21/teams","hooks_url":"https://api.github.com/repos/krzysztof/invenio-marc21/hooks","issue_events_url":"https://api.github.com/repos/krzysztof/invenio-marc21/issues/events{/number}","events_url":"https://api.github.com/repos/krzysztof/invenio-marc21/events","assignees_url":"https://api.github.com/repos/krzysztof/invenio-marc21/assignees{/user}","branches_url":"https://api.github.com/repos/krzysztof/invenio-marc21/branches{/branch}","tags_url":"https://api.github.com/repos/krzysztof/invenio-marc21/tags","blobs_url":"https://api.github.com/repos/krzysztof/invenio-marc21/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/krzysztof/invenio-marc21/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/krzysztof/invenio-marc21/git/refs{/sha}","trees_url":"https://api.github.com/repos/krzysztof/invenio-marc21/git/trees{/sha}","statuses_url":"https://api.github.com/repos/krzysztof/invenio-marc21/statuses/{sha}","languages_url":"https://api.github.com/repos/krzysztof/invenio-marc21/languages","stargazers_url":"https://api.github.com/repos/krzysztof/invenio-marc21/stargazers","contributors_url":"https://api.github.com/repos/krzysztof/invenio-marc21/contributors","subscribers_url":"https://api.github.com/repos/krzysztof/invenio-marc21/subscribers","subscription_url":"https://api.github.com/repos/krzysztof/invenio-marc21/subscription","commits_url":"https://api.github.com/repos/krzysztof/invenio-marc21/commits{/sha}","git_commits_url":"https://api.github.com/repos/krzysztof/invenio-marc21/git/commits{/sha}","comments_url":"https://api.github.com/repos/krzysztof/invenio-marc21/comments{/number}","issue_comment_url":"https://api.github.com/repos/krzysztof/invenio-marc21/issues/comments{/number}","contents_url":"https://api.github.com/repos/krzysztof/invenio-marc21/contents/{+path}","compare_url":"https://api.github.com/repos/krzysztof/invenio-marc21/compare/{base}...{head}","merges_url":"https://api.github.com/repos/krzysztof/invenio-marc21/merges","archive_url":"https://api.github.com/repos/krzysztof/invenio-marc21/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/krzysztof/invenio-marc21/downloads","issues_url":"https://api.github.com/repos/krzysztof/invenio-marc21/issues{/number}","pulls_url":"https://api.github.com/repos/krzysztof/invenio-marc21/pulls{/number}","milestones_url":"https://api.github.com/repos/krzysztof/invenio-marc21/milestones{/number}","notifications_url":"https://api.github.com/repos/krzysztof/invenio-marc21/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/krzysztof/invenio-marc21/labels{/name}","releases_url":"https://api.github.com/repos/krzysztof/invenio-marc21/releases{/id}","deployments_url":"https://api.github.com/repos/krzysztof/invenio-marc21/deployments","created_at":"2016-02-23T07:57:59Z","updated_at":"2016-02-23T07:57:59Z","pushed_at":"2016-03-01T15:31:25Z","git_url":"git://github.com/krzysztof/invenio-marc21.git","ssh_url":"git@github.com:krzysztof/invenio-marc21.git","clone_url":"https://github.com/krzysztof/invenio-marc21.git","svn_url":"https://github.com/krzysztof/invenio-marc21","homepage":null,"size":59,"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":"inveniosoftware:master","ref":"master","sha":"82c655af89acacb0ae56d2d36e5af5a8979b59ef","user":{"login":"inveniosoftware","id":1157480,"avatar_url":"https://avatars.githubusercontent.com/u/1157480?v=3","gravatar_id":"","url":"https://api.github.com/users/inveniosoftware","html_url":"https://github.com/inveniosoftware","followers_url":"https://api.github.com/users/inveniosoftware/followers","following_url":"https://api.github.com/users/inveniosoftware/following{/other_user}","gists_url":"https://api.github.com/users/inveniosoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/inveniosoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inveniosoftware/subscriptions","organizations_url":"https://api.github.com/users/inveniosoftware/orgs","repos_url":"https://api.github.com/users/inveniosoftware/repos","events_url":"https://api.github.com/users/inveniosoftware/events{/privacy}","received_events_url":"https://api.github.com/users/inveniosoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":51523353,"name":"invenio-marc21","full_name":"inveniosoftware/invenio-marc21","owner":{"login":"inveniosoftware","id":1157480,"avatar_url":"https://avatars.githubusercontent.com/u/1157480?v=3","gravatar_id":"","url":"https://api.github.com/users/inveniosoftware","html_url":"https://github.com/inveniosoftware","followers_url":"https://api.github.com/users/inveniosoftware/followers","following_url":"https://api.github.com/users/inveniosoftware/following{/other_user}","gists_url":"https://api.github.com/users/inveniosoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/inveniosoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inveniosoftware/subscriptions","organizations_url":"https://api.github.com/users/inveniosoftware/orgs","repos_url":"https://api.github.com/users/inveniosoftware/repos","events_url":"https://api.github.com/users/inveniosoftware/events{/privacy}","received_events_url":"https://api.github.com/users/inveniosoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inveniosoftware/invenio-marc21","description":"Nice defaults for Invenio overlays using MARC21.","fork":false,"url":"https://api.github.com/repos/inveniosoftware/invenio-marc21","forks_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/forks","keys_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/teams","hooks_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/hooks","issue_events_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/issues/events{/number}","events_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/events","assignees_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/assignees{/user}","branches_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/branches{/branch}","tags_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/tags","blobs_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/git/refs{/sha}","trees_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/statuses/{sha}","languages_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/languages","stargazers_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/stargazers","contributors_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/contributors","subscribers_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/subscribers","subscription_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/subscription","commits_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/commits{/sha}","git_commits_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/git/commits{/sha}","comments_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/comments{/number}","issue_comment_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/issues/comments{/number}","contents_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/contents/{+path}","compare_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/merges","archive_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/downloads","issues_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/issues{/number}","pulls_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/pulls{/number}","milestones_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/milestones{/number}","notifications_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/labels{/name}","releases_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/releases{/id}","deployments_url":"https://api.github.com/repos/inveniosoftware/invenio-marc21/deployments","created_at":"2016-02-11T15:20:06Z","updated_at":"2016-02-12T09:46:47Z","pushed_at":"2016-03-01T15:31:25Z","git_url":"git://github.com/inveniosoftware/invenio-marc21.git","ssh_url":"git@github.com:inveniosoftware/invenio-marc21.git","clone_url":"https://github.com/inveniosoftware/invenio-marc21.git","svn_url":"https://github.com/inveniosoftware/invenio-marc21","homepage":null,"size":58,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/inveniosoftware/invenio-marc21/pulls/10"},"html":{"href":"https://github.com/inveniosoftware/invenio-marc21/pull/10"},"issue":{"href":"https://api.github.com/repos/inveniosoftware/invenio-marc21/issues/10"},"comments":{"href":"https://api.github.com/repos/inveniosoftware/invenio-marc21/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/inveniosoftware/invenio-marc21/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/inveniosoftware/invenio-marc21/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/inveniosoftware/invenio-marc21/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/inveniosoftware/invenio-marc21/statuses/57fd4f87a0b5389667e95c363345687555aca4e2"}}}}