Show
Ignore:
Timestamp:
05/23/08 12:53:25 (2 years ago)
Author:
PerttuRantaaho
Message:

Refractored models.py to models package.
Moved delete_page_cache() from models.py to system.utils.
Dropped obsolete Preferences model. Updated unit tests and other code which still imported Prefereces.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid/PyLucid/system/utils.py

    r1409 r1584  
    2020 
    2121from django.conf import settings 
     22from django.core.cache import cache 
     23 
     24def delete_page_cache(): 
     25    """ 
     26    Delete all pages in the cache. 
     27    Needed, if: 
     28        - A template has been edited 
     29        - The menu changes (edit the page name, position, parent link) 
     30    TODO: move this function from models.py into a other nice place... 
     31    """ 
     32    from PyLucid.models import Page 
     33    for items in Page.objects.values('shortcut').iterator(): 
     34        shortcut = items["shortcut"] 
     35        cache_key = settings.PAGE_CACHE_PREFIX + shortcut 
     36        cache.delete(cache_key) 
    2237 
    2338def setup_debug(request):