'Check whether this item is in the selected path (i.e. whether it
is or contains the item used to trigger the request).
This check doesn\'t change the processing of the item, but
rather sets the selected-flag which can then be used by the
renderer
If this is a top-level item, then this check sets the
selected-flags for the whole selected path down to the leaf
item that has triggered the request.
Note that this doesn\'t currently reset selected-flags, so this
check can be performed only once per subtree and request. If
it would be really neccessary to perform this check more than
once, then it should be easy to implement a reset_flags method.
@param request: the request object, defaults to current.request'

def check_selected(self, request=None):

    if (self.selected is not None):
        return self.selected
    if (request is None):
        request = current.request
    if (self.parent is None):
        branch = self.branch(request)
        if (branch is not None):
            branch.select()
        if (not self.selected):
            self.selected = False
    else:
        root = self.get_root()
        if (root.selected is None):
            root.check_selected(request)
    return (True if self.selected else False)
