Dnia 2010-09-20, o godz. 21:03:00
Michal Kochanowicz <[email protected]> napisał(a):
> Czy znacie jakieś workaround na ten problem?
>
> https://bugs.launchpad.net/wicd/+bug/602825
W załączniku patch który poprawia ten błąd. Zaznaczam że nie znam
pythona więc może to nie jest zrobione jak powinno ale działa.
Pozdrawiam.
--
Pepe
--- wicd-1.7.0/wicd/configmanager.py.orig 2010-09-22 13:48:10.000000000 +0000
+++ wicd-1.7.0/wicd/configmanager.py 2010-09-22 13:52:56.000000000 +0000
@@ -25,6 +25,7 @@
#
import os, copy
+import cPickle
from ConfigParser import RawConfigParser
@@ -35,7 +36,7 @@
class ConfigManager(RawConfigParser):
""" A class that can be used to manage a given configuration file. """
def __init__(self, path, debug=False, mark_whitespace="`'`"):
- RawConfigParser.__init__(self)
+ RawConfigParser.__init__(self, allow_no_value = True)
self.config_file = path
self.debug = debug
self.mrk_ws = mark_whitespace
@@ -67,7 +68,7 @@
if value.startswith(' ') or value.endswith(' '):
value = "%(ws)s%(value)s%(ws)s" % {"value" : value,
"ws" : self.mrk_ws}
- RawConfigParser.set(self, section, str(option), value)
+ RawConfigParser.set(self, section, str(option), "None" if value is None else value)
if write:
self.write()
@@ -176,9 +177,7 @@
def _copy_section(self, name):
- # Yes, deepcopy sucks, but it is robust to changes in both
- # this class and RawConfigParser.
- p = copy.deepcopy(self)
+ p = cPickle.loads(cPickle.dumps(self, -1))
for sname in p.sections():
if sname != name:
p.remove_section(sname)
@@ -188,8 +187,7 @@
def write(self):
""" Writes the loaded config file to disk. """
- # Really don't like this deepcopy.
- p = copy.deepcopy(self)
+ p = cPickle.loads(cPickle.dumps(self, -1))
for sname in p.sections():
fname = p.get_option(sname, '_filename_')
if fname and fname != self.config_file:
_______________________________________________
pld-devel-pl mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-devel-pl