Exemplo n.º 1
0
    def __init__(self, empty_size=334, **kwargs):
        """ Initialize the SparseCache
            334 is the file size of a 256x256 transparent PNG
        """
        # TODO support multiple sizes
        self.empty_size = empty_size

        return Disk.__init__(self, **kwargs)
Exemplo n.º 2
0
    def __init__(self, land='', sea='', second=None, **kwargs):
        self.land_md5 = land
        self.sea_md5 = sea
        self.second = LayerStub(second)

        return Disk.__init__(self, **kwargs)
Exemplo n.º 3
0
            "dirs": "portable",
            "gzip": ["xml", "json"]
        }
      }
"""


import os
import hashlib

from os.path import join as pathjoin
from TileStache.Caches import Disk

class Cache (Disk):
    def __init__(self, path, umask=0022, dirs='safe', gzip='txt text json xml'.split(), pattern='**/**'):
        Disk.__init__(self, path, umask, dirs, gzip)
        self.pattern = pattern
    
    def _fullpath(self, layer, coord, format):
        """
        """
        filepath = self._filepath(layer, coord, format)
        
        l = layer.name()
        
        md5_layer = hashlib.md5(l).hexdigest();
        pattern_list = self.pattern.split('/')
        folder_list = []
        index = 0 
        for i in range(0, len(pattern_list)):
            folder_length = len(pattern_list[i])