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


Python Event.type方法代码示例

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


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

示例1: post

# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import type [as 别名]
    def post(self, operation):

        if operation == "add":
            event = Event()
            event.type = self.request.get("type")
            event.source = re.sub("\n", " ", self.request.get("source"))
            event.message = self.request.get("message")
            event.owner = self.request.get("owner")
            db.put(event)
        self.response.set_status(200)
        self.response.out.write("OK")
开发者ID:lovett,项目名称:announcer,代码行数:13,代码来源:tasks.py

示例2: make_event

# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import type [as 别名]
 def make_event(self, entry):
     event = Event()
     event.type = self.type
     event.title = entry.title
     event.uid = entry.id
     event.url = entry.link
     event.created = time.mktime(entry.updated_parsed)
     event.author = entry.get("author", "unknown")
     if entry.has_key("content"):
         event.content = entry.content[0].value
     elif entry.has_key("summary"):
         event.content = entry.summary
     else:
         event.content = ""
     self.post_init(event, entry)
     return event
开发者ID:tsoulcie,项目名称:nuxeo.org,代码行数:18,代码来源:plugins.py

示例3: gatraPlayer_PostEvent

# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import type [as 别名]
def gatraPlayer_PostEvent(request, id):

    allowed_methods = ['POST', 'OPTIONS']

    if request.method == 'OPTIONS':
        response = HttpResponse('', status=http_REQUEST_OK)
        response['Allow'] = ', '.join(allowed_methods)
        return response

    if request.method != 'POST':
        return HttpResponse('', status=http_NOT_ALLOWED)

    if 'HTTP_GATRA_HASH' in request.META.keys():
        _hash = request.META['HTTP_GATRA_HASH']
        try:
            h = Hash.objects.get(valid_hash = _hash)
        except:
            return HttpResponse(_hash, status=http_UNAUTHORIZED)
    else:
        return HttpResponse('', status=http_UNAUTHORIZED)

    if id is None:
        return HttpResponse('', status=http_BAD_REQUEST)

    try:
        jsonData = json.loads(request.body)
    except:
        return HttpResponse('Could not load json', status=http_BAD_REQUEST)

    if ('type' in jsonData.keys() and
    'trigger' in jsonData.keys() and
    'width' in jsonData.keys() and
    'container_height' in jsonData.keys() and
    'container_width' in jsonData.keys() and
    'state' in jsonData.keys() and
    'position' in jsonData.keys() and
    'fullscreen' in jsonData.keys() and
    'volume' in jsonData.keys()):

        try:
            play_id = Play.objects.get(id = id)
        except:
            return HttpResponse('Play ID not found', status=http_BAD_REQUEST)

        event = Event()
        event.play		= play_id
        event.type              = jsonData['type']
        event.trigger           = jsonData['trigger']
        event.width             = jsonData['width']
        event.container_height  = jsonData['container_height']
        event.container_width	= jsonData['container_width']
        event.state             = jsonData['state']
        event.position          = jsonData['position']
        event.fullscreen        = jsonData['fullscreen']
        event.volume            = jsonData['volume']

        if 'bitrate' in jsonData.keys():
            event.bitrate = jsonData['bitrate']

        if 'bandwidth' in jsonData.keys():
            event.bandwidth = jsonData['bandwidth']

        if 'media_seq' in jsonData.keys():
            event.media_seq = jsonData['media_seq']

        if 'load_time' in jsonData.keys():
            event.load_time = jsonData['load_time']

        if 'quality_label' in jsonData.keys():
            event.quality_label = jsonData['quality_label']

        event.save()

        status = http_POST_OK
        return HttpResponse('', status=status, content_type='application/json')

    return HttpResponse('Mandatory json value not found', status=http_BAD_REQUEST)
开发者ID:npajoni,项目名称:gatra,代码行数:79,代码来源:views.py


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