• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jugmac00 / Products.ZopeTree / 3782653910

pending completion
3782653910

push

github

GitHub
[pre-commit.ci] pre-commit autoupdate

103 of 253 relevant lines covered (40.71%)

0.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Products/ZopeTree/TreeObjectWrapper.py
1
#
2
# TreeObjectWrapper
3
#
4
# Copyright (c) 2001-2003 by Philipp "philiKON" von Weitershausen
5
#
6
# This software is distributed under the terms of the Mozilla Public
7
# License (MPL)
8
#
9

10
"""
×
11
$Id: TreeObjectWrapper.py,v 1.5 2003/04/30 10:01:55 philipp Exp $
12
"""
13

14
import posixpath
×
15

16

17
class TreeObjectWrapper:
×
18
    """
19
    A wrapper around Zope objects to be more flexible when displaying
20
    them with ZopeTree.
21

22
    Extend this class with methods filtering the return list of
23
    getChildren() to your own needs.
24
    """
25

26
    __allow_access_to_unprotected_subobjects__ = 1
×
27

28
    def __init__(self, obj, path=""):
×
29
        self.path = path
×
30
        self.object = obj
×
31
        self.id = obj.getId()
×
32
        self.folderish = obj.isPrincipiaFolderish
×
33

34
    def getChildren(self):
×
35
        if not self.folderish:
×
36
            return []
×
37
        children = []
×
38
        objectIds = self.object.objectIds()
×
39
        objectIds.sort()
×
40
        for id in objectIds:
×
41
            path = posixpath.join(self.path, id)
×
42
            obj = getattr(self.object, id)
×
43
            children.append(TreeObjectWrapper(obj, path))
×
44
        return children
×
45

46
    def getFolderishChildren(self):
×
47
        return [child for child in self.getChildren() if child.folderish]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc