Exemple #1
0
from superdesk.utc import utcnow
from superdesk.metadata.utils import item_url
from apps.archive.common import on_create_item
from superdesk.services import BaseService
from superdesk.metadata.item import metadata_schema, ITEM_STATE, CONTENT_STATE, ITEM_TYPE
import superdesk
from superdesk.activity import add_activity, ACTIVITY_CREATE, ACTIVITY_UPDATE
from apps.archive.archive import get_subject
from superdesk.workflow import is_workflow_state_transition_valid
from apps.archive.archive import SOURCE as ARCHIVE
from superdesk import get_resource_service

task_statuses = ['todo', 'in_progress', 'done']
default_status = 'todo'
ITEM_SEND = 'send'
item_operations.append(ITEM_SEND)


def init_app(app):
    endpoint_name = 'tasks'
    service = TasksService(TaskResource.datasource['source'], backend=superdesk.get_backend())
    TaskResource(endpoint_name, app=app, service=service)


def compare_dictionaries(original, updates):
    original_keys = set(original.keys())
    updates_keys = set(updates.keys())
    intersect_keys = original_keys.intersection(updates_keys)
    added = list(updates_keys - original_keys)
    modified = [o for o in intersect_keys if original[o] != updates[o]]
    modified.extend(added)
Exemple #2
0
from apps.desks import DeskTypes
from superdesk import get_resource_service
from superdesk.errors import SuperdeskApiError, InvalidStateTransitionError
from superdesk.metadata.item import ITEM_STATE, CONTENT_STATE
from superdesk.resource import Resource
from superdesk.services import BaseService
from superdesk.metadata.utils import item_url
from apps.archive.common import insert_into_versions, item_operations,\
    ITEM_OPERATION, set_sign_off, get_user, LAST_AUTHORING_DESK, LAST_PRODUCTION_DESK,\
    convert_task_attributes_to_objectId
from apps.archive.archive import SOURCE as ARCHIVE
from superdesk.workflow import is_workflow_state_transition_valid
from apps.content import push_content_notification

ITEM_MOVE = 'move'
item_operations.append(ITEM_MOVE)


class MoveResource(Resource):
    endpoint_name = 'move'
    resource_title = endpoint_name

    schema = {
        'task': {
            'type': 'dict',
            'required': True,
            'schema': {
                'desk': Resource.rel('desks', False, required=True),
                'stage': Resource.rel('stages', False, required=True)
            }
        }
Exemple #3
0
from apps.desks import DeskTypes
from superdesk import get_resource_service
from superdesk.errors import SuperdeskApiError, InvalidStateTransitionError
from superdesk.metadata.item import ITEM_STATE, CONTENT_STATE
from superdesk.resource import Resource
from superdesk.services import BaseService
from superdesk.metadata.utils import item_url
from apps.archive.common import insert_into_versions, item_operations,\
    ITEM_OPERATION, set_sign_off, get_user, LAST_AUTHORING_DESK, LAST_PRODUCTION_DESK,\
    convert_task_attributes_to_objectId
from apps.archive.archive import SOURCE as ARCHIVE
from superdesk.workflow import is_workflow_state_transition_valid
from apps.content import push_content_notification

ITEM_MOVE = 'move'
item_operations.append(ITEM_MOVE)


class MoveResource(Resource):
    endpoint_name = 'move'
    resource_title = endpoint_name

    schema = {
        'task': {
            'type': 'dict',
            'required': True,
            'schema': {
                'desk': Resource.rel('desks', False, required=True),
                'stage': Resource.rel('stages', False, required=True)
            }
        }
Exemple #4
0
from superdesk.utc import utcnow
from superdesk.metadata.utils import item_url
from apps.archive.common import on_create_item
from superdesk.services import BaseService
from superdesk.metadata.item import metadata_schema, ITEM_STATE, CONTENT_STATE, ITEM_TYPE
import superdesk
from superdesk.activity import add_activity, ACTIVITY_CREATE, ACTIVITY_UPDATE
from apps.archive.archive import get_subject
from superdesk.workflow import is_workflow_state_transition_valid
from apps.archive.archive import SOURCE as ARCHIVE
from superdesk import get_resource_service, config

task_statuses = ['todo', 'in_progress', 'done']
default_status = 'todo'
ITEM_SEND = 'send'
item_operations.append(ITEM_SEND)
MACRO_INCOMING = 'incoming'
MACRO_OUTGOING = 'outgoing'
MACRO_ONSTAGE = 'onstage'


def init_app(app):
    endpoint_name = 'tasks'
    service = TasksService(TaskResource.datasource['source'], backend=superdesk.get_backend())
    TaskResource(endpoint_name, app=app, service=service)


def compare_dictionaries(original, updates):
    original_keys = set(original.keys())
    updates_keys = set(updates.keys())
    intersect_keys = original_keys.intersection(updates_keys)