def __init__(self, id=None, name=None, parent=None, parentHandler=None, initScripts=None, request=None, **kwargs): if parentHandler: self.elementFactory = parentHandler.elementFactory RequestHandler.__init__(self, parentHandler=parentHandler, initScripts=initScripts) WebElement.__init__(self, id=id or self.accessor, name=name, parent=None, **kwargs) self.setPrefix("") self.attributes['handler'] = self.accessor self.request = request self._loading = self.Loading(self.id + ":Loading", self.name + ":Loading", parent=self, hide=True).toHTML() self.initScripts.append( self.setScriptContainer(ScriptContainer()).content())
def __init__(self, id=None, name=None, parent=None, parentHandler=None, initScripts=None, **kwargs): if parentHandler: self.elementFactory = parentHandler.elementFactory RequestHandler.__init__(self, parentHandler=parentHandler, initScripts=initScripts) WebElement.__init__(self, id=id or self.accessor, name=name, parent=None, **kwargs) self.attributes['handler'] = self.accessor self._loading = self.Loading(self.id + ":Loading", self.name + ":Loading", parent=self, hide=True).toHTML() self.initScripts.append(self.setScriptContainer(ScriptContainer()).content())
def getNestedElementTime(): startTime = time.time() rootElement = WebElement('root') element = rootElement element._tagName = "root" html = "" for x in xrange(900): doneSection() element = element.addChildElement(WebElement("element" + str(x))) element._tagName = 'tag' + str(x) html += element.toHTML() results['nestedNodeCreation'] = time.time() - startTime results['nestedNodeSize'] = len(html)
def toHTML(self, formatted=False, *args, **kwargs): """ Override toHTML to draw loading section in addition to controller placement """ return "".join([ self._loading, WebElement.toHTML(self, formatted, *args, **kwargs) ])
def test_addChildElement(self): #Ensure element adds correctly if parent element allows children addElement = WebElement() assert self.container.addChildElement(addElement) == addElement assert self.container.childElements[1] == addElement #Ensure element is not added if parent element does not allow children assert not self.firstChild.addChildElement(WebElement()) assert len(self.container.childElements) == 2 #Ensure child element will not add twice self.container.addChildElement(addElement) assert len(self.container.childElements) == 2 assert self.container.childElements[1] == addElement #Ensure child element will add if ensure unique is false self.container.addChildElement(addElement, ensureUnique=False) assert len(self.container.childElements) == 3 assert self.container.childElements[1] == addElement assert self.container.childElements[2] == addElement
def __init__(self, id=None, name=None, parent=None): WebElement.__init__(self, "Id", "Name")
def toHTML(self, formatted=False, *args, **kwargs): """ Override toHTML to draw loading section in addition to controller placement """ return "".join([self._loading, WebElement.toHTML(self, formatted, *args, **kwargs)])