# Path: instant_templates/update_webbot_appengine/WebElements/Base.py
# class Invalid(WebElement):
#     """
#         An Invalid WebElement - used generally to show that a desired element failed to load
#     """
#     __slots__ = ()
#     tagName = "h2"
#     allowsChildren = False
# 
#     def setProperties(self, valueDict):
#         """
#             Overrides the behavior of setProperties on invalid elements to do nothing.
#         """
#         pass
# 
#     def content(self, formatted=False, *args, **kwargs):
#         """
#             Overrides content to return 'Invalid element' string
#         """
#         return "Invalid Element"
# 
# class TextNode(object):
#     """
#         Defines the most basic concept of an html node - does not have the concept of children only of producing html
#         should only be used internally or for testing objects
#     """
#     __slots__ = ('_text', 'parent')
#     displayable = True
#     tagName = ''
#     _tagName = ''
# 
#     def __init__(self, text='', parent=None):
#         self.setText(text)
#         self.parent = parent
# 
#     def setText(self, text):
#         """
#             Sets the text associated with the text node.
#         """
#         self._text = text
# 
#     def text(self):
#         """
#             Returns the text associated with the text node.
#         """
#         return self._text
# 
#     def shown(self):
#         """
#             Text node elements are always visible
#         """
#         return True
# 
#     def toHTML(self, *args, **kwargs):
#         """
#             Returns the rendered html text node (simply a unicode version of the text).
#         """
#         return unicode(self.text())
# 
#     def insertVariables(self, *args, **kwargs):
#         """
#             Overrides insertVariables to do nothing when called on a text node.
#         """
#         pass
# 
#     def __repr__(self):
#         return self.__class__.__name__ + "(" + repr(self.text()) + ")"
# 
#     def replaceWith(self, replacementElement):
#         """
#             Replaces this text node with a webelement
#         """
#         if self.parent:
#             index = self.parent.childElements.index(self)
#             self.parent.childElements[index] = replacementElement
#             replacementElement.parent = self.parent
#             return replacementElement
#         else:
#             return Invalid()


import types
from .Base import Invalid, TextNode
from .MultiplePythonSupport import *
        """
            Builds a WebElement instance from the className:
                className - the class name of the webElement (case insensitive)
                id - the unique id to assign to the newly built element
                name - the non-unique identifier to asign to the newly built element
                parent - the element that will contain the newly built element
        """
        className = className and className.lower() or ""
        product = self.products.get(className, None)
        if product:
            return product(id, name, parent)
        else:
            print(self.name + " has no product " + className + " sorry :(")
            return Invalid()

    def buildFromTemplate(self, template, variableDict=None, idPrefix=None, parent=None,
                            scriptContainer=None, accessors=None):
        """
            Builds an WebElement or a tree of web elements from a dictionary definition:
                template - the WebElement template node definition tree
                variableDict - a dictionary of variables (id/name/key):value to use to populate the
                               tree of WebElements
                idPrefix - a prefix to prepend before each element id in the tree to distinguish it
                           from a different tree on the page
                parent - the webElement that will encompass the tree
                scriptContainer - a container (AJAXScriptContainer/ScriptContainer) to throw scripts
                                  in
                accessors - pass in a dictionary to have it updated with element accessors
        """
        if not template:

# Path: instant_templates/update_webbot_appengine/WebElements/Base.py
# class Invalid(WebElement):
#     """
#         An Invalid WebElement - used generally to show that a desired element failed to load
#     """
#     __slots__ = ()
#     tagName = "h2"
#     allowsChildren = False
# 
#     def setProperties(self, valueDict):
#         """
#             Overrides the behavior of setProperties on invalid elements to do nothing.
#         """
#         pass
# 
#     def content(self, formatted=False, *args, **kwargs):
#         """
#             Overrides content to return 'Invalid element' string
#         """
#         return "Invalid Element"
# 
# class TextNode(object):
#     """
#         Defines the most basic concept of an html node - does not have the concept of children only of producing html
#         should only be used internally or for testing objects
#     """
#     __slots__ = ('_text', 'parent')
#     displayable = True
#     tagName = ''
#     _tagName = ''
# 
#     def __init__(self, text='', parent=None):
#         self.setText(text)
#         self.parent = parent
# 
#     def setText(self, text):
#         """
#             Sets the text associated with the text node.
#         """
#         self._text = text
# 
#     def text(self):
#         """
#             Returns the text associated with the text node.
#         """
#         return self._text
# 
#     def shown(self):
#         """
#             Text node elements are always visible
#         """
#         return True
# 
#     def toHTML(self, *args, **kwargs):
#         """
#             Returns the rendered html text node (simply a unicode version of the text).
#         """
#         return unicode(self.text())
# 
#     def insertVariables(self, *args, **kwargs):
#         """
#             Overrides insertVariables to do nothing when called on a text node.
#         """
#         pass
# 
#     def __repr__(self):
#         return self.__class__.__name__ + "(" + repr(self.text()) + ")"
# 
#     def replaceWith(self, replacementElement):
#         """
#             Replaces this text node with a webelement
#         """
#         if self.parent:
#             index = self.parent.childElements.index(self)
#             self.parent.childElements[index] = replacementElement
#             replacementElement.parent = self.parent
#             return replacementElement
#         else:
#             return Invalid()


# Path: instant_templates/update_webbot_appengine/WebElements/Factory.py
import types
from .Base import Invalid, TextNode
from .MultiplePythonSupport import *

        """
            Builds a WebElement instance from the className:
                className - the class name of the webElement (case insensitive)
                id - the unique id to assign to the newly built element
                name - the non-unique identifier to asign to the newly built element
                parent - the element that will contain the newly built element
        """
        className = className and className.lower() or ""
        product = self.products.get(className, None)
        if product:
            return product(id, name, parent)
        else:
            print(self.name + " has no product " + className + " sorry :(")
            return Invalid()

    def buildFromTemplate(self, template, variableDict=None, idPrefix=None, parent=None,
                            scriptContainer=None, accessors=None):
        """
            Builds an WebElement or a tree of web elements from a dictionary definition:
                template - the WebElement template node definition tree
                variableDict - a dictionary of variables (id/name/key):value to use to populate the
                               tree of WebElements
                idPrefix - a prefix to prepend before each element id in the tree to distinguish it
                           from a different tree on the page
                parent - the webElement that will encompass the tree
                scriptContainer - a container (AJAXScriptContainer/ScriptContainer) to throw scripts
                                  in
                accessors - pass in a dictionary to have it updated with element accessors
        """
        if not template:

            return Invalid()