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


Python Status.get方法代码示例

本文整理汇总了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")
开发者ID:2do,项目名称:stashboard,代码行数:9,代码来源:test_rest_status.py

示例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)
开发者ID:2do,项目名称:stashboard,代码行数:9,代码来源:test_rest_status.py

示例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))
开发者ID:feczo,项目名称:splashmon,代码行数:27,代码来源:xmpp.py

示例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)
开发者ID:BillTheBest,项目名称:stashboard,代码行数:9,代码来源:test_rest_status.py

示例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")
开发者ID:2do,项目名称:stashboard,代码行数:10,代码来源:test_rest_status.py

示例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")
开发者ID:2do,项目名称:stashboard,代码行数:10,代码来源:test_rest_status.py

示例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('/')
开发者ID:takatoshiono,项目名称:ibeer,代码行数:11,代码来源:status.py

示例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
开发者ID:takatoshiono,项目名称:ibeer,代码行数:12,代码来源:statuses.py

示例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)
开发者ID:2do,项目名称:stashboard,代码行数:13,代码来源:test_rest_status.py


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