当前位置: 首页>>代码示例>>Python>>正文


Python ITask.providedBy方法代码示例

本文整理汇总了Python中opengever.task.task.ITask.providedBy方法的典型用法代码示例。如果您正苦于以下问题:Python ITask.providedBy方法的具体用法?Python ITask.providedBy怎么用?Python ITask.providedBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在opengever.task.task.ITask的用法示例。


在下文中一共展示了ITask.providedBy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_subtask_response

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
def create_subtask_response(context, event):
    """When adding a new task object within a task(subtask),
    it adds a response to the maintask.
    """

    # the event is fired multiple times when the task was transported, so we
    # need to verify that the request was not called by another client.
    request = context.REQUEST
    if request.get_header('X-OGDS-AC', None) or \
            request.get_header('X-OGDS-AUID', None) or \
            request.get('X-CREATING-SUCCESSOR', None):
        return

    parent = aq_parent(aq_inner(context))
    if ITask.providedBy(parent):
        if ITask.providedBy(context):
            transition = 'transition-add-subtask'

            # If the the added object is a subtask we have to make sure
            # that the subtask is already synced to the globalindex
            if not context.get_sql_object():
                TaskSqlSyncer(context, event).sync()

        elif IBaseDocument.providedBy(context):
            transition = 'transition-add-document'

        # add a response with a link to the object
        add_simple_response(parent, added_object=context,
                            transition=transition)
开发者ID:lukasgraf,项目名称:opengever.core,代码行数:31,代码来源:handlers.py

示例2: get_containing_task

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
 def get_containing_task(self):
     """ Get the parent-tasks if we have one
     """
     parent = aq_parent(aq_inner(self.context))
     if ITask.providedBy(parent):
         return [parent]
     return []
开发者ID:pemzurigo,项目名称:opengever.core,代码行数:9,代码来源:overview.py

示例3: get_added_objects

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
    def get_added_objects(self):
        """ Returns two lists of docs, subtasks
        """
        try:
            self.added_object
        except AttributeError:
            return [], []

        # .. and sometimes it may be empty.
        if not self.added_object:
            return [], []

        # Support for multiple added objects
        if hasattr(self.added_object, '__iter__'):
            relations = self.added_object
        else:
            relations = [self.added_object]

        docs = []
        subtasks = []
        for rel in relations:
            obj = rel.to_object
            if ITask.providedBy(obj):
                subtasks.append(obj)
            else:
                docs.append(obj)

        return docs, subtasks
开发者ID:4teamwork,项目名称:opengever.core,代码行数:30,代码来源:adapters.py

示例4: reindex_dossier_and_children

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
    def reindex_dossier_and_children(self, dossier):
        children = self.catalog(path='/'.join(dossier.getPhysicalPath()))
        for child in children:
            obj = child.getObject()
            obj.reindexObject(idxs=['reference'])

            if ITask.providedBy(obj):
                obj.get_sql_object().sync_with(obj)
开发者ID:4teamwork,项目名称:opengever.maintenance,代码行数:10,代码来源:02_fix_reference_number_after_rename.py

示例5: render

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
    def render(self):
        parent = aq_inner(aq_parent(self.context))
        if ITask.providedBy(parent):
            redirect_to = '%s#overview' % parent.absolute_url()
        else:
            redirect_to = '%s#tasks' % parent.absolute_url()

        return self.request.RESPONSE.redirect(redirect_to)
开发者ID:pemzurigo,项目名称:opengever.core,代码行数:10,代码来源:redirector.py

示例6: reindex_containing_dossier_for_contained_objects

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
def reindex_containing_dossier_for_contained_objects(dossier, event):
    """Reindex the containging_dossier index for all the contained obects.
    """
    for brain in dossier.portal_catalog(path='/'.join(dossier.getPhysicalPath())):
        obj = brain.getObject()
        obj.reindexObject(idxs=['containing_dossier'])

        if ITask.providedBy(obj):
            sync_task(brain.getObject(), event)
开发者ID:4teamwork,项目名称:opengever.core,代码行数:11,代码来源:handlers.py

示例7: get_type

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
 def get_type(self, item):
     """differ the object typ and return the type as string
     """
     if not item:
         return None
     elif isinstance(item, dict):
         return "dict"
     elif isinstance(item, Task) or ITask.providedBy(item):
         return "task"
     else:
         return "obj"
开发者ID:pemzurigo,项目名称:opengever.core,代码行数:13,代码来源:overview.py

示例8: update_deadline

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
def update_deadline(task, event):
    """Update the parents deadline, when a subtask deadline has changed."""
    for descr in event.descriptions:
        for attr in descr.attributes:
            if attr == 'deadline':
                parent = aq_parent(aq_inner(task))
                if ITask.providedBy(parent):
                    temp = task.deadline + timedelta(MAIN_TASK_DEADLINE_DELTA)
                    if parent.deadline < temp:
                        parent.deadline = temp
                        parent.reindexObject()
开发者ID:pemzurigo,项目名称:opengever.core,代码行数:13,代码来源:handlers.py

示例9: _get_task_css_class

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
def _get_task_css_class(task):
    """A task helper function for `get_css_class`, providing some metadata
    of a task. The task may be a brain, a dexterity object or a sql alchemy
    globalindex object.
    """
    if ICatalogBrain.providedBy(task) or ISolrDocument.providedBy(task):
        task = Task.query.by_brain(task)

    if ITask.providedBy(task):
        task = task.get_sql_object()

    return task.get_css_class()
