本文整理汇总了Python中core.data.db.history.HistoryItem.toggle_mark方法的典型用法代码示例。如果您正苦于以下问题:Python HistoryItem.toggle_mark方法的具体用法?Python HistoryItem.toggle_mark怎么用?Python HistoryItem.toggle_mark使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.data.db.history.HistoryItem
的用法示例。
在下文中一共展示了HistoryItem.toggle_mark方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: toggle_bookmark
# 需要导入模块: from core.data.db.history import HistoryItem [as 别名]
# 或者: from core.data.db.history.HistoryItem import toggle_mark [as 别名]
def toggle_bookmark(self, cell, path, model):
"""Toggle bookmark."""
model[path][1] = not model[path][1]
historyItem = HistoryItem()
historyItem.load(model[path][0])
historyItem.toggle_mark(True)
return
示例2: test_find
# 需要导入模块: from core.data.db.history import HistoryItem [as 别名]
# 或者: from core.data.db.history.HistoryItem import toggle_mark [as 别名]
def test_find(self):
find_id = random.randint(1, 499)
url = URL("http://w3af.org/a/b/foobar.php?foo=123")
tag_value = rand_alnum(10)
for i in xrange(0, 500):
request = HTTPRequest(url, data="a=1")
code = 200
if i == find_id:
code = 302
hdr = Headers([("Content-Type", "text/html")])
res = HTTPResponse(code, "<html>", hdr, url, url)
h1 = HistoryItem()
h1.request = request
res.set_id(i)
h1.response = res
if i == find_id:
h1.toggle_mark()
h1.update_tag(tag_value)
h1.save()
h2 = HistoryItem()
self.assertEqual(len(h2.find([("tag", "%" + tag_value + "%", "like")])), 1)
self.assertEqual(len(h2.find([("code", 302, "=")])), 1)
self.assertEqual(len(h2.find([("mark", 1, "=")])), 1)
self.assertEqual(len(h2.find([("has_qs", 1, "=")])), 500)
self.assertEqual(len(h2.find([("has_qs", 1, "=")], result_limit=10)), 10)
results = h2.find([("has_qs", 1, "=")], result_limit=1, orderData=[("id", "desc")])
self.assertEqual(results[0].id, 499)
search_data = []
search_data.append(("id", find_id + 1, "<"))
search_data.append(("id", find_id - 1, ">"))
self.assertEqual(len(h2.find(search_data)), 1)
示例3: test_mark
# 需要导入模块: from core.data.db.history import HistoryItem [as 别名]
# 或者: from core.data.db.history.HistoryItem import toggle_mark [as 别名]
def test_mark(self):
mark_id = 3
url = URL("http://w3af.org/a/b/c.php")
for i in xrange(0, 500):
request = HTTPRequest(url, data="a=1")
hdr = Headers([("Content-Type", "text/html")])
res = HTTPResponse(200, "<html>", hdr, url, url)
h1 = HistoryItem()
h1.request = request
res.set_id(i)
h1.response = res
if i == mark_id:
h1.toggle_mark()
h1.save()
h2 = HistoryItem()
h2.load(mark_id)
self.assertTrue(h2.mark)
h3 = HistoryItem()
h3.load(mark_id - 1)
self.assertFalse(h3.mark)