def save(self, fw=True):
     policies.set(self.type, self.id, self.policy)
     policies.save()
     if config.get("general", "firewall", True) and fw:
         security.regen_fw(get())
     if not storage.policies.get("policies", self.id):
         storage.policies.add("policies", self)
def deregister(type, id="", fw=True):
    for x in get(type=type):
        if not id:
            x.remove(fw=False)
        elif x.id == id:
            x.remove(fw=False)
            break
    if config.get("general", "firewall", True) and fw:
        security.regen_fw(get())
 def remove(self, fw=True):
     policies.remove(self.type, self.id)
     policies.save()
     if config.get("general", "firewall", True) and fw:
         security.regen_fw(get())
     storage.policies.remove("policies", self)