Category list postprocessing routine, responsible adding of content categories
501976
protected function _ppAddContentCategories()
    {
        // load content pages for adding them into menu tree
        $oContentList = oxNew(\OxidEsales\Eshop\Application\Model\ContentList::class);
        $oContentList->loadCatMenues();

        foreach ($oContentList as $sCatId => $aContent) {
            if (array_key_exists($sCatId, $this->_aArray)) {
                $this[$sCatId]->setContentCats($aContent);
            }
        }
    }
702802
def load_categories(self, max_pages=30):
        
        logger.info("loading categories")

        # clear them all out so we don't get dupes if requested
        if self.purge_first:
            Category.objects.filter(site_id=self.site_id).delete()

        path = "sites/{}/categories".format(self.site_id)
        params = {"number": 100}
        page = 1

        response = self.get(path, params)

        if not response.ok:
            logger.warning("Response NOT OK! status_code=%s\n%s", response.status_code, response.text)

        while response.ok and response.text and page < max_pages:
            logger.info(" - page: %d", page)

            api_categories = response.json().get("categories")
            if not api_categories:
                # we're done here
                break

            categories = []
            for api_category in api_categories:

                # if it exists locally, update local version if anything has changed
                existing_category = Category.objects.filter(site_id=self.site_id, wp_id=api_category["ID"]).first()
                if existing_category:
                    self.update_existing_category(existing_category, api_category)
                else:
                    categories.append(self.get_new_category(api_category))

            if categories:
                Category.objects.bulk_create(categories)
            elif not self.full:
                # we're done here
                break

            # get next page
            page += 1
            params["page"] = page
            response = self.get(path, params)

            if not response.ok:
                logger.warning("Response NOT OK! status_code=%s\n%s", response.status_code, response.text)
                return
731292
def flash(
    categories, param_file, project_dir, plugin, target,
    status_update_interval, board
):
    
    _init(board, project_dir)
    _run(
        categories, param_file, project_dir, plugin, target,
        status_update_interval
    )
    print "Done"
810405
def _set_categories(self):
        
        for column, _ in self._categories.items():
            if column in self.columns:
                self[column] = self[column].astype('category')
161995
def make_category(self, string, parent=None, order=1):
        
        cat = Category(
            name=string.strip(),
            slug=slugify(SLUG_TRANSLITERATOR(string.strip()))[:49],
            # arent=parent,
            order=order
        )
        cat._tree_manager.insert_node(cat, parent, 'last-child', True)
        cat.save()
        if parent:
            parent.rght = cat.rght + 1
            parent.save()
        return cat
263207
def recategorize(self, new_categories):
        '''
        
        '''
        assert len(new_categories) == self.get_num_docs()

        new_category_idx_store = IndexStoreFromList.build(set(new_categories))
        new_y = np.array(new_category_idx_store.getidxstrictbatch(new_categories))

        new_tdm = self._make_new_term_doc_matrix(self._X, self._mX, new_y, self._term_idx_store, new_category_idx_store,
                                                 self._metadata_idx_store, new_y == new_y)
        return new_tdm
227557
def category(self, category):
        
        self.url.category = category
        self.url.set_page(1)
        return self
1371005
public function sort_categories() {
        $this->attach_nodes_to_categories();
        $tempcategories = array();
        foreach ($this->categories as $category) {
            $after = $category->after;
            if ($after == null) {
                // Can go anywhere in the tree.
                $category->sort_nodes();
                $tempcategories = array_merge($tempcategories, array($category->name => $category),
                        $this->find_categories_after($category));
            }
        }
        if (count($tempcategories) !== count($this->categories)) {
            // Orphan categories found.
            throw new \coding_exception('Some of the categories specified contains invalid \'after\' property');
        }
        $this->categories = $tempcategories;
    }
118050
public void onUpdateCategoriesList(List<CmsCategoryBean> categoriesList, List<String> selectedCategories) {

        m_galleryDialog.getCategoriesTab().updateContentList(categoriesList, selectedCategories);
    }
