Esempio n. 1
0
    def handle(self, *args, **options):
        """
        By convention set by django developers, this method actually executes command's actions.
        So, there could be no better docstring than emphasize this once again.
        """
        if (not options['library_ids']
                and not options['all']) or (options['library_ids']
                                            and options['all']):
            raise CommandError(
                u"reindex_library requires one or more <library_id>s or the --all flag."
            )

        store = modulestore()

        if options['all']:
            if query_yes_no(self.CONFIRMATION_PROMPT, default="no"):
                library_keys = [
                    library.location.library_key.replace(branch=None)
                    for library in store.get_libraries()
                ]
            else:
                return
        else:
            library_keys = list(
                map(self._parse_library_key, options['library_ids']))

        for library_key in library_keys:
            print(u"Indexing library {}".format(library_key))
            LibrarySearchIndexer.do_library_reindex(store, library_key)
Esempio n. 2
0
    def handle(self, *args, **options):
        """
        By convention set by django developers, this method actually executes command's actions.
        So, there could be no better docstring than emphasize this once again.
        """
        if len(args) == 0 and not options.get('all', False):
            raise CommandError(
                u"reindex_library requires one or more arguments: <library_id>"
            )

        store = modulestore()

        if options.get('all', False):
            if query_yes_no(self.CONFIRMATION_PROMPT, default="no"):
                library_keys = [
                    library.location.library_key.replace(branch=None)
                    for library in store.get_libraries()
                ]
            else:
                return
        else:
            library_keys = map(self._parse_library_key, args)

        for library_key in library_keys:
            LibrarySearchIndexer.do_library_reindex(store, library_key)
    def handle(self, *args, **options):
        """
        By convention set by django developers, this method actually executes command's actions.
        So, there could be no better docstring than emphasize this once again.
        """
        if len(args) == 0 and not options.get('all', False):
            raise CommandError(u"reindex_library requires one or more arguments: <library_id>")

        store = modulestore()

        if options.get('all', False):
            if query_yes_no(self.CONFIRMATION_PROMPT, default="no"):
                library_keys = [library.location.library_key.replace(branch=None) for library in store.get_libraries()]
            else:
                return
        else:
            library_keys = map(self._parse_library_key, args)

        for library_key in library_keys:
            LibrarySearchIndexer.do_library_reindex(store, library_key)
Esempio n. 4
0
    def handle(self, *args, **options):
        """
        By convention set by django developers, this method actually executes command's actions.
        So, there could be no better docstring than emphasize this once again.
        """
        if (not options['library_ids'] and not options['all']) or (options['library_ids'] and options['all']):
            raise CommandError(u"reindex_library requires one or more <library_id>s or the --all flag.")

        store = modulestore()

        if options['all']:
            if query_yes_no(self.CONFIRMATION_PROMPT, default="no"):
                library_keys = [library.location.library_key.replace(branch=None) for library in store.get_libraries()]
            else:
                return
        else:
            library_keys = map(self._parse_library_key, options['library_ids'])

        for library_key in library_keys:
            print("Indexing library {}".format(library_key))
            LibrarySearchIndexer.do_library_reindex(store, library_key)
Esempio n. 5
0
 def reindex_library(self, store):
     """ kick off complete reindex of the course """
     return LibrarySearchIndexer.do_library_reindex(store, self.library.location.library_key)
 def reindex_library(self, store):
     """ kick off complete reindex of the course """
     return LibrarySearchIndexer.do_library_reindex(store, self.library.location.library_key)