Exemple #1
0
    def handle(self, *args, **options):
        channel_id = options['channel_id']
        force = options['force']
        send_email = options['email']
        user_id = options['user_id']
        force_exercises = options['force-exercises']

        try:
            publish.publish_channel(user_id, channel_id, force,
                                    force_exercises, send_email)
        except publish.EarlyExit as e:
            logging.warning("Publishing exited early: {message}.".format(
                message=e.message))
            self.stdout.write(
                "You can find your database in {path}".format(path=e.db_path))
Exemple #2
0
def export_channel_task(self,
                        user_id,
                        channel_id,
                        version_notes="",
                        language=settings.LANGUAGE_CODE):
    with translation.override(language):
        channel = publish_channel(
            user_id,
            channel_id,
            version_notes=version_notes,
            send_email=True,
            progress_tracker=self.progress,
        )
    return {
        "changes": [
            generate_update_event(
                channel_id, CHANNEL, {
                    "published": True,
                    "primary_token": channel.get_human_token().token
                }),
            generate_update_event(channel.main_tree.pk, CONTENTNODE, {
                "published": True,
                "changed": False
            }),
        ]
    }
Exemple #3
0
    def handle(self, *args, **options):
        channel_id = options["channel_id"]
        force = options["force"]
        send_email = options["email"]
        user_id = options["user_id"]
        force_exercises = options["force-exercises"]
        version_notes = options.get("version_notes")

        try:
            publish.publish_channel(
                user_id,
                channel_id,
                force=force,
                force_exercises=force_exercises,
                send_email=send_email,
                version_notes=version_notes,
            )
        except ValueError as e:
            logging.warning("Publishing exited early: {message}.".format(
                message=e.message))
            self.stdout.write(
                "You can find your database in {path}".format(path=e.db_path))
Exemple #4
0
def export_channel_task(self, user_id, channel_id, version_notes=''):
    publish_channel(user_id,
                    channel_id,
                    version_notes=version_notes,
                    send_email=True,
                    task_object=self)
Exemple #5
0
def export_channel_task(self, user_id, channel_id):
    publish_channel(user_id, channel_id, send_email=True, task_object=self)