Пример #1
0
def upload_file(proofId, fileSource, fileType):
    proof = get_by_id(proofId=proofId)

    if proof is None:
        raise NotFoundException(
            message="Proof not found associated with the given proofId (proofId=%d)" % proofId,
            code=MESSAGE_CODE_PROOF_NOT_FOUND
        )
    elif proof.finished is True:
        raise ForbiddenException(
            message="No more evidence is accepted for this proof (proofId=%d)" % proofId,
            code=MESSAGE_CODE_PROOF_NOT_MORE_EVIDENCE_ACCEPTED
        )
    else:
        file = File.createFromFileSource(
            fileSource=fileSource,
            fileType=fileType
        )

        FolderFile.create(
            folderId=proof.scannedFilesFolderId,
            fileId=file.fileId
        )

        return proof
def upload_file(proofId, fileSource, fileType):
    proof = get_by_id(proofId=proofId)

    if proof is None:
        raise NotFoundException(
            "Proof not found associated with the given proofId (proofId=%d)" %
            proofId)
    elif proof.finished is True:
        raise ForbiddenException(
            "No more evidence is accepted for this proof (proofId=%d)" %
            proofId)
    else:
        file = File.createFromFileSource(fileSource=fileSource,
                                         fileType=fileType)

        FolderFile.create(folderId=proof.scannedFilesFolderId,
                          fileId=file.fileId)

        return proof
Пример #3
0
 def set_number_of_seats_dataset(self, fileSource):
     dataset = File.createFromFileSource(fileSource=fileSource)
     self.numberOfSeatsDatasetId = dataset.fileId
Пример #4
0
 def set_invalid_vote_categories_dataset(self, fileSource):
     dataset = File.createFromFileSource(fileSource=fileSource)
     self.invalidVoteCategoriesDatasetId = dataset.fileId
Пример #5
0
 def set_party_candidates_dataset(self, fileSource):
     dataset = File.createFromFileSource(fileSource=fileSource)
     self.partyCandidateDatasetId = dataset.fileId
Пример #6
0
 def set_postal_counting_centres_dataset(self, fileSource):
     dataset = File.createFromFileSource(fileSource=fileSource)
     self.postalCountingCentresDatasetId = dataset.fileId
Пример #7
0
 def set_polling_stations_dataset(self, fileSource):
     dataset = File.createFromFileSource(fileSource=fileSource)
     self.pollingStationsDatasetId = dataset.fileId