Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2008-08-15 18:21:50 (GMT)
committer Simon Schampijer <simon@schampijer.de>2008-08-15 18:21:50 (GMT)
commit0def2ecb8cba83fd215f9010199819b112f112af (patch)
tree989b249a7f52ec107531524f2c7458cfe5af8a46 /src
parentf4132ad7710aae7c9eafdff0de4da7ddc0923658 (diff)
CP: Clear option for the school server registration #7764
This is a command line only command
Diffstat (limited to 'src')
-rw-r--r--src/controlpanel/cmd.py20
-rw-r--r--src/controlpanel/model/network.py8
2 files changed, 27 insertions, 1 deletions
diff --git a/src/controlpanel/cmd.py b/src/controlpanel/cmd.py
index 7cb40da..ae5d298 100644
--- a/src/controlpanel/cmd.py
+++ b/src/controlpanel/cmd.py
@@ -38,6 +38,7 @@ def cmd_help():
-h key show information about this key \n\
-g key get the current value of the key \n\
-s key set the current value for the key \n\
+ -c key clear the current value for the key \n\
')
def note_restart():
@@ -64,7 +65,7 @@ def load_modules():
def main():
try:
- options, args = getopt.getopt(sys.argv[1:], "h:s:g:l", [])
+ options, args = getopt.getopt(sys.argv[1:], "h:s:g:c:l", [])
except getopt.GetoptError:
cmd_help()
sys.exit(2)
@@ -126,3 +127,20 @@ def main():
print _(_same_option_warning % (key, module))
if found == 0:
print _(_no_option_error % key)
+ if option in ("-c"):
+ for module in modules:
+ method = getattr(module, 'clear_' + key, None)
+ if method:
+ note = 0
+ found += 1
+ if found == 1:
+ try:
+ note = method(*args)
+ except Exception, detail:
+ print _(_general_error % detail)
+ if note == _RESTART:
+ note_restart()
+ else:
+ print _(_same_option_warning % (key, module))
+ if found == 0:
+ print _(_no_option_error % key)
diff --git a/src/controlpanel/model/network.py b/src/controlpanel/model/network.py
index d24c986..94f07c0 100644
--- a/src/controlpanel/model/network.py
+++ b/src/controlpanel/model/network.py
@@ -83,3 +83,11 @@ def set_radio(state):
raise ValueError(_("Error in specified radio argument use on/off."))
return 0
+
+def clear_registration():
+ """Clear the registration with the schoolserver
+ """
+ pro = profile.get_profile()
+ pro.backup1 = None
+ pro.save()
+ return 1