diff rhodecode/model/db.py @ 3018:023f7873ef59 beta

added caching layer into RSS/ATOM feeds - updated code for new LimitedDiffContainers - invalidate rss/atom cache keys on push -
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 23 Nov 2012 11:54:14 +0100
parents 78227b65a358
children 00498b3e4c88
line wrap: on
line diff
--- a/rhodecode/model/db.py	Thu Nov 22 23:04:34 2012 +0100
+++ b/rhodecode/model/db.py	Fri Nov 23 11:54:14 2012 +0100
@@ -46,7 +46,7 @@
 from rhodecode.lib.vcs.utils.lazy import LazyProperty
 
 from rhodecode.lib.utils2 import str2bool, safe_str, get_changeset_safe, \
-    safe_unicode
+    safe_unicode, remove_suffix
 from rhodecode.lib.compat import json
 from rhodecode.lib.caching_query import FromCache
 
@@ -941,6 +941,7 @@
 
     @LazyProperty
     def scm_instance(self):
+        return self.scm_instance_cached()
         return self.__get_instance()
 
     def scm_instance_cached(self, cache_map=None):
@@ -1440,7 +1441,11 @@
         iid = rhodecode.CONFIG.get('instance_id')
         if iid:
             prefix = iid
-        return "%s%s" % (prefix, key), prefix, key.rstrip('_README')
+        #remove specific suffixes like _README or _RSS
+        key = remove_suffix(key, '_README')
+        key = remove_suffix(key, '_RSS')
+        key = remove_suffix(key, '_ATOM')
+        return "%s%s" % (prefix, key), prefix, key
 
     @classmethod
     def get_by_key(cls, key):