'Render the tree
@param widget_id: the widget ID
@param record: the root record (if requested)'

def render_tree(self, widget_id, record=None):

    resource = self.resource
    tablename = resource.tablename
    h = S3Hierarchy(tablename=tablename)
    if (not h.config):
        raise SyntaxError()
    root = None
    if record:
        try:
            root = record[h.pkey]
        except AttributeError as e:
            msg = ('S3Hierarchy:    key    %s    not    found    in    record' % h.pkey)
            e.args = tuple(([msg] + list(e.args[1:])))
            raise
    return h.html(('%s-tree' % widget_id), root=root)
