• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python resource.Resource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中superdesk.resource.Resource的典型用法代码示例。如果您正苦于以下问题:Python Resource类的具体用法?Python Resource怎么用?Python Resource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: __init__

    def __init__(self, endpoint_name, app, service, endpoint_schema=None):
        self.schema = {
            "name": {"type": "string", "required": True, "nullable": False, "empty": False, "iunique": True},
            "source": required_string,
            "feeding_service": {"type": "string", "required": True, "allowed": allowed_feeding_services},
            "feed_parser": {"type": "string", "nullable": True, "allowed": allowed_feed_parsers},
            "content_types": {"type": "list", "default": content_type, "allowed": content_type},
            "allow_remove_ingested": {"type": "boolean", "default": False},
            "content_expiry": {"type": "integer", "default": app.config["INGEST_EXPIRY_MINUTES"]},
            "config": {"type": "dict"},
            "ingested_count": {"type": "integer"},
            "accepted_count": {"type": "integer"},
            "tokens": {"type": "dict"},
            "is_closed": {"type": "boolean", "default": False},
            "update_schedule": {
                "type": "dict",
                "schema": {
                    "hours": {"type": "integer"},
                    "minutes": {"type": "integer", "default": 5},
                    "seconds": {"type": "integer"},
                },
            },
            "idle_time": {"type": "dict", "schema": {"hours": {"type": "integer"}, "minutes": {"type": "integer"}}},
            "last_updated": {"type": "datetime"},
            "last_item_update": {"type": "datetime"},
            "rule_set": Resource.rel("rule_sets", nullable=True),
            "notifications": {
                "type": "dict",
                "schema": {
                    "on_update": {"type": "boolean", "default": True},
                    "on_close": {"type": "boolean", "default": True},
                    "on_open": {"type": "boolean", "default": True},
                    "on_error": {"type": "boolean", "default": True},
                },
            },
            "routing_scheme": Resource.rel("routing_schemes", nullable=True),
            "last_closed": {
                "type": "dict",
                "schema": {
                    "closed_at": {"type": "datetime"},
                    "closed_by": Resource.rel("users", nullable=True),
                    "message": {"type": "string"},
                },
            },
            "last_opened": {
                "type": "dict",
                "schema": {"opened_at": {"type": "datetime"}, "opened_by": Resource.rel("users", nullable=True)},
            },
            "critical_errors": {"type": "dict", "valueschema": {"type": "boolean"}},
        }

        self.item_methods = ["GET", "PATCH", "DELETE"]
        self.privileges = {"POST": "ingest_providers", "PATCH": "ingest_providers", "DELETE": "ingest_providers"}
        self.etag_ignore_fields = ["last_updated", "last_item_update", "last_closed", "last_opened"]

        super().__init__(endpoint_name, app, service, endpoint_schema=endpoint_schema)
开发者ID:liveblog,项目名称:superdesk-core,代码行数:56,代码来源:ingest_provider_model.py


