Logo Search packages:      
Sourcecode: ufw version File versions

def src::backend::UFWBackend::set_default (   self,
  f,
  opt,
  value 
)

Sets option in defaults file

Definition at line 164 of file backend.py.

00164                                         :
        '''Sets option in defaults file'''
        if not re.match(r'^[\w_]+$', opt):
            err_msg = _("Invalid option")
            raise UFWError(err_msg)

        try:
            fns = ufw.util.open_files(f)
        except Exception:
            raise
        fd = fns['tmp']

        pat = re.compile(r'^' + opt + '=')
        for line in fns['orig']:
            if pat.search(line):
                os.write(fd, opt + "=" + value + "\n")
            else:
                os.write(fd, line)
    
        ufw.util.close_files(fns)

    # API overrides
    def get_loglevel(self):


Generated by  Doxygen 1.6.0   Back to index