|
|
@ -331,38 +331,34 @@ class Settings(object): |
|
|
|
return { |
|
|
|
'success' : False, |
|
|
|
} |
|
|
|
else: |
|
|
|
|
|
|
|
from couchpotato.environment import Env |
|
|
|
soft_chroot = Env.get('softchroot') |
|
|
|
|
|
|
|
if self.getType(section, option) == 'directory': |
|
|
|
value = soft_chroot.chroot2abs(value) |
|
|
|
from couchpotato.environment import Env |
|
|
|
soft_chroot = Env.get('softchroot') |
|
|
|
|
|
|
|
if self.getType(section, option) == 'directories': |
|
|
|
import json |
|
|
|
value = json.loads(value) |
|
|
|
if not (value and isinstance(value, list)): |
|
|
|
value = [] |
|
|
|
value = map(soft_chroot.chroot2abs, value) |
|
|
|
value = self.directories_delimiter.join(value) |
|
|
|
if self.getType(section, option) == 'directory': |
|
|
|
value = soft_chroot.chroot2abs(value) |
|
|
|
|
|
|
|
# See if a value handler is attached, use that as value |
|
|
|
new_value = fireEvent('setting.save.%s.%s' % (section, option), value, single = True) |
|
|
|
if self.getType(section, option) == 'directories': |
|
|
|
import json |
|
|
|
value = json.loads(value) |
|
|
|
if not (value and isinstance(value, list)): |
|
|
|
value = [] |
|
|
|
value = map(soft_chroot.chroot2abs, value) |
|
|
|
value = self.directories_delimiter.join(value) |
|
|
|
|
|
|
|
self.set(section, option, (new_value if new_value else value).encode('unicode_escape')) |
|
|
|
self.save() |
|
|
|
# See if a value handler is attached, use that as value |
|
|
|
new_value = fireEvent('setting.save.%s.%s' % (section, option), value, single = True) |
|
|
|
|
|
|
|
# After save (for re-interval etc) |
|
|
|
fireEvent('setting.save.%s.%s.after' % (section, option), single = True) |
|
|
|
fireEvent('setting.save.%s.*.after' % section, single = True) |
|
|
|
self.set(section, option, (new_value if new_value else value).encode('unicode_escape')) |
|
|
|
self.save() |
|
|
|
|
|
|
|
return { |
|
|
|
'success': True |
|
|
|
} |
|
|
|
# After save (for re-interval etc) |
|
|
|
fireEvent('setting.save.%s.%s.after' % (section, option), single = True) |
|
|
|
fireEvent('setting.save.%s.*.after' % section, single = True) |
|
|
|
|
|
|
|
# unreachable code: |
|
|
|
return None |
|
|
|
return { |
|
|
|
'success': True |
|
|
|
} |
|
|
|
|
|
|
|
def isSectionReadable(self, section): |
|
|
|
meta = 'section_hidden' + self.optionMetaSuffix() |
|
|
|