Exemplo n.º 1
0
        def _create(self, parent, action):
            # get assignee type
            current_user = get_current_user()
            assignee_types = parent.assignees.get(current_user, [])
            assignee_type = ",".join(assignee_types) or None
            # create object
            cad_id = action.custom_attribute_definition_id
            if not cad_id:
                obj = Comment(description=action.description,
                              assignee_type=assignee_type,
                              context=parent.context)
            else:
                obj = Comment(description=action.description,
                              custom_attribute_definition_id=cad_id,
                              assignee_type=assignee_type,
                              context=parent.context)

            return obj
Exemplo n.º 2
0
        def _create(self, parent, action):
            # get assignee type
            current_user = get_current_user()
            # pylint: disable=protected-access
            rel = parent._relationships_map.get(
                (current_user.type, current_user.id))
            if rel:
                assignee_type = rel.attrs["AssigneeType"]
            else:
                assignee_type = None
            # create object
            cad_id = action.custom_attribute_definition_id
            if not cad_id:
                obj = Comment(description=action.description,
                              assignee_type=assignee_type,
                              context=parent.context)
            else:
                obj = Comment(description=action.description,
                              custom_attribute_definition_id=cad_id,
                              assignee_type=assignee_type,
                              context=parent.context)

            return obj