summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/deps/livesettings/models.py14
-rw-r--r--askbot/deps/livesettings/overrides.py4
2 files changed, 15 insertions, 3 deletions
diff --git a/askbot/deps/livesettings/models.py b/askbot/deps/livesettings/models.py
index 15392cb8..13c2323b 100644
--- a/askbot/deps/livesettings/models.py
+++ b/askbot/deps/livesettings/models.py
@@ -32,7 +32,13 @@ def find_setting(group, key, site=None):
use_db, overrides = get_overrides(siteid)
ck = cache_key('Setting', siteid, group, key)
- if use_db:
+ grp = overrides.get(group, None)
+
+ if grp and key in grp:
+ val = grp[key]
+ setting = ImmutableSetting(key=key, group=group, value=val)
+ log.debug('Returning overridden: %s', setting)
+ elif use_db:
try:
setting = cache_get(ck)
@@ -125,6 +131,7 @@ class Setting(models.Model, CachedObjectMixin):
self.cache_set()
+<<<<<<< Updated upstream
def cache_set(self, *args, **kwargs):
val = kwargs.pop('value', self)
key = self.cache_key(*args, **kwargs)
@@ -132,6 +139,8 @@ class Setting(models.Model, CachedObjectMixin):
length = getattr(settings, 'LIVESETTINGS_CACHE_TIMEOUT', settings.CACHE_TIMEOUT)
cache_set(key, value=val, length=length)
+=======
+>>>>>>> Stashed changes
class Meta:
unique_together = ('site', 'group', 'key')
@@ -172,6 +181,7 @@ class LongSetting(models.Model, CachedObjectMixin):
super(LongSetting, self).save(force_insert=force_insert, force_update=force_update)
self.cache_set()
+<<<<<<< Updated upstream
def cache_set(self, *args, **kwargs):
val = kwargs.pop('value', self)
key = self.cache_key(*args, **kwargs)
@@ -179,6 +189,8 @@ class LongSetting(models.Model, CachedObjectMixin):
length = getattr(settings, 'LIVESETTINGS_CACHE_TIMEOUT', settings.CACHE_TIMEOUT)
cache_set(key, value=val, length=length)
+=======
+>>>>>>> Stashed changes
class Meta:
unique_together = ('site', 'group', 'key')
diff --git a/askbot/deps/livesettings/overrides.py b/askbot/deps/livesettings/overrides.py
index f3dc3355..c2fc09df 100644
--- a/askbot/deps/livesettings/overrides.py
+++ b/askbot/deps/livesettings/overrides.py
@@ -35,7 +35,7 @@ def get_overrides(siteid=-1):
}
}
- In the settings dict above, the "val" entries must exactly match the format
+ In the settings dict above, the "val" entries must exactly match the format
stored in the database for a setting. Do not use a literal True or an integer,
it needs to be the string representation of them.
@@ -45,7 +45,7 @@ def get_overrides(siteid=-1):
if hasattr(djangosettings, 'LIVESETTINGS_OPTIONS'):
if siteid == -1:
siteid = _safe_get_siteid(None)
-
+
opts = djangosettings.LIVESETTINGS_OPTIONS
if opts.has_key(siteid):
opts = opts[siteid]