Esempio n. 1
0
    def _run_tasks(obj, dummy_eng):
        d = Deposition(obj)
        sip = d.get_latest_sip(sealed=True)

        recid = sip.metadata['recid']
        communities = sip.metadata.get('provisional_communities', [])

        common_args = ['-P5', ]
        sequenceid = getattr(d.workflow_object, 'task_sequence_id', None)
        if sequenceid:
            common_args += ['-I', str(sequenceid)]

        if update:
            tasklet_name = 'bst_openaire_update_upload'
        else:
            tasklet_name = 'bst_openaire_new_upload'

        task_id = task_low_level_submission(
            'bibtasklet', 'webdeposit', '-T', tasklet_name,
            '--argument', 'recid=%s' % recid, *common_args
        )
        sip.task_ids.append(task_id)

        for c in communities:
            task_id = task_low_level_submission(
                'webcoll', 'webdeposit', '-c', 'provisional-user-%s' % c,
                *common_args
            )
            sip.task_ids.append(task_id)
        d.update()
Esempio n. 2
0
    def _run_tasks(obj, dummy_eng):
        d = Deposition(obj)
        sip = d.get_latest_sip(sealed=True)

        recid = sip.metadata['recid']
        communities = sip.metadata.get('provisional_communities', [])

        common_args = [
            '-P5',
        ]
        sequenceid = getattr(d.workflow_object, 'task_sequence_id', None)
        if sequenceid:
            common_args += ['-I', str(sequenceid)]

        if update:
            tasklet_name = 'bst_openaire_update_upload'
        else:
            tasklet_name = 'bst_openaire_new_upload'

        task_id = task_low_level_submission('bibtasklet', 'webdeposit', '-T',
                                            tasklet_name, '--argument',
                                            'recid=%s' % recid, *common_args)
        sip.task_ids.append(task_id)

        for c in communities:
            task_id = task_low_level_submission('webcoll', 'webdeposit', '-c',
                                                'provisional-user-%s' % c,
                                                *common_args)
            sip.task_ids.append(task_id)
        d.update()
Esempio n. 3
0
    def _reserved_recid(obj, dummy_eng):
        d = Deposition(obj)
        sip = d.get_latest_sip(sealed=False)
        reserved_doi = sip.metadata.get('prereserve_doi', None)

        if reserved_doi and reserved_doi['recid']:
            sip.metadata['recid'] = reserved_doi['recid']

        d.update()
Esempio n. 4
0
    def _reserved_recid(obj, dummy_eng):
        d = Deposition(obj)
        sip = d.get_latest_sip(sealed=False)
        reserved_doi = sip.metadata.get('prereserve_doi', None)

        if reserved_doi and reserved_doi['recid']:
            sip.metadata['recid'] = reserved_doi['recid']

        d.update()
Esempio n. 5
0
 def _api_validate_files(obj, eng):
     if getattr(request, 'is_api_request', False):
         d = Deposition(obj)
         if len(d.files) < 1:
             d.set_render_context(dict(
                 message="Bad request",
                 status=400,
                 errors=[dict(
                     message="Minimum one file must be provided.",
                     code=error_codes['validation_error']
                 )],
             ))
             d.update()
             eng.halt("API: No files provided")
         else:
             # Mark all drafts as completed
             for draft in d.drafts.values():
                 draft.complete()
             d.update()
Esempio n. 6
0
 def _api_validate_files(obj, eng):
     if getattr(request, 'is_api_request', False):
         d = Deposition(obj)
         if len(d.files) < 1:
             d.set_render_context(
                 dict(
                     message="Bad request",
                     status=400,
                     errors=[
                         dict(message="Minimum one file must be provided.",
                              code=error_codes['validation_error'])
                     ],
                 ))
             d.update()
             eng.halt("API: No files provided")
         else:
             # Mark all drafts as completed
             for draft in d.drafts.values():
                 draft.complete()
             d.update()