978941
def prepare
      options[:category] = options[:value] if options[:value] && !options[:category]
      fail "No categorizer set up for category tracker #{inspect}" unless options[:category]

      @categorizer = create_lambda(options[:category]) unless options[:multiple]

      # Initialize the categories. Use the list of category names to
      @categories = {}
      options[:all_categories].each { |cat| @categories[cat] = 0 } if options[:all_categories].is_a?(Enumerable)
    end
977433
private void loadCategories() {

        CmsRpcAction<List<CmsCategoryTreeEntry>> action = new CmsRpcAction<List<CmsCategoryTreeEntry>>() {

            @Override
            public void execute() {

                start(200, true);
                CmsCoreProvider.getService().getCategoriesForSitePath(m_dialogBean.getReferenceSitePath(), this);
            }

            @Override
            protected void onResponse(List<CmsCategoryTreeEntry> result) {

                m_dialogBean.setCategories(result);
                m_handler.setCategoriesTabContent(result, new ArrayList<String>());
                m_handler.onCategoriesTabSelection();
                stop(false);
            }
        };
        action.execute();
    }
731019
protected function process()
    {

        // query whether or not, we've found a new path => means we've found a new category
        if ($this->hasBeenProcessed($path = $this->getValue(ColumnKeys::PATH))) {
            return;
        }

        // load the category by it's path
        $category = $this->loadCategory($this->mapPath($path));

        // FIRST delete the data related with the category with the passed category path
        $this->deleteUrlRewrite(array(ColumnKeys::PATH => $category[MemberNames::PATH]), SqlStatementKeys::DELETE_URL_REWRITE_BY_PATH);
        $this->deleteUrlRewrite(array(MemberNames::CATEGORY_ID => $category[$this->getPkMemberName()]), SqlStatementKeys::DELETE_URL_REWRITE_BY_CATEGORY_ID);

        // delete the category with the passed path
        $this->deleteCategory(array(ColumnKeys::PATH => $category[MemberNames::PATH]));

        // remove the path => entity ID mapping from the subject
        $this->removePathEntityIdMapping($path);

        // store the ID of the last deleted category
        $this->setLastEntityId($category[$this->getPkMemberName()]);
    }
166039
protected function wizardAddCategory()
    {
        // Required
        $this->validatePrompt('title', $this->text('Title'), 'category');
        $this->validatePrompt('category_group_id', $this->text('Category group ID'), 'category');

        // Optional
        $this->validatePrompt('parent_id', $this->text('Parent category ID'), 'category', 0);
        $this->validatePrompt('description_1', $this->text('First description'), 'category', '');
        $this->validatePrompt('description_2', $this->text('Second description'), 'category', '');
        $this->validatePrompt('meta_title', $this->text('Meta title'), 'category', '');
        $this->validatePrompt('meta_description', $this->text('Meta description'), 'category', '');
        $this->validatePrompt('status', $this->text('Status'), 'category', 0);
        $this->validatePrompt('weight', $this->text('Weight'), 'category', 0);

        $this->validateComponent('category');
        $this->addCategory();
    }
1337595
protected function process()
    {

        // prepare the URL rewrites
        $this->prepareUrlRewrites();

        // iterate over the categories and create the URL rewrites
        foreach ($this->urlRewrites as $categoryId => $urlRewrite) {
            // initialize and persist the URL rewrite
            if ($urlRewrite = $this->initializeUrlRewrite($urlRewrite)) {
                // initialize URL rewrite and catagory ID
                $this->categoryId = $categoryId;

                try {
                    // persist the URL rewrite
                    $this->urlRewriteId = $this->persistUrlRewrite($urlRewrite);

                    /*
                     * Attention! Stop processing, if this is a root category, because Magento needs explicitly
                     * NO URL rewrite product category relation to render canonical and meta og:url tag!
                     */
                    if ($this->isRootCategory($this->getCategory($categoryId))) {
                        continue;
                    }

                    // initialize and persist the URL rewrite product => category relation
                    $urlRewriteProductCategory = $this->initializeUrlRewriteProductCategory(
                        $this->prepareUrlRewriteProductCategoryAttributes()
                    );

                    // persist the URL rewrite product category relation
                    $this->persistUrlRewriteProductCategory($urlRewriteProductCategory);
                } catch (\Exception $e) {
                    // query whether or not debug mode has been enabled
                    if ($this->getSubject()->isDebugMode()) {
                        $this->getSubject()
                             ->getSystemLogger()
                             ->warning($this->getSubject()->appendExceptionSuffix($e->getMessage()));
                    } else {
                        throw $e;
                    }
                }
            }
        }
    }
