except Exception, e: return render_to_response( '__main__:templates/sample31.pt', {'error': str(e)}) i = i + 1 #If job status Postponed throw exception with error if jobInfo.result.job_status == "Postponed": return render_to_response( '__main__:templates/sample31.pt', {'error': 'Merge datasource is failed'}) fileGuid = jobInfo.result.inputs[0].outputs[0].guid try: # Create envelope using user id and entered by user name envelop = signature.CreateSignatureEnvelope( clientId, name=jobInfo.result.inputs[0].outputs[0].name) if envelop.status == "Ok": time.sleep(3) try: # Add uploaded document to envelope addDocument = signature.AddSignatureEnvelopeDocument( clientId, envelop.result.envelope.id, fileGuid) if addDocument.status == "Ok": # Get role list for curent user try: recipient = signature.GetRolesList( clientId)
#Obtaining all Entities from current user files = storage.ListEntities(userId=clientId, path='My Web Documents', pageIndex=0) #Obtaining file name for item in files.result.files: #selecting file names if item.guid == guid: fileName = item.name except Exception, e: return render_to_response('__main__:templates/sample21.pt', {'error': str(e)}) try: # Create envelope using user id and entered by user name envelop = signature.CreateSignatureEnvelope(clientId, name=fileName) if envelop.status == "Ok": # Add uploaded document to envelope addDocument = signature.AddSignatureEnvelopeDocument( clientId, envelop.result.envelope.id, guid) if addDocument.status == "Ok": # Get role list for curent user recipient = signature.GetRolesList(clientId) if recipient.status == "Ok": # Get id of role which can sign roleId = None for item in recipient.result.roles: if item.name == "Signer": roleId = item.id # add recipient