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


Python HistoryItem.delete方法代码示例

本文整理汇总了Python中core.data.db.history.HistoryItem.delete方法的典型用法代码示例。如果您正苦于以下问题:Python HistoryItem.delete方法的具体用法?Python HistoryItem.delete怎么用?Python HistoryItem.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core.data.db.history.HistoryItem的用法示例。


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

示例1: test_delete

# 需要导入模块: from core.data.db.history import HistoryItem [as 别名]
# 或者: from core.data.db.history.HistoryItem import delete [as 别名]
 def test_delete(self):
     i = random.randint(1, 499)
     url = url_object('http://w3af.com/a/b/c.php')
     fr = FuzzReq(url, dc={'a': ['1']})
     res = httpResponse(200, '<html>',{'Content-Type':'text/html'}, url, url)
     h1 = HistoryItem()
     h1.request = fr
     res.setId(i)
     h1.response = res
     h1.save()
     h1.delete(i)
     try:
         h2 = h1.read(i)
     except:
         h2 = None
     self.assertEqual(h2, None)
开发者ID:1d3df9903ad,项目名称:w3af,代码行数:18,代码来源:test_history.py

示例2: test_delete

# 需要导入模块: from core.data.db.history import HistoryItem [as 别名]
# 或者: from core.data.db.history.HistoryItem import delete [as 别名]
    def test_delete(self):
        i = random.randint(1, 499)

        url = URL("http://w3af.com/a/b/c.php")
        request = HTTPRequest(url, data="a=1")
        hdr = Headers([("Content-Type", "text/html")])
        res = HTTPResponse(200, "<html>", hdr, url, url)
        res.set_id(i)

        h1 = HistoryItem()
        h1.request = request
        h1.response = res
        h1.save()

        fname = h1._get_fname_for_id(i)
        self.assertTrue(os.path.exists(fname))

        h1.delete(i)

        self.assertRaises(DBException, h1.read, i)
        self.assertFalse(os.path.exists(fname))
开发者ID:zhuyue1314,项目名称:w3af,代码行数:23,代码来源:test_history.py

示例3: httpLogTab

# 需要导入模块: from core.data.db.history import HistoryItem [as 别名]
# 或者: from core.data.db.history.HistoryItem import delete [as 别名]
class httpLogTab(entries.RememberingHPaned):
    """A tab that shows all HTTP requests and responses made by the framework.
    :author: Andres Riancho ([email protected])
    """

    def __init__(self, w3af, padding=10, time_refresh=False):
        """Init object."""
        super(httpLogTab, self).__init__(w3af, "pane-httplogtab", 300)
        self.w3af = w3af
        self._padding = padding
        self._lastId = 0
        self._historyItem = HistoryItem()
        if time_refresh:
            gobject.timeout_add(1000, self.refresh_results)
        # Create the main container
        mainvbox = gtk.VBox()
        mainvbox.set_spacing(self._padding)
        # Add the menuHbox, Req/Res viewer and the R/R selector on the bottom
        self._initSearchBox(mainvbox)
        self._initFilterBox(mainvbox)
        self._initReqResViewer(mainvbox)
        mainvbox.show()
        # Add everything
        self.add(mainvbox)
        self.show()

    def _initReqResViewer(self, mainvbox):
        """Create the req/res viewer."""
        self._reqResViewer = reqResViewer.reqResViewer(self.w3af, editableRequest=False, editableResponse=False)
        self._reqResViewer.set_sensitive(False)
        # Create the req/res selector (when a search with more
        # than one result is done, this window appears)
        self._sw = gtk.ScrolledWindow()
        self._sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        self._sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self._lstore = gtk.ListStore(
            gobject.TYPE_UINT,
            gobject.TYPE_BOOLEAN,
            gobject.TYPE_STRING,
            gobject.TYPE_STRING,
            gobject.TYPE_STRING,
            gobject.TYPE_UINT,
            gobject.TYPE_STRING,
            gobject.TYPE_UINT,
            gobject.TYPE_STRING,
            gobject.TYPE_FLOAT,
        )
        # Create tree view
        self._lstoreTreeview = gtk.TreeView(self._lstore)
        self._lstoreTreeview.set_rules_hint(True)
        self._lstoreTreeview.set_search_column(0)
        self.__add_columns(self._lstoreTreeview)
        self._lstoreTreeview.show()
        self._lstoreTreeview.connect("cursor-changed", self._view_in_req_res_viewer)
        # Popup menu
        self._rightButtonMenu = None
        self._lstoreTreeview.connect("button-press-event", self._popupMenu)
        #
        #
        # Selection
        #
        treeselection = self._lstoreTreeview.get_selection()
        treeselection.set_mode(gtk.SELECTION_MULTIPLE)

        self._sw.add(self._lstoreTreeview)
        # self._sw.set_sensitive(False)
        self._sw.show_all()
        # I want all sections to be resizable
        self._vpan = entries.RememberingVPaned(self.w3af, "pane-swandrRV", 100)
        self._vpan.pack1(self._sw)
        self._vpan.pack2(self._reqResViewer)
        self._vpan.show()
        mainvbox.pack_start(self._vpan)

    def _popupMenu(self, tv, event):
        """Generate and show popup menu."""
        if event.button != 3:
            return
        # creates the whole menu only once
        if self._rightButtonMenu is None:
            gm = gtk.Menu()
            self._rightButtonMenu = gm
            # the items
            e = gtk.MenuItem(_("Delete selected items"))
            e.connect("activate", self._deleteSelected)
            gm.append(e)
            gm.show_all()
        else:
            gm = self._rightButtonMenu
        gm.popup(None, None, None, event.button, event.time)
        return True

    def _deleteSelected(self, widg=None):
        """Delete selected transactions."""
        ids = []
        iters = []
        sel = self._lstoreTreeview.get_selection()
        (model, pathlist) = sel.get_selected_rows()
        for path in pathlist:
            iters.append(self._lstore.get_iter(path))
#.........这里部分代码省略.........
开发者ID:zhuyue1314,项目名称:w3af,代码行数:103,代码来源:httpLogTab.py


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