Пример #1
0
def doConfig(wfile, req):
    key = req.param("key")
    value = req.param("value")
    if key:
        log.debug('Config set [%s]="%s"' % (key, value))
        cfg.set(key, value)
    showStatus(wfile)
def main(argv):
#    from minds.safe_config import cfg
    from minds.config import cfg
    print cfg
    while True:
        print '\nEnter key to query. Enter key=value to set. "show" to show all values. "save" to save config.'
        line = raw_input('Config key: ')
        if not line:
            break

        if line == 'show':
            print cfg
            continue
        elif line =='save':
            cfg.save()
            continue

        # set key=value?
        if '=' in line:
            key, value = line.split('=',1)
            cfg.set(key, value)
        else:
            key = line
        # query
        try:
            value = cfg.get(key,'n/a')
            print '%s=%s' % (key,value)
        except Exception, e:
            print e
Пример #3
0
def main(rfile, wfile, env):

    from minds import proxy

    cfg.load(proxy.CONFIG_FILENAME)

    form = cgi.FieldStorage(fp=rfile, environ=env)

    mlog = form.getfirst("mlog", "")
    cfg.set("messagelog", "mlog", mlog)

    wfile.write(
        """Content-type: text/plain\r
Cache-control: no-cache\r
\r
"""
    )
    cfg.dump(wfile)
 def save(self):
     cfg.set('upgrade_notification.fetch_date',       str(self.fetch_date))
     cfg.set('upgrade_notification.fetch_frequency',  str(self.fetch_frequency))
     cfg.set('upgrade_notification.last_entry_date',  self.last_entry_date or '')
     cfg.save()