本文整理汇总了Python中models.Status.get方法的典型用法代码示例。如果您正苦于以下问题:Python Status.get方法的具体用法?Python Status.get怎么用?Python Status.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Status
的用法示例。
在下文中一共展示了Status.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_update_image
# 需要导入模块: from models import Status [as 别名]
# 或者: from models.Status import get [as 别名]
def test_update_image(self):
response = self.post("/admin/api/v1/statuses/foo",
data={"image": "cross-circle"})
self.assertEquals(response.status_code, 200)
status = Status.get(self.status.key())
self.assertEquals(status.image, "fugue/cross-circle.png")
示例2: test_update_default
# 需要导入模块: from models import Status [as 别名]
# 或者: from models.Status import get [as 别名]
def test_update_default(self):
response = self.post("/admin/api/v1/statuses/foo",
data={"default": "true"})
self.assertEquals(response.status_code, 200)
status = Status.get(self.status.key())
self.assertTrue(status.default)
示例3: post
# 需要导入模块: from models import Status [as 别名]
# 或者: from models.Status import get [as 别名]
def post(self):
"""Notify subscribers that a service changed status."""
address = self.request.get('address')
service = Service.get(self.request.get('service'))
oldstatus = Status.get(self.request.get('oldstatus'))
number = self.request.get('number')
logging.info("Service: %s" % service)
logging.info("Service name: %s" % service.name)
msg = "%s changed state from %s to %s (%s)" % (
service.name, oldstatus.name,
service.current_event().status.name,
service.current_event().message)
user = Subscription.get_by_email(address)
if user.status == "available" or not number:
status_code = xmpp.send_message(address, msg)
chat_message_sent = (status_code == xmpp.NO_ERROR)
logging.info("Notified: %s\nmessage: %s code: %d" % (address, msg, status_code))
elif user.status == "unavailable" and number:
sms = smsgw(to = number, msg = msg)
sms.send()
logging.info("Offline SMS: %s\nmessage: %s" % (number, msg))
示例4: test_delete_success
# 需要导入模块: from models import Status [as 别名]
# 或者: from models.Status import get [as 别名]
def test_delete_success(self):
response = self.delete("/admin/api/v1/statuses/foo")
self.assertEquals(response.status_code, 200)
self.assertEquals(response.headers["Content-Type"], "application/json")
status = Status.get(self.status.key())
self.assertEquals(status, None)
示例5: test_update_name
# 需要导入模块: from models import Status [as 别名]
# 或者: from models.Status import get [as 别名]
def test_update_name(self):
response = self.post("/admin/api/v1/statuses/foo",
data={"name": "Foobar"})
self.assertEquals(response.status_code, 200)
self.assertEquals(response.headers["Content-Type"], "application/json")
status = Status.get(self.status.key())
self.assertEquals(status.name, "Foobar")
示例6: test_update_description
# 需要导入模块: from models import Status [as 别名]
# 或者: from models.Status import get [as 别名]
def test_update_description(self):
response = self.post("/admin/api/v1/statuses/foo",
data={"description": "blah"})
self.assertEquals(response.status_code, 200)
self.assertEquals(response.headers["Content-Type"], "application/json")
status = Status.get(self.status.key())
self.assertEquals(status.description, "blah")
示例7: get
# 需要导入模块: from models import Status [as 别名]
# 或者: from models.Status import get [as 别名]
def get(self, key):
try:
status = Status.get(key)
user = users.get_current_user()
if status.user == user:
delete_status(status)
except Exception:
raise
self.redirect('/')
示例8: get
# 需要导入模块: from models import Status [as 别名]
# 或者: from models.Status import get [as 别名]
def get(self, key):
try:
status = Status.get(key)
user = users.get_current_user()
if status.user == user:
self.render_response('status.html', { 'status': status })
else:
self.redirect('/')
except Exception:
raise
示例9: test_delete_success
# 需要导入模块: from models import Status [as 别名]
# 或者: from models.Status import get [as 别名]
def test_delete_success(self):
response = self.delete("/admin/api/v1/statuses/foo")
self.assertEquals(response.status_code, 200)
self.assertEquals(response.headers["Content-Type"], "application/json")
data = json.loads(response.content)
self.assertEquals(data['url'], 'http://localhost:80/admin/api/v1/statuses/foo')
status = Status.get(self.status.key())
self.assertEquals(status, None)