cryptonas-branches/pythonrewrite/plugins/network/network.py
lars dba8ca79fd plugin interface implemented
example plugins added: date and network
moved "logs" to plugins
2006-09-12 08:55:20 +00:00

33 lines
785 B
Python

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)