from CryptoBoxExceptions import CBPluginActionError def prepareForm(hdf, cbox): (oc1, oc2, oc3, oc4) = __getCurrentIP() hdf["Data.Modules.network.ip.oc1"] = oc1 hdf["Data.Modules.network.ip.oc2"] = oc2 hdf["Data.Modules.network.ip.oc3"] = oc3 hdf["Data.Modules.network.ip.oc4"] = oc4 def doAction(cbox, store=None, ip1="", ip2="", ip3="", ip4=""): if store: try: # TODO: check the IP here pass except ValueError: raise CBPluginActionError, "InvalidIP" # TODO: how to set the new IP? (and how to become root?) ## we will continue with the system menue return "form_system" else: return "form_network" def getStatus(cbox): return "%d.%d.%d.%d" % __getCurrentIP() def __getCurrentIP(): # TODO: for now we only provide a dummy return (192,168,0,23)