

def handle(self, *args, **options):
    skipped_paths = []
    if (len(args) > 0):
        app_names = args[0]
        if (not isinstance(app_names, list)):
            app_names = app_names.split(',')
            _apps = []
            for app_name in app_names:
                try:
                    app = apps.get_app_config(app_name)
                except Exception as e:
                    skipped_paths(app_name)
                else:
                    _apps.append(app.path)
    else:
        _apps = apps.get_app_paths()
    for app_path in _apps:
        try:
            os.chdir(app_path)
            call_command('makemessages')
            call_command('compilemessages')
        except Exception as e:
            skipped_paths.append(app_path)
            self.stderr.write(str(e))
    if skipped_paths:
        self.stderr.write(('Skipped paths: \n%s' % '\n'.join(skipped_paths)))
    self.stdout.write('Successfully generated and compiled all messages')

dataset/ETHPy150Open django-leonardo/django-leonardo/leonardo/management/commands/update_translations.py Command.handle/original