def getInfo(self):
    "Returns info about the container's contents"
    sLang = context.request.get_lang()
    lstChildren = []
    children = self.get_children()
    for child in children:
        obj = {
            'id': child.id,
            'cc': child.contentclass,
            'image': child.__image__,
            'displayName': child.displayName.value,
            'isCollection': child.isCollection,
            'modified': date.Date(child.modified)}
        if hasattr(child, 'size'):
            obj['size'] = child.size
        lstChildren.append(obj)

    containment = []
    for contained in self.containment:
        image = misc.get_rto_by_name(contained).__image__
        if not type(image) == str:
            image = ''
        localestring = resources.get_resource(contained, sLang)
        containment.append([localestring, contained, image])

    return {
        'displayName': self.displayName.value,
        'path': misc.get_full_path(self),
        'parentid': self.parentid,
        'iscollection': self.isCollection,
        'containment': containment,
        'user_role': permsresolver.get_access(self, context.user),
        'contents': lstChildren}
Пример #2
0
def getInfo(self):
    "Returns info about the container's contents"
    sLang = context.request.get_lang()
    lstChildren = []
    children = self.get_children()
    for child in children:
        obj = {
            'id': child.id,
            'cc': child.contentclass,
            'image': child.__image__,
            'displayName': child.displayName.value,
            'isCollection': child.isCollection,
            'modified': date.Date(child.modified)
        }
        if hasattr(child, 'size'):
            obj['size'] = child.size
        lstChildren.append(obj)

    containment = []
    for contained in self.containment:
        image = misc.get_rto_by_name(contained).__image__
        if not type(image) == str:
            image = ''
        localestring = resources.get_resource(contained, sLang)
        containment.append([localestring, contained, image])

    return {
        'displayName': self.displayName.value,
        'path': misc.get_full_path(self),
        'parentid': self.parentid,
        'iscollection': self.isCollection,
        'containment': containment,
        'user_role': permsresolver.get_access(self, context.user),
        'contents': lstChildren
    }