sitetree/sitetreeapp.py
def get_tree_current_item(self, tree_alias):
        """Resolves current tree item of 'tree_alias' tree matching current
        request path against URL of given tree item.

        :param str|unicode tree_alias:
        :rtype: TreeItemBase
        """
        current_item = self._current_items.get(tree_alias, _UNSET)

        if current_item is not _UNSET:

            if current_item is not None:
                current_item.is_current = True  # Could be reset by .get_sitetree()

            return current_item

        current_item = None

        if self.current_app_is_admin():
            self._current_items[tree_alias] = current_item
            return None

        # urlquote is an attempt to support non-ascii in url.
        current_url = self.current_request.path
        if isinstance(current_url, str):
            current_url = current_url.encode('UTF-8')
        if current_url:
            current_url = urlquote(current_url)

        for url_item, url in self._items_urls.items():
            # Iterate each as this dict may contains "current" items for various trees.
            if url != current_url:
                continue

            url_item.is_current = True
            if url_item.tree.alias == tree_alias:
                current_item = url_item

        if current_item is not None:
            self._current_items[tree_alias] = current_item

        return current_item
def get_tree_current_item(self, tree_alias):
        current_item = self._current_items.get(tree_alias, _UNSET)

        if current_item is not _UNSET:

            if current_item is not None:
                current_item.is_current = True  # Could be reset by .get_sitetree()

            return current_item

        current_item = None

        if self.current_app_is_admin():
            self._current_items[tree_alias] = current_item
            return None

        # urlquote is an attempt to support non-ascii in url.
        current_url = self.current_request.path
        if isinstance(current_url, str):
            current_url = current_url.encode('UTF-8')
        if current_url:
            current_url = urlquote(current_url)

        for url_item, url in self._items_urls.items():
            # Iterate each as this dict may contains "current" items for various trees.
            if url != current_url:
                continue

            url_item.is_current = True
            if url_item.tree.alias == tree_alias:
                current_item = url_item

        if current_item is not None:
            self._current_items[tree_alias] = current_item

        return current_item
def get_tree_current_item ( self , tree_alias ) : current_item = self . _current_items . get ( tree_alias , _UNSET ) if current_item is not _UNSET : if current_item is not None : current_item . is_current = True # Could be reset by .get_sitetree() return current_item current_item = None if self . current_app_is_admin ( ) : self . _current_items [ tree_alias ] = current_item return None # urlquote is an attempt to support non-ascii in url. current_url = self . current_request . path if isinstance ( current_url , str ) : current_url = current_url . encode ( 'UTF-8' ) if current_url : current_url = urlquote ( current_url ) for url_item , url in self . _items_urls . items ( ) : # Iterate each as this dict may contains "current" items for various trees. if url != current_url : continue url_item . is_current = True if url_item . tree . alias == tree_alias : current_item = url_item if current_item is not None : self . _current_items [ tree_alias ] = current_item return current_item
Resolves current tree item of 'tree_alias' tree matching current
        request path against URL of given tree item.

        :param str|unicode tree_alias:
        :rtype: TreeItemBase
Resolves current tree item of tree_alias tree matching current request path against URL of given tree item .