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
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