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

collective / collective.task / 16594832664

29 Jul 2025 11:30AM UTC coverage: 92.397%. First build
16594832664

Pull #8

github

chris-adam
Changed get current user from username to id
Pull Request #8: Plone61 compatibility

126 of 144 new or added lines in 13 files covered. (87.5%)

559 of 605 relevant lines covered (92.4%)

0.92 hits per line

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

76.67
/src/collective/task/browser/viewlets.py
1
# -*- coding: utf-8 -*-
2
"""Custom viewlets."""
1✔
3
from collective.task import _
1✔
4
from collective.task.behaviors import ITask
1✔
5
from collective.task.browser.table import TasksTable
1✔
6
from collective.task.interfaces import ITaskMethods
1✔
7
from plone import api
1✔
8
from plone.app.layout.viewlets import common as base
1✔
9

10

11
class TasksListViewlet(base.ViewletBase):
1✔
12

13
    """Tasks list for current task container object."""
14

15
    label = _(u"Tasks list")
1✔
16
    noresult_message = _(u"There is no task for this content.")
1✔
17
    __table__ = TasksTable
1✔
18

19
    def update(self):
1✔
20
        self.table = self.__table__(self.context, self.request)
×
21
        self.table.viewlet = self
×
NEW
22
        catalog = api.portal.get_tool("portal_catalog")
×
NEW
23
        container_path = "/".join(self.context.getPhysicalPath())
×
NEW
24
        brains = catalog.searchResults(object_provides=ITask.__identifier__, path={"query": container_path, "depth": 1})
×
25
        self.table.results = [b.getObject() for b in brains]
×
26
        self.table.update()
×
27

28

29
class TaskParentViewlet(base.ViewletBase):
1✔
30

31
    """Task parent for current task."""
32

33
    display_highest_task = True
1✔
34
    display_above_element = True
1✔
35

36
    def get_highest_parent(self):
1✔
37
        """Return highest task and above task chain"""
38
        ret = {"highest": None, "above": None}
1✔
39
        parent_task = ITaskMethods(self.context).get_highest_task_parent(task=True)
1✔
40
        if self.display_highest_task and parent_task != self.context:
1✔
41
            ret["highest"] = parent_task
1✔
42
        if self.display_above_element:
1✔
43
            ret["above"] = parent_task.aq_parent
1✔
44
        return ret
1✔
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