@@ -70,21 +70,11 @@ def app_reverse(viewname, urlconf=None, args=None, kwargs=None, prefix=None,
7070 appconfig = extra_context .get ('app_config' , {})
7171 urlconf = appconfig .get ('urlconf_path' , urlconf )
7272
73- cache_generation = cache .get (APP_REVERSE_CACHE_GENERATION_KEY )
74- if cache_generation is None :
75- # This might never happen. Still, better be safe than sorry.
76- cache_generation = cycle_app_reverse_cache ()
77-
78- cache_key = 'FEINCMS:%s:APPCONTENT:L%s:U%s:G%s' % (
79- getattr (settings , 'SITE_ID' , 0 ),
80- get_language (),
81- urlconf ,
82- cache_generation )
83-
73+ appcontent_class = ApplicationContent ._feincms_content_models [0 ]
74+ cache_key = appcontent_class .app_reverse_cache_key (urlconf )
8475 url_prefix = cache .get (cache_key )
8576
8677 if url_prefix is None :
87- appcontent_class = ApplicationContent ._feincms_content_models [0 ]
8878 content = appcontent_class .closest_match (urlconf )
8979
9080 if content is not None :
@@ -379,6 +369,19 @@ def _update_response_headers(self, request, response, headers):
379369 if len (lm_list ) > 0 :
380370 response ['Expires' ] = http_date (mktime (min (lm_list )))
381371
372+ @classmethod
373+ def app_reverse_cache_key (self , urlconf_path , ** kwargs ):
374+ cache_generation = cache .get (APP_REVERSE_CACHE_GENERATION_KEY )
375+ if cache_generation is None :
376+ # This might never happen. Still, better be safe than sorry.
377+ cache_generation = cycle_app_reverse_cache ()
378+
379+ return 'FEINCMS:%s:APPCONTENT:L%s:U%s:G%s' % (
380+ getattr (settings , 'SITE_ID' , 0 ),
381+ get_language (),
382+ urlconf_path ,
383+ cache_generation )
384+
382385 @classmethod
383386 def closest_match (cls , urlconf_path ):
384387 page_class = cls .parent .field .rel .to
0 commit comments