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


Python Namespace.clone方法代码示例

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


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

示例1: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
from open_event.models.event import Event as EventModel
from .helpers import get_object_list, get_object_or_404, get_object_in_event,\
    get_paginated_list
from utils import PAGINATED_MODEL, PaginatedResourceBase

api = Namespace('sponsors', description='sponsors', path='/')

SPONSOR = api.model('Sponsor', {
    'id': fields.Integer(required=True),
    'name': fields.String,
    'url': fields.String,
    'logo': fields.String,
})

SPONSOR_PAGINATED = api.clone('SponsorPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(SPONSOR))
})


@api.route('/events/<int:event_id>/sponsors/<int:sponsor_id>')
@api.response(404, 'Sponsor not found')
@api.response(400, 'Object does not belong to event')
class Sponsor(Resource):
    @api.doc('get_sponsor')
    @api.marshal_with(SPONSOR)
    def get(self, event_id, sponsor_id):
        """Fetch a sponsor given its id"""
        return get_object_in_event(SponsorModel, sponsor_id, event_id)


@api.route('/events/<int:event_id>/sponsors')
开发者ID:shivamMg,项目名称:open-event-orga-server,代码行数:33,代码来源:sponsors.py

示例2: SessionLanguageField

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
    'name': fields.String(),
    'organisation': fields.String()
})

SESSION_MICROLOCATION = api.model('SessionMicrolocation', {
    'id': fields.Integer(required=True),
    'name': fields.String(),
})

SESSION_TYPE_FULL = api.model('SessionTypeFull', {
    'id': fields.Integer(required=True),
    'name': fields.String(required=True),
    'length': fields.Float(required=True)
})

SESSION_TYPE = api.clone('SessionType', SESSION_TYPE_FULL)
del SESSION_TYPE['length']

SESSION = api.model('Session', {
    'id': fields.Integer(required=True),
    'title': fields.String(required=True),
    'subtitle': fields.String(),
    'short_abstract': fields.String(),
    'long_abstract': fields.String(),
    'comments': fields.String(),
    'start_time': fields.DateTime(),
    'end_time': fields.DateTime(),
    'track': fields.Nested(SESSION_TRACK, allow_null=True),
    'speakers': fields.List(fields.Nested(SESSION_SPEAKER)),
    'language': SessionLanguageField(),
    'microlocation': fields.Nested(SESSION_MICROLOCATION, allow_null=True),
开发者ID:deepakpathania,项目名称:open-event-orga-server,代码行数:33,代码来源:sessions.py

示例3: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES, SERVICE_RESPONSES
from .helpers.utils import Resource, ETAG_HEADER_DEFN

api = Namespace('microlocations', description='Microlocations', path='/')

MICROLOCATION = api.model('Microlocation', {
    'id': fields.Integer(required=True),
    'name': fields.String(required=True),
    'latitude': fields.Float(),
    'longitude': fields.Float(),
    'floor': fields.Integer(),
    'room': fields.String(),
})

MICROLOCATION_PAGINATED = api.clone('MicrolocationPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(MICROLOCATION))
})

MICROLOCATION_POST = api.clone('MicrolocationPost', MICROLOCATION)
del MICROLOCATION_POST['id']


# Create DAO
class MicrolocationDAO(ServiceDAO):
    version_key = 'microlocations_ver'


DAO = MicrolocationDAO(MicrolocationModel, MICROLOCATION_POST)


@api.route('/events/<int:event_id>/microlocations/<int:microlocation_id>')
开发者ID:aviaryan,项目名称:open-event-orga-server,代码行数:33,代码来源:microlocations.py

示例4:

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
    'avatar': fields.Upload(),
    'contact': fields.String(),
    'facebook': fields.String(),
    'twitter': fields.String()
})

USER = api.model('User', {
    'id': fields.Integer(),
    'email': fields.Email(required=True),
    'signup_time': fields.DateTime(),
    'last_access_time': fields.DateTime(),
    'user_detail': fields.Nested(USER_DETAIL)
})

USER_PAGINATED = api.clone('UserPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(USER))
})

USER_PUT = api.clone('UserPut', USER)
del USER_PUT['id']
del USER_PUT['signup_time']
del USER_PUT['last_access_time']

USER_POST = api.model('UserPost', {
    'email': fields.Email(required=True),
    'password': fields.String(required=True)
})

# Responses

USER_POST_RESPONSES = POST_RESPONSES.copy()
开发者ID:ashishpahwa7,项目名称:open-event-orga-server,代码行数:33,代码来源:users.py

示例5: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
    POST_RESPONSES
from app.api.helpers.utils import Resource

api = Namespace('notifications', description='Notifications', path='/')

NOTIFICATION = api.model('Notification', {
    'id': fields.Integer(required=True),
    'email': fields.String(required=True),
    'title': fields.String(),
    'message': fields.String(),
    'action': fields.String(),
    'received_at': fields.DateTime(),
})

NOTIFICATION_PAGINATED = api.clone('NotificationPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(NOTIFICATION))
})

NOTIFICATION_POST = api.clone('NotificationPost', NOTIFICATION)
del NOTIFICATION_POST['id']