894758
public void updateContentList(List<CmsCategoryBean> categoriesBeans, List<String> selectedCategories) {

        clearList();
        if (m_categories == null) {
            m_categories = new HashMap<String, CmsCategoryBean>();
        }
        if ((categoriesBeans != null) && !categoriesBeans.isEmpty()) {
            for (CmsCategoryBean categoryBean : categoriesBeans) {
                m_categories.put(categoryBean.getPath(), categoryBean);
                // set the list item widget
                CmsDataValue dataValue = new CmsDataValue(
                    600,
                    3,
                    CmsCategoryBean.SMALL_ICON_CLASSES,
                    categoryBean.getTitle(),
                    CmsStringUtil.isNotEmptyOrWhitespaceOnly(categoryBean.getDescription())
                    ? categoryBean.getDescription()
                    : categoryBean.getPath());
                // the checkbox
                CmsCheckBox checkBox = new CmsCheckBox();
                if ((selectedCategories != null) && selectedCategories.contains(categoryBean.getPath())) {
                    checkBox.setChecked(true);
                }
                SelectionHandler selectionHandler = new SelectionHandler(categoryBean.getPath(), checkBox);
                checkBox.addClickHandler(selectionHandler);
                dataValue.addClickHandler(selectionHandler);
                dataValue.setUnselectable();
                // set the category list item and add to list
                CmsTreeItem listItem = new CmsTreeItem(false, checkBox, dataValue);
                listItem.setSmallView(true);
                listItem.setId(categoryBean.getPath());
                addWidgetToList(listItem);
            }
        } else {
            showIsEmptyLabel();
        }
    }
275869
def registerCategory(category):
    
    # parse what level it is set to based on _DEBUG
    # example: *:2,admin:4
    global _DEBUG
    global _levels
    global _categories

    level = 0
    chunks = _DEBUG.split(',')
    for chunk in chunks:
        if not chunk:
            continue
        if ':' in chunk:
            spec, value = chunk.split(':')
        else:
            spec = '*'
            value = chunk

        # our glob is unix filename style globbing, so cheat with fnmatch
        # fnmatch.fnmatch didn't work for this, so don't use it
        if category in fnmatch.filter((category, ), spec):
            # we have a match, so set level based on string or int
            if not value:
                continue
            try:
                level = int(value)
            except ValueError: # e.g. *; we default to most
                level = 5
    # store it
    _categories[category] = level
123630
def _FlushCache(cls, format_categories):
    
    if definitions.FORMAT_CATEGORY_ARCHIVE in format_categories:
      cls._archive_remainder_list = None
      cls._archive_scanner = None
      cls._archive_store = None

    if definitions.FORMAT_CATEGORY_COMPRESSED_STREAM in format_categories:
      cls._compressed_stream_remainder_list = None
      cls._compressed_stream_scanner = None
      cls._compressed_stream_store = None

    if definitions.FORMAT_CATEGORY_FILE_SYSTEM in format_categories:
      cls._file_system_remainder_list = None
      cls._file_system_scanner = None
      cls._file_system_store = None

    if definitions.FORMAT_CATEGORY_STORAGE_MEDIA_IMAGE in format_categories:
      cls._storage_media_image_remainder_list = None
      cls._storage_media_image_scanner = None
      cls._storage_media_image_store = None

    if definitions.FORMAT_CATEGORY_VOLUME_SYSTEM in format_categories:
      cls._volume_system_remainder_list = None
      cls._volume_system_scanner = None
      cls._volume_system_store = None