Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return value
def __set__(self, instance, value):
key = self.get_key(instance.gconfDir)
instance.client.set(key, value)
def __delete__(self, instance):
instance.client.unset(self.get_key(instance.gconfDir))
class SimpleOption(Option):
"""
Base class for all types in gconf.
"""
gconf_type = gconf.VALUE_INVALID
def __init__(self, *args, **kwargs):
self.getter = getattr(gconf.Value, 'get_%s' % self.gconf_type.value_nick)
self.setter = getattr(gconf.Value, 'set_%s' % self.gconf_type.value_nick)
super(SimpleOption, self).__init__(*args, **kwargs)
def __get__(self, instance, owner=None):
gconf_value = super(SimpleOption, self).__get__(instance, owner)
if gconf_value is None:
return None
return self.getter(gconf_value)
def __set__(self, instance, value):
gconf_value = gconf.Value(self.gconf_type)
self.setter(gconf_value, value)
super(SimpleOption, self).__set__(instance, gconf_value)
return value
def __set__(self, instance, value):
key = self.get_key(self._base_uri)
self._storage_client.set(key, value)
def __delete__(self, instance):
self._storage_client.unset(self.get_key(self._base_uri))
class SimpleOption(Option):
"""
Base class for all types in gconf.
Define setters and getters only
"""
gconf_type = gconf.VALUE_INVALID
def __init__(self, *args, **kwargs):
self.getter = getattr(gconf.Value, 'get_%s' % self.gconf_type.value_nick)
self.setter = getattr(gconf.Value, 'set_%s' % self.gconf_type.value_nick)
super(SimpleOption, self).__init__(*args, **kwargs)
def __get__(self, instance, owner=None):
gconf_value = super(SimpleOption, self).__get__(instance, owner)
if gconf_value is None:
return None
return self.getter(gconf_value)
def __set__(self, instance, value):
gconf_value = gconf.Value(self.gconf_type)
self.setter(gconf_value, value)
super(SimpleOption, self).__set__(instance, gconf_value)