示例2: __init__

    def __init__(self, endpoint_name, app, service, endpoint_schema=None):
        self.readonly = True if app.config.get("LDAP_SERVER", None) else False

        self.additional_lookup = {"url": 'regex("[\w]+")', "field": "username"}

        self.schema = {
            "username": {"type": "string", "unique": True, "required": True, "minlength": 1},
            "password": {"type": "string", "minlength": 5, "readonly": self.readonly},
            "first_name": {"type": "string", "readonly": self.readonly},
            "last_name": {"type": "string", "readonly": self.readonly},
            "display_name": {"type": "string", "readonly": self.readonly},
            "email": {"unique": True, "type": "email", "required": True},
            "phone": {"type": "phone_number", "readonly": self.readonly, "nullable": True},
            "language": {"type": "string", "readonly": self.readonly, "nullable": True},
            "user_info": {"type": "dict"},
            "picture_url": {"type": "string", "nullable": True},
            "avatar": Resource.rel("upload", embeddable=True, nullable=True),
            "role": Resource.rel("roles", True),
            "privileges": {"type": "dict"},
            "workspace": {"type": "dict"},
            "user_type": {"type": "string", "allowed": ["user", "administrator"], "default": "user"},
            "is_active": {"type": "boolean", "default": True},
            "is_enabled": {"type": "boolean", "default": True},
            "needs_activation": {"type": "boolean", "default": True},
            "desk": Resource.rel("desks"),  # Default desk of the user, which would be selected when logged-in.
            SIGN_OFF: {  # Used for putting a sign-off on the content when it's created/updated except kill
                "type": "string",
                "required": True,
                "regex": "^[a-zA-Z0-9]+$",
            },
            BYLINE: {"type": "string", "required": False, "nullable": True},
        }

        self.extra_response_fields = [
            "display_name",
            "username",
            "email",
            "user_info",
            "picture_url",
            "avatar",
            "is_active",
            "is_enabled",
            "needs_activation",
            "desk",
        ]

        self.etag_ignore_fields = ["session_preferences", "_etag"]

        self.datasource = {"projection": {"password": 0}, "default_sort": [("username", 1)]}

        self.privileges = {"POST": "users", "DELETE": "users", "PATCH": "users"}
        super().__init__(endpoint_name, app=app, service=service, endpoint_schema=endpoint_schema)
开发者ID:copyfun,项目名称:superdesk-core,代码行数:52,代码来源:users.py


示例3: item_schema

def item_schema(extra=None):
    """Create schema for item.

    :param extra: extra fields to be added to schema
    """
    schema = {
        'old_version': {
            'type': 'number',
        },
        'last_version': {
            'type': 'number',
        },
        'task': {'type': 'dict'},
        'destination_groups': {
            'type': 'list',
            'schema': Resource.rel('destination_groups', True)
        },
        'publish_schedule': {
            'type': 'datetime',
            'nullable': True
        },
        'marked_for_not_publication': {
            'type': 'boolean',
            'default': False
        }
    }
    schema.update(metadata_schema)
    if extra:
        schema.update(extra)
    return schema
开发者ID:jey07ro,项目名称:superdesk,代码行数:30,代码来源:common.py


示例4:

import superdesk
from superdesk.users.services import is_admin
from superdesk.errors import SuperdeskApiError
import logging


logger = logging.getLogger('superdesk')

