Skip to content

Commit

Permalink
global: bibdocfile dependency removal
Browse files Browse the repository at this point in the history
* INCOMPATIBLE Removes dependency on legacy bibdocfile module.
  (addresses inveniosoftware/invenio#3233)

Signed-off-by: Leonardo Rossi <[email protected]>
  • Loading branch information
Leonardo Rossi committed Aug 31, 2015
1 parent ccbc00f commit ab72870
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions invenio_records/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@
from __future__ import unicode_literals

import cStringIO

import warnings

from functools import wraps

from flask import (Blueprint, abort, current_app, flash, g, redirect,
render_template, request, send_file, url_for)
render_template, request, send_file)

from flask_breadcrumbs import default_breadcrumb_root

from flask_login import current_user

from flask_menu import register_menu

from invenio_collections.decorators import check_collection
from invenio_formatter import (get_output_format_content_type,
response_formated_records)
from invenio.base.decorators import wash_arguments
from invenio.base.globals import cfg
from invenio.base.i18n import _
Expand All @@ -41,6 +44,11 @@
register_template_context_processor
from invenio.utils import apache

from invenio_collections.decorators import check_collection

from invenio_formatter import (get_output_format_content_type,
response_formated_records)

from .signals import record_viewed
from .utils import visible_collection_tabs

Expand Down Expand Up @@ -165,11 +173,9 @@ def metadata(recid, of='hd', ot=None):
def files(recid):
"""Return overview of attached files."""
def get_files():
from invenio.legacy.bibdocfile.api import BibRecDocs
for bibdoc in BibRecDocs(recid).list_bibdocs():
for file in bibdoc.list_all_files():
yield file.get_url()

warnings.warn("Use of bibdocfile has been deprecated.",
DeprecationWarning)
return []
return render_template('records/files.html', files=list(get_files()))


Expand Down Expand Up @@ -207,13 +213,6 @@ def file(recid, filename):
attachment_filename=filename)
return send_file(document['uri'])

from invenio_documents.utils import _get_legacy_bibdocs
for fullpath, permission in _get_legacy_bibdocs(recid, filename=filename):
if not permission:
error = 401
continue
return send_file(fullpath)

abort(error)


Expand Down

0 comments on commit ab72870

Please sign in to comment.