Calculate the physical path of this object

    :param brain_or_object: A single catalog brain or content object
    :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain
    :returns: Physical path of the object
    :rtype: string
198360
def get_path(brain_or_object):
    
    if is_brain(brain_or_object):
        return brain_or_object.getPath()
    return "/".join(get_object(brain_or_object).getPhysicalPath())
102107
def get_parent(brain_or_object):
    

    if is_root(brain_or_object):
        return get_portal()

    if is_brain(brain_or_object):
        parent_path = get_parent_path(brain_or_object)
        return get_object_by_path(parent_path)

    return brain_or_object.aq_parent
1317256
def rel_path_to(self, dest):
        
        dest = self.__class__(dest)

        orig_list = self.norm_case()._components()
        dest_list = dest._components()

        i = -1
        for i, (orig_part, dest_part) in enumerate(zip(orig_list, dest_list)):
            if orig_part != self._normcase(dest_part):
                up = ['..'] * (len(orig_list) - i)
                return self.__class__(*(up + dest_list[i:]))

        if len(orig_list) <= len(dest_list):
            if len(dest_list) > i + 1:
                return self.__class__(*dest_list[i + 1:])
            else:
                return self.__class__('')
        else:
            up = ['..'] * (len(orig_list) - i - 1)
            return self.__class__(*up)
310013
def get_object_by_path(path):
    

    # nothing to do here
    if not isinstance(path, basestring):
        return None

    # path must be a string
    path = str(path)

    portal = get_portal()
    portal_path = get_path(portal)

    if path == portal_path:
        return portal

    if path.startswith(portal_path):
        segments = path.split("/")
        path = "/".join(segments[2:])

    try:
        return portal.restrictedTraverse(str(path))
    except (KeyError, AttributeError):
        fail(404, "No object could be found at {}".format(str(path)))
1235771
def get_object_by_uid(uid, default=_marker):
    

    # nothing to do here
    if not uid:
        if default is not _marker:
            return default
        fail("get_object_by_uid requires UID as first argument; got {} instead"
             .format(uid))

    # we defined the portal object UID to be '0'::
    if uid == '0':
        return get_portal()

    brain = get_brain_by_uid(uid)

    if brain is None:
        if default is not _marker:
            return default
        fail("No object found for UID {}".format(uid))

    return get_object(brain)
520221
def _get_class_path(self, klass_or_instance):
        
        if inspect.isclass(klass_or_instance):
            klass = '{}.{}'.format(klass_or_instance.__module__, klass_or_instance.__name__)
        elif not isinstance(klass_or_instance, str):
            klass = klass_or_instance.__class__
            klass = '{}.{}'.format(klass.__module__, klass.__name__)
        else:
            klass = klass_or_instance

        return klass
770827
def get_objects_in_sequence(brain_or_object, ctype, cref):
    
    obj = api.get_object(brain_or_object)
    if ctype == "backreference":
        return get_backreferences(obj, cref)
    if ctype == "contained":
        return get_contained_items(obj, cref)
    raise ValueError("Reference value is mandatory for sequence type counter")
1236081
def get_publish_path(self, obj):
        
        return os.path.join(
            obj.chat_type.publish_path, obj.publish_path.lstrip("/")
        )
490796
def get_icon_for(self, brain_or_object):
        
        portal_types = api.get_tool("portal_types")
        fti = portal_types.getTypeInfo(api.get_portal_type(brain_or_object))
        icon = fti.getIcon()
        if not icon:
            return ""
        # Always try to get the big icon for high-res displays
        icon_big = icon.replace(".png", "_big.png")
        # fall back to a default icon if the looked up icon does not exist
        if self.context.restrictedTraverse(icon_big, None) is None:
            icon_big = None
        portal_url = api.get_url(api.get_portal())
        title = api.get_title(brain_or_object)
        html_tag = "<img title='{}' src='{}/{}' width='16' />".format(
            title, portal_url, icon_big or icon)
        logger.info("Generated Icon Tag for {}: {}".format(
            api.get_path(brain_or_object), html_tag))
        return html_tag
745771
def temporary_object_path(self, name):
        
        return os.path.join(self._path, self.TMP_OBJ_DIR, name)
508071
def get_inactive_status(brain_or_object, default="active"):
    
    if is_brain(brain_or_object):
        return getattr(brain_or_object, "inactive_state", default)
    workflows = get_workflows_for(brain_or_object)
    if 'bika_inactive_workflow' not in workflows:
        return default
    return get_workflow_status_of(brain_or_object, 'inactive_state')
783270
def find_subject_path(sid):
    '''
    
    '''
    # if it's a full/relative path already, use it:
    sub = str(sid)
    sdirs = config['hcp_subject_paths']
    if _auto_download_options is not None and 'subjects_path' in _auto_download_options:
        sdirs = list(sdirs) + [_auto_download_options['subjects_path']]
    if os.path.isdir(sub): return os.path.abspath(sub)
    pth = next((os.path.abspath(p) for sd in sdirs
                for p in [os.path.join(sd, sub)]
                if os.path.isdir(p)),
               None)
    if pth is not None: return pth
    # see if we can create them
    if _auto_download_options is None or not _auto_download_options['structure'] or \
       not _auto_downloadable(sid):
        return None
    # first see if the subject existst there
    pth = os.path.join(_auto_download_options['subjects_path'], sub)
    if os.path.isdir(pth): return pth
    try: os.makedirs(os.path.abspath(pth), 0o755)
    except Exception: return None
    return pth
1017548
def get_behaviors(brain_or_object):
    
    obj = get_object(brain_or_object)
    if not is_dexterity_content(obj):
        fail(400, "Only Dexterity contents can have assigned behaviors")
    assignable = IBehaviorAssignable(obj, None)
    if not assignable:
        return {}
    out = {}
    for behavior in assignable.enumerateBehaviors():
        for name, field in getFields(behavior.interface).items():
            out[name] = field
    return out
1165846
def get_object_by_uid(uid, default=_marker):
    

    # nothing to do here
    if not uid:
        if default is not _marker:
            return default
        fail("get_object_by_uid requires UID as first argument; got {} instead"
             .format(uid))

    # we defined the portal object UID to be '0'::
    if uid == '0':
        return get_portal()

    # we try to find the object with both catalogs
    pc = get_portal_catalog()
    uc = get_tool("uid_catalog")

    # try to find the object with the reference catalog first
    brains = uc(UID=uid)
    if brains:
        return brains[0].getObject()

    # try to find the object with the portal catalog
    res = pc(UID=uid)
    if not res:
        if default is not _marker:
            return default
        fail("No object found for UID {}".format(uid))

    return get_object(res[0])
86291
def get_url(brain_or_object):
    
    if is_brain(brain_or_object) and base_hasattr(brain_or_object, "getURL"):
        return brain_or_object.getURL()
    return get_object(brain_or_object).absolute_url()
665772
def is_folderish(brain_or_object):
    
    if hasattr(brain_or_object, "is_folderish"):
        if callable(brain_or_object.is_folderish):
            return brain_or_object.is_folderish()
        return brain_or_object.is_folderish
    return IFolderish.providedBy(get_object(brain_or_object))
1218932
def relpath(self):
        
        here = os.path.abspath(os.path.curdir)
        relpath = os.path.relpath(self.fpath, here)
        return relpath