# Create DAO
class NotificationDAO(ServiceDAO):
    version_key = 'notifications_ver'

    def create_user_notify(self, payload):
        user = DataGetter.get_user_by_email(payload['email'])
        DataManager().create_user_notification(user, payload['action'], payload['title'], payload['message'])
        return user
开发者ID:SaptakS,项目名称:open-event-orga-server,代码行数:32,代码来源:notifications.py

示例6: EventTypeField

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
    'description': fields.String(),
    'location_name': fields.String(),
    'organizer_name': fields.String(),
    'organizer_description': fields.String(),
    'state': fields.String(),
    'closing_datetime': fields.DateTime(),
    'type': EventTypeField(),
    'topic': EventTopicField(),
    'privacy': fields.String(),
    'ticket_url': fields.Uri(),
    'creator': fields.Nested(EVENT_CREATOR, allow_null=True),
    'schedule_published_on': fields.DateTime()
})

EVENT_PAGINATED = api.clone('EventPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(EVENT))
})

EVENT_POST = api.clone('EventPost', EVENT)
del EVENT_POST['id']
del EVENT_POST['creator']


class EventDAO(BaseDAO):
    """
    Event DAO
    """
    def fix_payload(self, data):
        """
        Fixes the payload data.
        Here converts string time from datetime obj
开发者ID:faheemzunjani,项目名称:open-event-orga-server,代码行数:33,代码来源:events.py

示例7: SpeakerDAO

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
    'long_biography': fields.String(),
    'email': fields.Email(),
    'mobile': fields.String(),
    'website': fields.Uri(),
    'twitter': fields.String(),  # not sure for now whether uri or string field
    'facebook': fields.String(),
    'github': fields.String(),
    'linkedin': fields.String(),
    'organisation': fields.String(),
    'position': fields.String(),
    'country': fields.String(),
    'sessions': fields.List(fields.Nested(SPEAKER_SESSION)),
})

SPEAKER_PAGINATED = api.clone('SpeakerPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(SPEAKER))
})

SPEAKER_POST = api.clone('SpeakerPost', SPEAKER)
del SPEAKER_POST['id']
del SPEAKER_POST['sessions']  # don't allow adding sessions


# Create DAO
class SpeakerDAO(ServiceDAO):
    def create(self, event_id, data, url):
        data = self.validate(data, event_id)
        return ServiceDAO.create(self, event_id, data, url, validate=False)

    def update(self, event_id, service_id, data):
        data = self.validate(data, event_id)
开发者ID:deepakpathania,项目名称:open-event-orga-server,代码行数:33,代码来源:speakers.py

示例8: TrackDAO

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
    'id': fields.Integer(required=True),
    'title': fields.String(),
})

TRACK = api.model('Track', {
    'id': fields.Integer(required=True),
    'name': fields.String(required=True),
    'description': fields.String(),
    'color': fields.Color(required=True),
    'track_image_url': fields.Upload(),
    'location': fields.String(),
    'sessions': fields.List(fields.Nested(TRACK_SESSION)),
})

TRACK_PAGINATED = api.clone('TrackPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(TRACK))
})

TRACK_POST = api.clone('TrackPost', TRACK)
del TRACK_POST['id']
del TRACK_POST['sessions']


# Create DAO
class TrackDAO(ServiceDAO):
    version_key = 'tracks_ver'

DAO = TrackDAO(TrackModel, TRACK_POST)


@api.route('/events/<int:event_id>/tracks/<int:track_id>')
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:33,代码来源:tracks.py

示例9: Session

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
    'id': fields.Integer(required=True),
    'title': fields.String,
    'subtitle': fields.String,
    'abstract': fields.String,
    'description': fields.String,
    'start_time': fields.DateTime,
    'end_time': fields.DateTime,
    'track': fields.Nested(SESSION_TRACK),
    'speakers': fields.List(fields.Nested(SESSION_SPEAKER)),
    'level': fields.Nested(SESSION_LEVEL),
    'language': fields.Nested(SESSION_LANGUAGE),
    'microlocation': fields.Nested(SESSION_MICROLOCATION),
})

SESSION_PAGINATED = api.clone('SessionPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(SESSION))
})


@api.route('/events/<int:event_id>/sessions/<int:session_id>')
@api.response(404, 'Session not found')
@api.response(400, 'Object does not belong to event')
class Session(Resource):
    @api.doc('get_session')
    @api.marshal_with(SESSION)
    def get(self, event_id, session_id):
        """Fetch a session given its id"""
        return get_object_in_event(SessionModel, session_id, event_id)


@api.route('/events/<int:event_id>/sessions')
开发者ID:shivamMg,项目名称:open-event-orga-server,代码行数:33,代码来源:sessions.py

示例10: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
from open_event.models.session import Level as LevelModel
from open_event.models.event import Event as EventModel
from .helpers import get_object_list, get_object_or_404, get_object_in_event,\
    get_paginated_list
from utils import PAGINATED_MODEL, PaginatedResourceBase

api = Namespace('levels', description='levels', path='/')

LEVEL = api.model('Level', {
    'id': fields.Integer(required=True),
    'name': fields.String,
    'label_en': fields.String,
})

LEVEL_PAGINATED = api.clone('LevelPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(LEVEL))
})


@api.route('/events/<int:event_id>/levels/<int:level_id>')
@api.response(404, 'Level not found')
@api.response(400, 'Object does not belong to event')
class Level(Resource):
    @api.doc('get_level')
    @api.marshal_with(LEVEL)
    def get(self, event_id, level_id):
        """Fetch a level given its id"""
        return get_object_in_event(LevelModel, level_id, event_id)


@api.route('/events/<int:event_id>/levels')
开发者ID:shivamMg,项目名称:open-event-orga-server,代码行数:33,代码来源:levels.py

示例11:

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
        "twitter": fields.String(),
    },
)

USER = api.model(
    "User",
    {
        "id": fields.Integer(),
        "email": fields.Email(required=True),
        "signup_time": fields.DateTime(),
        "last_access_time": fields.DateTime(),
        "user_detail": fields.Nested(USER_DETAIL),
    },
)

USER_PAGINATED = api.clone("UserPaginated", PAGINATED_MODEL, {"results": fields.List(fields.Nested(USER))})

USER_PUT = api.clone("UserPut", USER)
del USER_PUT["id"]
del USER_PUT["signup_time"]
del USER_PUT["last_access_time"]

USER_POST = api.model("UserPost", {"email": fields.Email(required=True), "password": fields.String(required=True)})

# Responses

USER_POST_RESPONSES = POST_RESPONSES.copy()
del USER_POST_RESPONSES[404]
del USER_POST_RESPONSES[401]

开发者ID:yasharmaster,项目名称:open-event-orga-server,代码行数:31,代码来源:users.py

示例12:

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
EVENT_VERSION = api.model('EventVersion', {
    'event_ver': fields.Integer(),
    'sessions_ver': fields.Integer(),
    'speakers_ver': fields.Integer(),
    'tracks_ver': fields.Integer(),
    'sponsors_ver': fields.Integer(),
    'microlocations_ver': fields.Integer()
})

SOCIAL_LINK = api.model('SocialLink', {
    'id': fields.Integer(),
    'name': fields.String(required=True),
    'link': fields.String(required=True)
})

SOCIAL_LINK_POST = api.clone('SocialLinkPost', SOCIAL_LINK)
del SOCIAL_LINK_POST['id']

EVENT = api.model('Event', {
    'id': fields.Integer(required=True),
    'name': fields.String(required=True),
    'email': fields.Email(),
    'logo': fields.Upload(),
    'start_time': fields.DateTime(required=True),
    'end_time': fields.DateTime(required=True),
    'timezone': fields.String(),
    'latitude': fields.Float(),
    'longitude': fields.Float(),
    'event_url': fields.Uri(),
    'background_url': fields.Upload(),
    'description': fields.String(),
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:33,代码来源:events.py

示例13: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
from open_event.models.event import Event as EventModel
from .helpers import get_object_list, get_object_or_404, get_object_in_event,\
    get_paginated_list
from utils import PAGINATED_MODEL, PaginatedResourceBase

api = Namespace('languages', description='languages', path='/')

LANGUAGE = api.model('Language', {
    'id': fields.Integer(required=True),
    'name': fields.String,
    'label_en': fields.String,
    'label_de': fields.String,
})

LANGUAGE_PAGINATED = api.clone('LanguagePaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(LANGUAGE))
})


@api.route('/events/<int:event_id>/languages/<int:language_id>')
@api.response(404, 'Language not found')
@api.response(400, 'Object does not belong to event')
class Language(Resource):
    @api.doc('get_language')
    @api.marshal_with(LANGUAGE)
    def get(self, event_id, language_id):
        """Fetch a language given its id"""
        return get_object_in_event(LanguageModel, language_id, event_id)


@api.route('/events/<int:event_id>/languages')
开发者ID:shivamMg,项目名称:open-event-orga-server,代码行数:33,代码来源:languages.py

示例14: EventTypeField

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import clone [as 别名]
    'organizer_name': fields.String(),
    'organizer_description': fields.String(),
    'state': fields.String(),
    'closing_datetime': fields.DateTime(),
    'type': EventTypeField(),
    'topic': EventTopicField(),
    'privacy': EventPrivacyField(),
    'ticket_url': fields.Uri(),
    'creator': fields.Nested(EVENT_CREATOR, allow_null=True),
    'schedule_published_on': fields.DateTime(),
    'code_of_conduct': fields.String(),
    'social_links': fields.List(fields.Nested(EVENT_SOCIAL), attribute='social_link')
})

EVENT_PAGINATED = api.clone('EventPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(EVENT))
})

EVENT_POST = api.clone('EventPost', EVENT)
SOCIAL_LINK_POST = api.clone('SocialLinkPost', EVENT_SOCIAL)

del EVENT_POST['id']
del EVENT_POST['creator']
del EVENT_POST['social_links']

del SOCIAL_LINK_POST['id']

# ###################
# Data Access Objects
# ###################
开发者ID:deepakpathania,项目名称:open-event-orga-server,代码行数:32,代码来源:events.py


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