Example #1
0
    def _create_revision_documents(self, bucket_name, documents):
        try:
            created_documents = db_api.documents_create(bucket_name, documents)
        except (deckhand_errors.DuplicateDocumentExists,
                deckhand_errors.SingletonDocumentConflict) as e:
            with excutils.save_and_reraise_exception():
                LOG.exception(e.format_message())

        return created_documents
Example #2
0
    def _create_revision_documents(self, bucket_name, documents, validations):
        try:
            created_documents = db_api.documents_create(
                bucket_name, documents, validations=validations)
        except (deckhand_errors.DocumentExists,
                deckhand_errors.SingletonDocumentConflict) as e:
            raise falcon.HTTPConflict(description=e.format_message())
        except Exception as e:
            raise falcon.HTTPInternalServerError(description=six.text_type(e))

        return created_documents
Example #3
0
    def create_documents(self,
                         bucket_name,
                         documents,
                         validation_policies=None):
        if not validation_policies:
            validation_policies = []

        if not isinstance(documents, list):
            documents = [documents]
        if not isinstance(validation_policies, list):
            validation_policies = [validation_policies]

        docs = db_api.documents_create(bucket_name, documents,
                                       validation_policies)

        return docs