summaryrefslogtreecommitdiffstats
path: root/cobbler/utils.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-02-22 16:32:54 -0500
committerMichael DeHaan <mdehaan@redhat.com>2008-02-22 16:32:54 -0500
commit1859709fe6ecf6b0503ccdb56c1e87d7cc15009d (patch)
tree517e4463cb22677432b903e9141557d6213d2872 /cobbler/utils.py
parent01a4668737539ed1a68d4e6cc35d09eaa15d3d02 (diff)
downloadthird_party-cobbler-1859709fe6ecf6b0503ccdb56c1e87d7cc15009d.tar.gz
third_party-cobbler-1859709fe6ecf6b0503ccdb56c1e87d7cc15009d.tar.xz
third_party-cobbler-1859709fe6ecf6b0503ccdb56c1e87d7cc15009d.zip
This is a fix to a webui submission problem for the repos field on certain
versions of mod_python. It still needs to be fixed correctly though this makes that page work for now.
Diffstat (limited to 'cobbler/utils.py')
-rw-r--r--cobbler/utils.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/cobbler/utils.py b/cobbler/utils.py
index ca3d91a..069d440 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -445,3 +445,26 @@ def run_triggers(ref,globber):
if rc != 0:
raise CX(_("cobbler trigger failed: %(file)s returns %(code)d") % { "file" : file, "code" : rc })
+def fix_mod_python_select_submission(repos):
+ """
+ WARNING: this is a heinous hack to convert mod_python submitted form data
+ to something usable. Ultimately we need to fix the root cause of this
+ which doesn't seem to happen on all versions of python/mp.
+ """
+
+ if str(repos).find("Field(") == -1:
+ return repos # no hack needed
+
+ # should be nice regex, but this is readable :)
+ repos = str(repos)
+ repos = repos.replace("'repos'","")
+ repos = repos.replace("'","")
+ repos = repos.replace("[","")
+ repos = repos.replace("]","")
+ repos = repos.replace("Field(","")
+ repos = repos.replace(")","")
+ repos = repos.replace(",","")
+ repos = repos.replace('"',"")
+ repos = repos.lstrip().rstrip()
+ return repos
+