1. Rodrigo Fonseca
  2. sesc.py

Commits

Rodrigo Fonseca  committed d55f449

NEW: Decoupled program version from cache version. Now new program versions won't necessary invalidate previous cache.

  • Participants
  • Parent commits 1b44ae2
  • Branches default
  • Tags 2.0b2

Comments (0)

Files changed (1)

File sesc.py

View file
 # But do not edit below this point, if you don't know what you are doing
 
 locale.setlocale(locale.LC_ALL, '')
-context = {'version' : __version__}
+cache_version = 2
+context = {'version' : cache_version}
 quiet = True
 key_format = '%Y-%m-%d'
 date_format = '%d/%m/%Y'
 
     def version():
         write('Versão do programa: %s' % __version__)
+        write('Versão do cache: %s' % cache_version)
         return 100
 
     global context, quiet, date_format
 
     load(context_file)
 
-    if __version__ != context.get('version'):
+    if cache_version != context.get('version'):
         log('Versão do cache inconsistente. Limpando cache...')
         if os.path.exists(context_file):
             os.remove(context_file)
-        context = {'version' : __version__}
+        context = {'version' : cache_version}
 
     if unit in context and time.strptime(key, key_format) < time.strptime(context[unit]['from'], key_format):
         write('')