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


Python models.Error类代码示例

本文整理汇总了Python中error.models.Error的典型用法代码示例。如果您正苦于以下问题:Python Error类的具体用法?Python Error怎么用?Python Error使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testBasic

    def testBasic(self):
        c = Client()
        assert not Error.all().count()
        data = {
            "account": settings.ARECIBO_PUBLIC_ACCOUNT_NUMBER,
            "priority": 4,
            "user_agent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X...",
            "url": "http://badapp.org/-\ufffdwe-cant-lose",
            "uid": "123124123123",
            "ip": "127.0.0.1",    
            "type": "Test from python",
            "status": "403",
            "server": "Test Script", 
            "request": """This is the bit that goes in the request""",
            "username": "Jimbob",
            "msg": """
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut 
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris 
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit 
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in 
culpa qui officia deserunt mollit anim id est laborum
""",
            "traceback": """Traceback (most recent call last",:
  File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero  df
""",}
        res = c.post(reverse("post"), data)
        assert Error.all().count() == 1
开发者ID:robhudson,项目名称:arecibo,代码行数:28,代码来源:tests.py

示例2: testUnicodeTraceback

 def testUnicodeTraceback(self):
     c = Client()
     assert not Error.all().count()
     ldata = data.copy()
     ldata["traceback"] = "ɷo̚حٍ"
     c.post(reverse("error-post"), ldata)
     assert Error.all().count() == 1
开发者ID:andymckay,项目名称:arecibo,代码行数:7,代码来源:tests.py

示例3: testNoPriority

 def testNoPriority(self):
     c = Client()
     assert not Error.all().count()
     ldata = data.copy()
     del ldata["priority"]
     c.post(reverse("error-post"), ldata)
     assert Error.all().count() == 1
开发者ID:alanjds,项目名称:arecibo,代码行数:7,代码来源:tests.py

示例4: testGroupDelete

 def testGroupDelete(self):
     c = Client()
     c.post(reverse("error-post"), data)
     assert Group.all().count() == 1, "Got %s groups, not 1" % Group.all().count()
     assert Error.all().count() == 1
     Error.all()[0].delete()
     assert Group.all().count() == 0
开发者ID:alanjds,项目名称:arecibo,代码行数:7,代码来源:tests.py

示例5: post

def post(request):
    """ Add in a post """
    err = Error()
    err.ip = request.META.get("REMOTE_ADDR", "")
    err.user_agent = request.META.get("HTTP_USER_AGENT", "")

    populate(err, request.POST)
    return render_plain("Error recorded")
开发者ID:rgv151,项目名称:arecibo,代码行数:8,代码来源:http.py

示例6: testNoNotification

 def testNoNotification(self):
     c = Client()
     assert not Error.all().count()
     data = test_data.copy()
     data["priority"] = 6
     c.post(reverse("error-post"), data)
     assert data["priority"] > 5, data["priority"]
     assert Error.all().count() == 1
     assert Notification.all().count() == 0
开发者ID:andymckay,项目名称:arecibo,代码行数:9,代码来源:tests.py

示例7: testBasic

    def testBasic(self):
        c = Client()
        assert not Error.all().count()
        c.post(reverse("error-post"), test_data)
        assert test_data["priority"] < 5, test_data["priority"]
        assert Error.all().count() == 1

        c.post(reverse("error-post"), test_data)
        assert test_data["priority"] < 5, test_data["priority"]
        assert Error.all().count() == 2
开发者ID:andymckay,项目名称:arecibo,代码行数:10,代码来源:tests.py

示例8: testBrowser

 def testBrowser(self):
     c = Client()
     assert not Error.all().count()
     ldata = data.copy()
     ldata["user_agent"] = "Mozilla/5.0 (compatible; Konqueror/3.5; Linux; X11; de) KHTML/3.5.2 (like Gecko) Kubuntu 6.06 Dapper"
     c.post(reverse("error-post"), ldata)
     assert Error.all().count() == 1
     assert Error.all()[0].user_agent_short == "Konqueror"
     assert Error.all()[0].user_agent_parsed == True
     assert Error.all()[0].operating_system == "Linux"
