'Updates the controller class to subclass from `WebsiteGenertor`,
if it is a subclass of `Document`'

def set_base_class_for_controller(self):

    controller_path = frappe.get_module_path(frappe.scrub(self.module), u'doctype', frappe.scrub(self.name), (frappe.scrub(self.name) + u'.py'))
    with open(controller_path, u'r') as f:
        code = f.read()
    class_string = u'\nclass    {0}(Document)'.format(self.name.replace(u'    ', u''))
    if ((u'\nfrom    frappe.model.document    import    Document' in code) and (class_string in code)):
        code = code.replace(u'from    frappe.model.document    import    Document', u'from    frappe.website.website_generator    import    WebsiteGenerator')
        code = code.replace(u'class    {0}(Document)'.format(self.name.replace(u'    ', u'')), u'class    {0}(WebsiteGenerator)'.format(self.name.replace(u'    ', u'')))
    with open(controller_path, u'w') as f:
        f.write(code)
