예제 #1
0
파일: locator.py 프로젝트: c3nav/c3nav
 def load(cls):
     from c3nav.mapdata.models import MapUpdate
     update = MapUpdate.last_processed_update()
     if cls.cache_update != update:
         with cls.cache_lock:
             cls.cache_update = update
             cls.cached = cls.load_nocache(update)
     return cls.cached
예제 #2
0
 def load(cls):
     from c3nav.mapdata.models import MapUpdate
     update = MapUpdate.last_processed_update()
     if cls.cache_update != update:
         with cls.cache_lock:
             cls.cache_update = update
             cls.cached = cls.load_nocache(update)
     return cls.cached
예제 #3
0
 def open(cls, filename, default_update=None):
     try:
         instance = super().open(filename)
     except FileNotFoundError:
         if default_update is None:
             from c3nav.mapdata.models import MapUpdate
             default_update = MapUpdate.last_processed_update()
         instance = cls(updates=[default_update], filename=filename)
         instance.save()
     return instance
예제 #4
0
 def open(cls, filename, default_update=None):
     try:
         instance = super().open(filename)
     except FileNotFoundError:
         if default_update is None:
             from c3nav.mapdata.models import MapUpdate
             default_update = MapUpdate.last_processed_update()
         instance = cls(updates=[default_update], filename=filename)
         instance.save()
     return instance