[Tilecache] dynamic config

Eric Lemoine eric.c2c at gmail.com
Wed Feb 13 00:40:51 EST 2008


Hi Attila

On Feb 12, 2008 10:33 PM, Attila Csipa <plists at prometheus.org.yu> wrote:
> I needed to do some dynamic config generation for tilecache (add new layers on
> the fly, per user layers, etc), so here is the option to include additional
> config files, or, recursively, whole directories.

I'm wondering: if you run TileCache under mod_python, will it be able
to see new config files added to tilecache.conf.d between two Apache
reloads?

Thanks,
--
Eric

>
>
> Index: tilecache/tilecache.cfg
> ===================================================================
> --- tilecache/tilecache.cfg     (revision 253)
> +++ tilecache/tilecache.cfg     (working copy)
> @@ -13,6 +13,10 @@
>  #[metadata]
>  #crossdomain_sites=openstreetmap.org,openaerialmap.org
>
> +# Another metadata option is to include additional files or directories in
> +# your config (f.e. per layer or per user config files)
> +#includeconf=/etc/tilecache.conf.d,/var/www/userlayers/public.conf
> +
>  # [cache] section examples: (mandatory!)
>  #
>  # Disk:
> Index: tilecache/TileCache/Service.py
> ===================================================================
> --- tilecache/TileCache/Service.py      (revision 253)
> +++ tilecache/TileCache/Service.py      (working copy)
> @@ -94,6 +94,17 @@
>
>              cache = cls.loadFromSection(config, "cache", Cache)
>
> +            if metadata.has_key('includeconf'):
> +                files = list(files)
> +                for path in metadata['includeconf'].split(","):
> +                    if os.path.isfile(path):
> +                        files.append(path)
> +                    elif os.path.isdir(path):
> +                        for (root, dir, file) in os.walk(path):
> +                            for name in file:
> +                                files.append(os.path.join(root, name))
> +                config.read(files)
> +
>              layers = {}
>              for section in config.sections():
>                  if section in cls.__slots__: continue
> _______________________________________________
> Tilecache mailing list
> Tilecache at openlayers.org
> http://openlayers.org/mailman/listinfo/tilecache
>



More information about the Tilecache mailing list