def __init__(self, context): self.context = context self.utility = get_utility(IWorkflowUtility) if not IResource.providedBy(context): self.states = IWorkflow(context.context).states else: self.states = IWorkflow(context).states
async def __call__(self): result = [] container = self.request.container async for content in container.async_values(): if IResource.providedBy(content): result.append({ 'title': content.title, '@id': IAbsoluteURL(content, self.request)() }) return {"@id": self.request.url.human_repr(), "items": result}
def __init__(self, context): self.context = context self.utility = get_utility(IWorkflowUtility) adapter = None if not IResource.providedBy(context): adapter = query_adapter(context.context, IWorkflow) else: adapter = query_adapter(context, IWorkflow) if adapter is not None: self.states = adapter.states else: self.states = {}