本文整理汇总了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")
示例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
示例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)