开发者ID:lukasgraf,项目名称:opengever.core,代码行数:14,代码来源:helper.py

示例10: set_initial_state

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
def set_initial_state(task, event):
    """When adding a subtask to a sequential task process, the new task should
    be in the planned state.
    """
    if IDuringTaskTemplateFolderTriggering.providedBy(getRequest()):
        return

    parent = aq_parent(aq_inner(task))
    if ITask.providedBy(parent) \
       and IFromSequentialTasktemplate.providedBy(parent):

        task.set_to_planned_state()
开发者ID:4teamwork,项目名称:opengever.core,代码行数:14,代码来源:handlers.py

示例11: _task_state_wrapper

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
 def _task_state_wrapper(self, item, text):
     """ Wrap a span-tag around the text with the status-css class
     """
     if isinstance(item, Task):
         # Its a sql-task-object
         state = item.review_state
     elif ITask.providedBy(item):
         # Its a task-object
         state = getToolByName(self.context, "portal_workflow").getInfoFor(item, "review_state")
     else:
         return ""
     return '<span class="wf-%s">%s</span>' % (state, text)
开发者ID:pemzurigo,项目名称:opengever.core,代码行数:14,代码来源:overview.py

示例12: update_deadline

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
def update_deadline(task, event):
    """Update the parents deadline, when a subtask deadline has changed."""
    for descr in event.descriptions:
        for attr in descr.attributes:
            if attr == 'deadline':
                parent = aq_parent(aq_inner(task))
                if ITask.providedBy(parent):
                    offset = api.portal.get_registry_record(
                        'deadline_timedelta', interface=ITaskSettings)
                    temp = task.deadline + timedelta(offset)
                    if parent.deadline < temp:
                        parent.deadline = temp
                        parent.reindexObject()
开发者ID:4teamwork,项目名称:opengever.core,代码行数:15,代码来源:handlers.py

示例13: render_task

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
    def render_task(self, item):
        """ Render the taskobject
        """
        if isinstance(item, Task):
            # Its a task stored in sql
            return self._sqlalchemy_task_link(item)

        elif ITask.providedBy(item):
            # Its a normal task object
            return self._object_task_link(item)

        else:
            return None
开发者ID:pemzurigo,项目名称:opengever.core,代码行数:15,代码来源:overview.py

示例14: is_available

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
 def is_available(self):
     """The action should only be available on closed tasks for
     administrators and task issuer and only if the feature is enabled.
     """
     if not is_optional_task_permissions_revoking_enabled():
         return False
     if not ITask.providedBy(self.context):
         return False
     if not self.context.get_review_state() in FINAL_TASK_STATES:
         return False
     if api.user.has_permission('cmf.ManagePortal'):
         return True
     issuer = self.context.get_issuer_actor()
     return issuer.identifier == api.user.get_current().id
开发者ID:4teamwork,项目名称:opengever.core,代码行数:16,代码来源:revoke_permissions.py

示例15: object_moved_or_added

# 需要导入模块: from opengever.task.task import ITask [as 别名]
# 或者: from opengever.task.task.ITask import providedBy [as 别名]
def object_moved_or_added(context, event):
    if isinstance(event, ObjectAddedEvent):
        # Don't consider moving or removing an object a "touch". Mass-moves
        # would immediately fill up the touched log, and removals should not
        # be tracked anyway.
        if should_track_touches(context):
            notify(ObjectTouchedEvent(context))

    if IObjectRemovedEvent.providedBy(event):
        return

    # Update object security after moving or copying.
    # Specifically, this is needed for the case where an object is moved out
    # of a location where a Placeful Workflow Policy applies to a location
    # where it doesn't.
    #
    #  Plone then no longer provides the placeful workflow for that object,
    # but doesn't automatically update the object's security.
    #
    # We use ftw.upgrade's update_security_for() here to correctly
    # recalculate security, but do the reindexing ourselves because otherwise
    # Plone will do it recursively (unnecessarily so).
    changed = update_security_for(context, reindex_security=False)
    if changed:
        reindex_object_security_without_children(context)

    # There are several indices that need updating when a dossier is moved.
    # first make sure obj was actually moved and not created
    if not event.oldParent or not event.newParent:
        return

    # When an object is moved, its containing_dossier needs reindexing.
    to_reindex = ['containing_dossier']
    # containing_subdossier is really only used for documents,
    # while is_subdossier is only meaningful for dossiers.
    if IDossierMarker.providedBy(context):
        was_subdossier = IDossierMarker.providedBy(event.oldParent)
        is_subdossier = IDossierMarker.providedBy(event.newParent)
        if was_subdossier != is_subdossier:
            to_reindex.append('is_subdossier')

    if context.portal_type in TYPES_WITH_CONTAINING_SUBDOSSIER_INDEX:
        to_reindex.append('containing_subdossier')

    context.reindexObject(idxs=to_reindex)

    # synchronize with model if necessary
    if ITask.providedBy(context):
        sync_task(context, event)
开发者ID:4teamwork,项目名称:opengever.core,代码行数:51,代码来源:handlers.py


注:本文中的opengever.task.task.ITask.providedBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。