# -*- coding: utf-8 -*-
from zope.interface import Interface
from plone.indexer import indexer
from six.moves import range


@indexer(Interface)
def path_string(obj, **kwargs):
    """return physical path as a string"""
    return "/".join(obj.getPhysicalPath())


@indexer(Interface)
def path_depth(obj, **kwargs):
    """return depth of physical path"""
    return len(obj.getPhysicalPath())


@indexer(Interface)
def path_parents(obj, **kwargs):
    """return all parent paths leading up to the object"""
    elements = obj.getPhysicalPath()
    return ["/".join(elements[: n + 1]) for n in range(1, len(elements))]

# -*- coding: utf-8 -*-
from zope.interface import Interface
from plone.indexer import indexer
from six.moves import range


@indexer(Interface)
def path_string(obj, **kwargs):
    """return physical path as a string"""
    return "/".join(obj.getPhysicalPath())


@indexer(Interface)
def path_depth(obj, **kwargs):
    """return depth of physical path"""
    return len(obj.getPhysicalPath())


@indexer(Interface)
def path_parents(obj, **kwargs):
    """return all parent paths leading up to the object"""
    elements = obj.getPhysicalPath()
    return ["/".join(elements[: n + 1]) for n in range(1, len(elements))]

# -*- coding: utf-8 -*- return physical path as a string return depth of physical path return all parent paths leading up to the object