Changeset 984 for dassmodus/trunk


Ignore:
Timestamp:
Mar 29, 2012, 2:44:10 PM (13 years ago)
Author:
pstorz
Message:

fixed problen with default values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dassmodus/trunk/dassmodus/nosferatu/nosferatu/tools/bacsource2configrules.py

    r953 r984  
    163163
    164164def defvalue(type, name, value):
     165  print  "-> type=%s, name=%s, value=%s" % (type,name,value)
    165166  if type == 'store_opts':
    166167    if name in BOOL_FILESET_OPTIONS:
     
    173174     
    174175  elif type == 'store_bool' or type == 'store_bit':
    175     if value == 0:
     176    if value == 0 or value == '0' or value == 'false' or value == None:
    176177      defval =  False
    177178    else:
     
    179180  else:
    180181    defval = CONF2VALUE.get(value,value)
     182  print "<- type=%s, name=%s, defaultvalue=%s" % (type,name,defval)
    181183  return defval
    182184
     
    227229          pass
    228230        for i in keys:
    229         #for i, v in conf[r].iteritems():
     231        #for i, v in conf[r].iteritems():
    230232            name = i
    231233            v = conf[r][i]
    232             type = v["handler"]       
     234            type = v["handler"]
    233235            required = v["flags"] == "ITEM_REQUIRED"
    234236            default = v["flags"] == "ITEM_DEFAULT"
    235237            defaultvalue = defvalue(type, name,  v["default_value"])
    236238            #defaultvalue = CONF2VALUE.get(v["default_value"],v["default_value"])
    237             if default: 
     239            if default:
    238240              value = defaultvalue
    239241            else:
    240242              value = defvalue(type, name, None)
     243            print "name:%s value:%s defval: %s" % (name,value,defaultvalue)
    241244            s += "  %s,\n" % repr(Item(name, value, defaultvalue, default, type, required))
    242245        s += "]\n"
Note: See TracChangeset for help on using the changeset viewer.