@base.require_fully_signed_up
    def post(self):
        title = self.payload.get('title')
        category = self.payload.get('category')
        objective = self.payload.get('objective')
        # TODO(bhenning): Implement support for language codes in collections.

        if not title:
            raise self.InvalidInputException('No title supplied.')
        if not category:
            raise self.InvalidInputException('No category chosen.')

        new_collection_id = collection_services.get_new_collection_id()
        collection = collection_domain.Collection.create_default_collection(
            new_collection_id, title, category, objective=objective)
        collection_services.save_new_collection(self.user_id, collection)

        self.render_json({COLLECTION_ID_KEY: new_collection_id})
Write the content of a PdfFileWriter object to a file.
dataset/ETHPy150Open oppia/oppia/core/controllers/galleries.py/NewCollection.post--crossover with--dataset/ETHPy150Open hellerbarde/stapler/staplelib/iohelper.py/write_pdf