'Lazy initialization of defaults'

def _setup(self):

    if self.setup:
        return
    self.queries = 0
    messages = current.messages
    if (self.default is None):
        self.default = s3_str(messages.UNKNOWN_OPT)
    if (self.none is None):
        self.none = messages['NONE']
    if (self.options is not None):
        if self.translate:
            T = current.T
            self.theset = dict((((opt, T(label)) if isinstance(label, basestring) else (opt, label)) for (opt, label) in self.options.items()))
        else:
            self.theset = self.options
    else:
        self.theset = {}
    if (self.table is None):
        tablename = self.tablename
        if tablename:
            table = current.s3db.table(tablename)
            if (table is not None):
                if (self.key is None):
                    self.key = table._id.name
                if (not self.fields):
                    if ('name' in table):
                        self.fields = ['name']
                    else:
                        self.fields = [self.key]
                self.table = table
            if ((self.linkto is None) and self.show_link):
                (c, f) = tablename.split('_', 1)
                self.linkto = URL(c=c, f=f, args=['[id]'], extension='')
    labels = self.labels
    self.slabels = isinstance(labels, basestring)
    self.clabels = callable(labels)
    if isinstance(self.hierarchy, basestring):
        self.htemplate = self.hierarchy
    else:
        self.htemplate = '%s    >    %s'
    self.setup = True