开发者ID:alanjds,项目名称:arecibo,代码行数:10,代码来源:tests.py

示例9: testCount

 def testCount(self):
     for x in range(0, 1110):
         Error().save(dont_send_signals=True)
     assert count() == 1110
     for x in range(0, 5):
         err = Error(dont_send_signals=True)
         err.priority = 4
         err.save()
     assert count(["priority = ", 4]) == 5
     assert count(["priority = ", None]) == 1110
     assert count() == 1115
开发者ID:alanjds,项目名称:arecibo,代码行数:11,代码来源:tests.py

示例10: testGroup

    def testGroup(self):
        c = Client()
        c.post(reverse("error-post"), data)
        assert Group.all().count() == 1, "Got %s groups, not 1" % Group.all().count()
        c.post(reverse("error-post"), data)
        assert Group.all().count() == 1
        new_data = data.copy()
        new_data["status"] = 402
        c.post(reverse("error-post"), new_data)
        assert Group.all().count() == 2

        # and test similar
        assert not Error.all()[2].get_similar()
        assert len(Error.all()[1].get_similar()) == 1
        assert len(Error.all()[1].get_similar()) == 1
开发者ID:alanjds,项目名称:arecibo,代码行数:15,代码来源:tests.py

示例11: default_grouping

def default_grouping(instance, **kw):
    """ Given an error, see if we can fingerprint it and find similar ones """
    # prevent an infinite loop
    log("Firing signal: default_grouping")
    if instance.group:
        return

    hsh = generate_key(instance)
    if hsh:
        digest = hsh.hexdigest()
        try:
            created = False
            group = Group.all().filter("uid = ", digest)[0]
            group.count = Error.all().filter("group = ", group).count() + 1
            group.save()
        except IndexError:
            created = True
            group = Group()
            group.uid = digest
            group.count = 1
            group.save()

        instance.group = group
        instance.save()

        if created:
            signals.group_assigned.send(sender=group.__class__, instance=group)
开发者ID:rootart,项目名称:arecibo,代码行数:27,代码来源:listeners.py

示例12: setUp

 def setUp(self):
     for issue in Issue.all(): issue.delete()
     for log in Log.all(): log.delete()
     for comment in Comment.all(): comment.delete()
     for group in Group.all(): group.delete()
     for error in Error.all(): error.delete()
     for project in Project.all(): project.delete()
开发者ID:alanjds,项目名称:arecibo,代码行数:7,代码来源:tests.py

示例13: send_signal

def send_signal(request, pk):
    error = Error.get(pk)
    if not error.create_signal_sent:
        error.create_signal_sent = True
        error.save()
        error_created.send(sender=error.__class__, instance=error)
        return render_plain("Signal sent")
    return render_plain("Signal not sent")
开发者ID:alanjds,项目名称:arecibo,代码行数:8,代码来源:views.py

示例14: error_public_toggle

def error_public_toggle(request, pk):
    error = Error.get(pk)
    if request.method.lower() == "post":
        if error.public:
            error.public = False
        else:
            error.public = True
        error.save()
    return HttpResponseRedirect(reverse("error-view", args=[error.id,]))
开发者ID:alanjds,项目名称:arecibo,代码行数:9,代码来源:views.py

示例15: TestJobTypesSystemFailuresView

class TestJobTypesSystemFailuresView(TestCase):
    def setUp(self):
        django.setup()

        self.error = Error(name="Test Error", description="test")
        self.error.save()
        self.job = job_test_utils.create_job(status="FAILED", error=self.error)

    def test_successful(self):
        """Tests successfully calling the system failures view."""

        url = "/job-types/system-failures/"
        response = self.client.generic("GET", url)
        result = json.loads(response.content)

        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertEqual(len(result["results"]), 1)
        self.assertEqual(result["results"][0]["job_type"]["name"], self.job.job_type.name)
        self.assertEqual(result["results"][0]["error"]["name"], self.error.name)
        self.assertEqual(result["results"][0]["count"], 1)
开发者ID:Carl4,项目名称:scale,代码行数:20,代码来源:test_views.py


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