def _get_depositions(user=None, type=None):
from invenio.modules.workflows.models import BibWorkflowObject, Workflow<EOL>from invenio.modules.deposit.models import InvalidDepositionType<EOL>from flask import current_app<EOL>from invenio.ext.sqlalchemy import db<EOL>from invenio.modules.deposit.models import Deposition<EOL>params = [<EOL>Workflow.module_name == '<STR_LIT>',<EOL>]<EOL>if user:<EOL><INDENT>params.append(BibWorkflowObject.id_user == user.get_id())<EOL><DEDENT>else:<EOL><INDENT>params.append(BibWorkflowObject.id_user != <NUM_LIT:0>)<EOL><DEDENT>if type:<EOL><INDENT>params.append(Workflow.name == type.get_identifier())<EOL><DEDENT>objects = BibWorkflowObject.query.join("<STR_LIT>").options(<EOL>db.contains_eager('<STR_LIT>')).filter(*params)<EOL>def _create_obj(o):<EOL><INDENT>try:<EOL><INDENT>obj = Deposition(o)<EOL><DEDENT>except InvalidDepositionType as err:<EOL><INDENT>current_app.logger.exception(err)<EOL>return None<EOL><DEDENT>if type is None or obj.type == type:<EOL><INDENT>return obj<EOL><DEDENT>return None<EOL><DEDENT>def mapper_filter(objs):<EOL><INDENT>for o in objs:<EOL><INDENT>o = _create_obj(o)<EOL>if o is not None:<EOL><INDENT>yield o<EOL><DEDENT><DEDENT><DEDENT>return mapper_filter(objects)<EOL>
Get list of depositions (as iterator).

    This is redefined Deposition.get_depositions classmethod without order-by
    for better performance.