Nevow DropDownListWithDefault class (Element)

I wrote a page with quite a few dropdown lists .. since it gets tedious to just copy and paste I wrote myself a DropDownList class which takes a name and default:

class DropDownListWithDefault(ElementWithData):
    Dropdown with data
    data = {    u'name': u'myddname',
                u'namevaluelist': [[u'1', u'element 1], ..],
                u'defaultVal': u'1'}
    the namevaluelist will be taken as-is (no re-sorting,.. so It needs to be
    a list of name-val lists which should be unicode strings ..
    docFactory = loaders.stan(T.span(render = u'items'))
    def items(self, req, tag):
        ret = []
        myname = u''
        if and[u'name']:
            myname = u'name'
        # now for the data ...
        dfltval = None
            dfltval =[u'defaultVal']
        if not'namevaluelist'):
            raise ValueError(u'No Name - Value list given or list empty')
        for (val, nam) in[u'namevaluelist']:
            if val == dfltval:
                ret.append(T.option(value = val, selected  = u'selected')[nam])
                ret.append(T.option(value = val)[nam])
        return = myname, id_ = myname)[ret]

I couldn't find a way to assign name, id, .. afterwards to I just use a span with stan loader for renderer and then return my select. suggetsions welcome ;)