clients/ckanDraft.py
def patchRefs(self, refs, prefix = 'hdl.handle.net/'):
        '''
        Patches a draft with tickets and pids for data objects as otherReferences.
        Expects a dictionary irods obj path --> ticket
        '''
        errorMsg = []
        curMeta = self.data
        if prefix == 'hdl.handle.net/':
            curMeta['extras'].append({'key': 'File Handles',
                'value': str([os.path.basename(ref)+'> '+prefix+refs[ref] for ref in refs])})
        else:
            curMeta['extras'].append({'key': 'iRODS ticket', 
                'value': str([ref+' '+prefix+refs[ref] for ref in refs])})

        action = 'package_update'
        action_url = 'http://{api}/action/{action}'.format(api=self.apiUrl, action=action)
        data_string = quote(json.dumps(curMeta))
        request = Request(action_url, data_string)
        request.add_header('Authorization', self.apiToken)

        try:
            response = urlopen(request) # if name already exists or is not given throws 409
            self.data = curMeta
            errorMsg.append('Dataverse PUBLISH INFO: Draft patched with refs: '+str(refs))
        except:
            errorMsg.append('Dataverse PUBLISH ERROR: Draft not patched with data references.')
        return errorMsg

        Patches a draft with tickets and pids for data objects as otherReferences.
        Expects a dictionary irods obj path --> ticket
        
Patches a draft with tickets and pids for data objects as otherReferences.
Expects a dictionary irods obj path --> ticket
Patches a draft with tickets and pids for data objects as otherReferences . Expects a dictionary irods obj path -- > ticket
def patchRefs(self, refs, prefix = 'hdl.handle.net/'):
        errorMsg = []
        curMeta = self.data
        if prefix == 'hdl.handle.net/':
            curMeta['extras'].append({'key': 'File Handles',
                'value': str([os.path.basename(ref)+'> '+prefix+refs[ref] for ref in refs])})
        else:
            curMeta['extras'].append({'key': 'iRODS ticket', 
                'value': str([ref+' '+prefix+refs[ref] for ref in refs])})
        action = 'package_update'
        action_url = 'http://{api}/action/{action}'.format(api=self.apiUrl, action=action)
        data_string = quote(json.dumps(curMeta))
        request = Request(action_url, data_string)
        request.add_header('Authorization', self.apiToken)
        try:
            response = urlopen(request) 
            self.data = curMeta
            errorMsg.append('Dataverse PUBLISH INFO: Draft patched with refs: '+str(refs))
        except:
            errorMsg.append('Dataverse PUBLISH ERROR: Draft not patched with data references.')
        return errorMsg
def patchRefs ( self , refs , prefix = 'hdl.handle.net/' ) : errorMsg = [ ] curMeta = self . data if prefix == 'hdl.handle.net/' : curMeta [ 'extras' ] . append ( { 'key' : 'File Handles' , 'value' : str ( [ os . path . basename ( ref ) + '> ' + prefix + refs [ ref ] for ref in refs ] ) } ) else : curMeta [ 'extras' ] . append ( { 'key' : 'iRODS ticket' , 'value' : str ( [ ref + ' ' + prefix + refs [ ref ] for ref in refs ] ) } ) action = 'package_update' action_url = 'http://{api}/action/{action}' . format ( api = self . apiUrl , action = action ) data_string = quote ( json . dumps ( curMeta ) ) request = Request ( action_url , data_string ) request . add_header ( 'Authorization' , self . apiToken ) try : response = urlopen ( request ) self . data = curMeta errorMsg . append ( 'Dataverse PUBLISH INFO: Draft patched with refs: ' + str ( refs ) ) except : errorMsg . append ( 'Dataverse PUBLISH ERROR: Draft not patched with data references.' ) return errorMsg
Patches a draft with tickets and pids for data objects as otherReferences.
Patches a draft with tickets and pids for data objects as otherReferences .
'''
        Patches a draft with tickets and pids for data objects as otherReferences.
        Expects a dictionary irods obj path --> ticket
        ''' # if name already exists or is not given throws 409
self
refs
prefix