blogs_schema = {
    'title': metadata_schema['headline'],
    'description': metadata_schema['description'],
    'picture_url': {
        'type': 'string',
        'nullable': True
    },
    'picture': Resource.rel('archive', embeddable=True, nullable=True, type='string'),
    'original_creator': metadata_schema['original_creator'],
    'version_creator': metadata_schema['version_creator'],
    'versioncreated': metadata_schema['versioncreated'],
    'posts_order_sequence': {
        'type': 'number',
        'default': 0
    },
    'blog_status': {
        'type': 'string',
        'allowed': ['open', 'closed'],
        'default': 'open'
    },
    'members': {
        'type': 'list',
        'schema': {
开发者ID:4D4M-W34V3R,项目名称:liveblog,代码行数:31,代码来源:blogs.py


示例5: __init__

    def __init__(self, endpoint_name, app, service, endpoint_schema=None):
        self.schema = {
            'name': {
                'type': 'string',
                'required': True,
                'nullable': False,
                'empty': False,
                'iunique': True
            },
            'source': required_string,
            'feeding_service': {
                'type': 'string',
                'required': True,
                'allowed': allowed_feeding_services
            },
            'feed_parser': {
                'type': 'string',
                'nullable': True,
                'allowed': allowed_feed_parsers
            },
            'content_types': {
                'type': 'list',
                'default': content_type,
                'allowed': content_type
            },
            'allow_remove_ingested': {
                'type': 'boolean',
                'default': False
            },
            'content_expiry': {
                'type': 'integer',
                'default': app.config['INGEST_EXPIRY_MINUTES']
            },
            'config': {
                'type': 'dict'
            },
            'ingested_count': {
                'type': 'integer'
            },
            'accepted_count': {
                'type': 'integer'
            },
            'tokens': {
                'type': 'dict'
            },
            'is_closed': {
                'type': 'boolean',
                'default': False
            },
            'update_schedule': {
                'type': 'dict',
                'schema': {
                    'hours': {'type': 'integer'},
                    'minutes': {'type': 'integer', 'default': 5},
                    'seconds': {'type': 'integer'},
                }
            },
            'idle_time': {
                'type': 'dict',
                'schema': {
                    'hours': {'type': 'integer'},
                    'minutes': {'type': 'integer'},
                }
            },
            'last_updated': {'type': 'datetime'},
            'last_ingested_id': {'type': 'string'},  # this id is ingest provider internal value
            'last_item_update': {'type': 'datetime'},
            'rule_set': Resource.rel('rule_sets', nullable=True),
            'routing_scheme': Resource.rel('routing_schemes', nullable=True),
            'notifications': {
                'type': 'dict',
                'schema': {
                    'on_update': {'type': 'boolean', 'default': True},
                    'on_close': {'type': 'boolean', 'default': True},
                    'on_open': {'type': 'boolean', 'default': True},
                    'on_error': {'type': 'boolean', 'default': True}
                }
            },
            'last_closed': {
                'type': 'dict',
                'schema': {
                    'closed_at': {'type': 'datetime'},
                    'closed_by': Resource.rel('users', nullable=True),
                    'message': {'type': 'string'}
                }
            },
            'last_opened': {
                'type': 'dict',
                'schema': {
                    'opened_at': {'type': 'datetime'},
                    'opened_by': Resource.rel('users', nullable=True)
                }
            },
            'critical_errors': {
                'type': 'dict',
                'valueschema': {
                    'type': 'boolean'
                }
            },
        }
#.........这里部分代码省略.........
开发者ID:nistormihai,项目名称:superdesk-core,代码行数:101,代码来源:ingest_provider_model.py


示例6: __init__

    def __init__(self, endpoint_name, app, service, endpoint_schema=None):
        self.readonly = True if app.config.get('LDAP_SERVER', None) else False

        self.additional_lookup = {
            'url': r'regex("[\w]+")',
            'field': 'username'
        }

        self.schema = {
            'username': {
                'type': 'string',
                'unique': True,
                'required': True,
                'minlength': 1
            },
            'password': {
                'type': 'string',
                'minlength': 5
            },
            'password_changed_on': {
                'type': 'datetime',
                'nullable': True
            },
            'first_name': {
                'type': 'string',
                'readonly': self.readonly
            },
            'last_name': {
                'type': 'string',
                'readonly': self.readonly
            },
            'display_name': {
                'type': 'string'
            },
            'email': {
                'unique': True,
                'type': 'email',
                'required': True,
                'coerce': lambda s: s.lower()
            },
            'phone': {
                'type': 'string',
                'nullable': True
            },
            'job_title': {
                'type': 'string',
                'required': False,
            },
            'biography': {
                'type': 'string',
                'required': False,
                'nullable': True,
            },
            'facebook': {
                'type': 'string',
                'required': False,
                'nullable': True,
            },
            'instagram': {
                'type': 'string',
                'required': False,
                'nullable': True,
            },
            'twitter': {
                'type': 'string',
                'required': False,
                'nullable': True,
                'twitter': True,
            },
            'jid': {
                'unique': True,
                'type': 'string',
                'required': False,
            },
            'language': {
                'type': 'string',
                'nullable': True
            },
            'user_info': {
                'type': 'dict'
            },
            'picture_url': {
                'type': 'string',
                'nullable': True
            },
            'avatar': Resource.rel('upload', embeddable=True, nullable=True),
            'avatar_renditions': {'type': 'dict'},
            'role': Resource.rel('roles', True),
            'privileges': {'type': 'dict'},
            'workspace': {
                'type': 'dict'
            },
            'user_type': {
                'type': 'string',
                'allowed': ['user', 'administrator'],
                'default': 'user'
            },
            'is_support': {
                'type': 'boolean',
                'default': False
#.........这里部分代码省略.........
开发者ID:jerome-poisson,项目名称:superdesk-core,代码行数:101,代码来源:users.py


示例7: check_item_valid

import superdesk
from superdesk.resource import Resource
from superdesk.notification import push_notification
from apps.activity import add_activity
from superdesk.services import BaseService


comments_schema = {
    'text': {
        'type': 'string',
        'minlength': 1,
        'maxlength': 500,
        'required': True,
    },
    'item': Resource.rel('archive', True, True, type='string'),
    'user': Resource.rel('users', True),
    'mentioned_users': {
        'type': 'dict'
    }
}


def check_item_valid(item_id):
    item = app.data.find_one('archive', req=None, _id=item_id)
    if not item:
        msg = 'Invalid content item ID provided: %s' % item_id
        raise superdesk.SuperdeskError(payload=msg)


def get_users_mentions(text):
开发者ID:chupym,项目名称:superdesk-server,代码行数:30,代码来源:item_comments.py


示例8:

        'mapping': not_analyzed
    },
    'version': {
        'type': 'integer'
    },
    'ingest_id': {
        'type': 'string',
        'mapping': not_analyzed
    },
    'family_id': {
        'type': 'string',
        'mapping': not_analyzed
    },

    # Audit Information
    'original_creator': Resource.rel('users'),
    'version_creator': Resource.rel('users'),
    'firstcreated': {
        'type': 'datetime'
    },
    'versioncreated': {
        'type': 'datetime'
    },

    # Ingest Details
    'ingest_provider': Resource.rel('ingest_providers'),
    'source': {     # The value is copied from the ingest_providers vocabulary
        'type': 'string',
        'mapping': not_analyzed
    },
    'original_source': {    # This value is extracted from the ingest
开发者ID:marwoodandrew,项目名称:superdesk-server,代码行数:31,代码来源:content.py


示例9:

 'urgency': {
     'type': 'integer'
 },
 'groups': {
     'type': 'list'
 },
 'keywords': {
     'type': 'list'
 },
 'body_html': {
     'type': 'string'
 },
 'creator': {
     'type': 'dict',
     'schema': {
         'user': Resource.rel('users', True)
     }
 },
 'media_file': {
     'type': 'string'
 },
 'contents': {
     'type': 'list'
 },
 'media': {
     'type': 'media'
 },
 'task_id': {
     'type': 'string'
 },
 'lock_user': {
开发者ID:chupym,项目名称:superdesk-server,代码行数:31,代码来源:common.py


示例10:

    },
    'ingest_id': {
        'type': 'string',
        'mapping': not_analyzed
    },
    'family_id': {
        'type': 'string',
        'mapping': not_analyzed
    },
    'related_to': {  # this field keeps a reference to the related item from which metadata has been copied
        'type': 'string',
        'mapping': not_analyzed
    },

    # Audit Information
    'original_creator': Resource.rel('users'),
    'version_creator': Resource.rel('users'),
    'firstcreated': {
        'type': 'datetime'
    },
    'versioncreated': {
        'type': 'datetime'
    },
    'firstpublished': {
        'type': 'datetime',
        'required': False,
        'nullable': True,
    },

    # Ingest Details
    'ingest_provider': Resource.rel('ingest_providers'),
开发者ID:jerome-poisson,项目名称:superdesk-core,代码行数:31,代码来源:item.py


示例11: DeskTypes

from superdesk.services import BaseService
from superdesk.notification import push_notification
from superdesk.activity import add_activity, ACTIVITY_UPDATE
from superdesk.metadata.item import FAMILY_ID
from eve.utils import ParsedRequest


class DeskTypes(SuperdeskBaseEnum):
    authoring = "authoring"
    production = "production"


desks_schema = {
    "name": {"type": "string", "required": True, "nullable": False, "empty": False, "iunique": True},
    "description": {"type": "string"},
    "members": {"type": "list", "schema": {"type": "dict", "schema": {"user": Resource.rel("users", True)}}},
    "incoming_stage": Resource.rel("stages", True),
    "working_stage": Resource.rel("stages", True),
    "content_expiry": {"type": "integer"},
    "source": {"type": "string"},
    "monitoring_settings": {
        "type": "list",
        "schema": {
            "type": "dict",
            "schema": {
                "_id": {"type": "string", "required": True},
                "type": {
                    "type": "string",
                    "allowed": ["search", "stage", "scheduledDeskOutput", "deskOutput", "personal"],
                    "required": True,
                },
开发者ID:liveblog,项目名称:superdesk-core,代码行数:31,代码来源:desks.py


示例12:

import flask
import superdesk
import eve.io.base

blogs_schema = {
    'guid': metadata_schema['guid'],
    'title': metadata_schema['headline'],
    'description': metadata_schema['description'],
    'theme': {
        'type': 'dict'
    },
    'picture_url': {
        'type': 'string',
        'nullable': True
    },
    'picture': Resource.rel('upload', embeddable=True, nullable=True),
    'original_creator': metadata_schema['original_creator'],
    'version_creator': metadata_schema['version_creator'],
    'versioncreated': metadata_schema['versioncreated'],
    'blog_status': {
        'type': 'string',
        'allowed': ['open', 'closed'],
        'default': 'open'
    },
    'particular_type': {
        'type': 'string',
        'allowed': ['blog'],
        'default': 'blog'
    },
    'members': {
        'type': 'list',
开发者ID:hlmnrmr,项目名称:liveblog,代码行数:31,代码来源:blogs.py


示例13: __init__

    def __init__(self, endpoint_name, app, service, endpoint_schema=None):
        self.readonly = True if app.config.get('LDAP_SERVER', None) else False

        self.additional_lookup = {
            'url': 'regex("[\w]+")',
            'field': 'username'
        }

        self.schema = {
            'username': {
                'type': 'string',
                'unique': True,
                'required': True,
                'minlength': 1
            },
            'password': {
                'type': 'string',
                'minlength': 5
            },
            'first_name': {
                'type': 'string',
                'readonly': self.readonly
            },
            'last_name': {
                'type': 'string',
                'readonly': self.readonly
            },
            'display_name': {
                'type': 'string'
            },
            'email': {
                'unique': True,
                'type': 'email',
                'required': True
            },
            'phone': {
                'type': 'string',
                'nullable': True
            },
            'language': {
                'type': 'string',
                'nullable': True
            },
            'user_info': {
                'type': 'dict'
            },
            'picture_url': {
                'type': 'string',
                'nullable': True
            },
            'avatar': Resource.rel('upload', embeddable=True, nullable=True),
            'role': Resource.rel('roles', True),
            'privileges': {'type': 'dict'},
            'workspace': {
                'type': 'dict'
            },
            'user_type': {
                'type': 'string',
                'allowed': ['user', 'administrator'],
                'default': 'user'
            },
            'is_active': {
                'type': 'boolean',
                'default': True
            },
            'is_enabled': {
                'type': 'boolean',
                'default': True
            },
            'needs_activation': {
                'type': 'boolean',
                'default': True
            },
            'desk': Resource.rel('desks'),  # Default desk of the user, which would be selected when logged-in.
            SIGN_OFF: {  # Used for putting a sign-off on the content when it's created/updated except kill
                'type': 'string',
                'required': False,
                'regex': '^[a-zA-Z0-9]+$'
            },
            BYLINE: {
                'type': 'string',
                'required': False,
                'nullable': True
            }
        }

        self.extra_response_fields = [
            'display_name',
            'username',
            'email',
            'user_info',
            'picture_url',
            'avatar',
            'is_active',
            'is_enabled',
            'needs_activation',
            'desk'
        ]

        self.etag_ignore_fields = ['session_preferences', '_etag']
#.........这里部分代码省略.........
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:101,代码来源:users.py


示例14:

    },
    'ingest_id': {
        'type': 'string',
        'mapping': not_analyzed
    },
    'family_id': {
        'type': 'string',
        'mapping': not_analyzed
    },
    'related_to': {  # this field keeps a reference to the related item from which metadata has been copied
        'type': 'string',
        'mapping': not_analyzed
    },

    # Audit Information
    'original_creator': Resource.rel('users'),
    'version_creator': Resource.rel('users'),
    'firstcreated': {
        'type': 'datetime'
    },
    'versioncreated': {
        'type': 'datetime'
    },

    # Ingest Details
    'ingest_provider': Resource.rel('ingest_providers'),
    'source': {     # The value is copied from the ingest_providers vocabulary
        'type': 'string',
        'mapping': not_analyzed
    },
    'original_source': {    # This value is extracted from the ingest
开发者ID:verifiedpixel,项目名称:verifiedpixel,代码行数:31,代码来源:item.py


示例15: dict

#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license

import superdesk
from superdesk.resource import Resource
from superdesk.services import BaseService
from apps.comments import CommentsService, CommentsResource, comments_schema
from superdesk.errors import SuperdeskApiError


comments_schema = dict(comments_schema)
comments_schema.update({'item': Resource.rel('archive', True, True, type='string')})


class ItemCommentsResource(CommentsResource):
    schema = comments_schema
    resource_methods = ['GET', 'POST', 'DELETE']
    datasource = {'default_sort': [('_created', -1)]}
    privileges = {'POST': 'archive', 'DELETE': 'archive'}


class ItemCommentsService(CommentsService):
    notification_key = 'item:comment'


class ItemCommentsSubResource(Resource):
    url = 'archive/<path:item>/comments'
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:31,代码来源:item_comments.py


示例16:

 'name': {
     'type': 'string',
     'required': True,
     'nullable': False,
     'empty': False,
     'iunique': True
 },
 'description': {
     'type': 'string'
 },
 'members': {
     'type': 'list',
     'schema': {
         'type': 'dict',
         'schema': {
             'user': Resource.rel('users', True)
         }
     }
 },
 'incoming_stage': Resource.rel('stages', True),
 'working_stage': Resource.rel('stages', True),
 'content_expiry': {
     'type': 'integer'
 },
 'source': {
     'type': 'string'
 },
 'monitoring_settings': {
     'type': 'list',
     'schema': {
         'type': 'dict',
开发者ID:sjunaid,项目名称:superdesk-core,代码行数:31,代码来源:desks.py


示例17: BlogsResource

blogs_schema = {
    'title': {
        'type': 'string',
        'required': True,
    },
    'description': {
        'type': 'string'
    },
    'language': {
        'type': 'string'
    },
    'settings': {
        'type': 'dict'
    },
    'original_creator': Resource.rel('users', True),
    'version_creator': Resource.rel('users', True),
    'state': {
        'type': 'string',
        'allowed': ['open', 'closed'],
        'default': 'open'
    }
}


class BlogsResource(Resource):
    schema = blogs_schema
    datasource = {
        'default_sort': [('_updated', -1)]
    }
开发者ID:nistormihai,项目名称:liveblog-server,代码行数:29,代码来源:blogs.py


示例18:

EMBARGO = "embargo"

metadata_schema = {
    # Identifiers
    "guid": {"type": "string", "unique": True, "mapping": not_analyzed},
    "unique_id": {"type": "integer", "unique": True},
    "unique_name": {"type": "string", "unique": True, "mapping": not_analyzed},
    "version": {"type": "integer"},
    "ingest_id": {"type": "string", "mapping": not_analyzed},
    "family_id": {"type": "string", "mapping": not_analyzed},
    "related_to": {  # this field keeps a reference to the related item from which metadata has been copied
        "type": "string",
        "mapping": not_analyzed,
    },
    # Audit Information
    "original_creator": Resource.rel("users"),
    "version_creator": Resource.rel("users"),
    "firstcreated": {"type": "datetime"},
    "versioncreated": {"type": "datetime"},
    # Ingest Details
    "ingest_provider": Resource.rel("ingest_providers"),
    "source": {"type": "string", "mapping": not_analyzed},  # The value is copied from the ingest_providers vocabulary
    "original_source": {"type": "string", "mapping": not_analyzed},  # This value is extracted from the ingest
    "ingest_provider_sequence": {"type": "string", "mapping": not_analyzed},
    # Copyright Information
    "usageterms": {"type": "string", "mapping": not_analyzed, "nullable": True},
    # Category Details
    "anpa_category": {
        "type": "list",
        "nullable": True,
        "mapping": {"type": "object", "properties": {"qcode": not_analyzed, "name": not_analyzed}},
开发者ID:SourceDouglas,项目名称:verifiedpixel,代码行数:31,代码来源:item.py


示例19: render_template

        username = g.user.get('display_name') or g.user.get('username')
        url = '{}/#/liveblog/settings/{}'.format(origin, doc['_id'])
        title = blog['title']
        admins = app.config['ADMINS']
        app_name = app.config['APPLICATION_NAME']
        subject = render_template("owner_email_subject.txt", app_name=app_name)
        text_body = render_template("owner_request.txt", app_name=app_name, link=url,
                                    name_of_user=username, title=title)
        html_body = render_template("owner_request.html", app_name=app_name, link=url,
                                    name_of_user=username, title=title)
        send_email.delay(subject=subject, sender=admins[0], recipients=recipients,
                         text_body=text_body, html_body=html_body)


request_schema = {
    'blog': Resource.rel('blogs', True),
    'original_creator': Resource.rel('users', True),
    'message': {
        'type': 'string'
    }
}


class MembershipResource(Resource):
    schema = request_schema
    datasource = {
        'source': 'request_membership',
        'default_sort': [('_updated', -1)]
    }
    resource_methods = ['POST', 'GET']
    item_methods = ['GET', 'DELETE']
开发者ID:4D4M-W34V3R,项目名称:liveblog,代码行数:31,代码来源:request_membership.py


示例20:

 'renditions': {'type': 'dict'},
 'service': {'type': 'list', 'mapping': code_mapping},
 'slugline': {'type': 'string'},
 'source': metadata_schema['source'],
 'subject': {'type': 'list', 'mapping': code_mapping},
 'keywords': metadata_schema['keywords'],
 'type': metadata_schema['type'],
 'urgency': {'type': 'integer'},
 'priority': {'type': 'integer'},
 'uri': metadata_schema['guid'],  # we use guid value for uri, so index it in a same way
 'usageterms': {'type': 'string'},
 'version': {'type': 'string', 'required': True, 'empty': False, 'nullable': False},
 'versioncreated': {'type': 'datetime', 'required': True},
 'firstcreated': {'type': 'datetime'},
 'firstpublished': {'type': 'datetime', 'required': False},
 'evolvedfrom': Resource.not_analyzed_field(),
 'nextversion': Resource.not_analyzed_field(),
 'subscribers': Resource.not_analyzed_field('list'),
 'ednote': {'type': 'string'},
 'signal': {
     'type': 'list',
     'mapping': {
         'type': 'object',
         'properties': {
             'code': not_analyzed,
             'name': not_analyzed,
             'scheme': not_analyzed
         }
     }
 },
 'genre': {'type': 'list', 'mapping': code_mapping},
开发者ID:jerome-poisson,项目名称:superdesk-core,代码行数:31,代码来源:resource.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tests.get_prefixed_url函数代码示例发布时间:2022-05-27
下一篇:
Python resource.build_custom_hateoas函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap