# Path: TileStache/py3_compat.py
# def is_string_type(val):


import logging
import TileStache
	from json import load as json_load
	from simplejson import load as json_load
from TileStache.py3_compat import urlopen
			# KnownUnknown seems like the appropriate thing to raise here since this is akin
			# to a missing configuration.
			raise TileStache.KnownUnknown("Failed to parse JSON configuration for %s", key)

class ExternalConfiguration:

	def __init__(self, url_root, cache_dict, cache_responses, dirpath):
		self.cache = TileStache.Config._parseConfigCache(cache_dict, dirpath)
		self.dirpath = dirpath
		self.layers = DynamicLayers(self, url_root, cache_responses, dirpath)

class WSGIServer (TileStache.WSGITileServer):

	"""
		Wrap WSGI application, passing it a custom configuration.

		The WSGI application is an instance of TileStache:WSGITileServer.

		This method is initiated with a url_root that contains the scheme, host, port
		and path that must prefix the API calls on our local server.  Any valid http
		or https urls should work.

		The cache_responses parameter tells TileStache to cache all responses from
		the configuration server.
	"""

	def __init__(self, url_root, cache_responses=True, debug_level="DEBUG"):
		logging.basicConfig(level=debug_level)

		# Call API server at url to grab cache_dict

# Path: TileStache/py3_compat.py
# def is_string_type(val):


# Path: TileStache/Goodies/ExternalConfigServer.py
import logging
import TileStache
	from json import load as json_load
	from simplejson import load as json_load
from TileStache.py3_compat import urlopen

			# KnownUnknown seems like the appropriate thing to raise here since this is akin
			# to a missing configuration.
			raise TileStache.KnownUnknown("Failed to parse JSON configuration for %s", key)

class ExternalConfiguration:

	def __init__(self, url_root, cache_dict, cache_responses, dirpath):
		self.cache = TileStache.Config._parseConfigCache(cache_dict, dirpath)
		self.dirpath = dirpath
		self.layers = DynamicLayers(self, url_root, cache_responses, dirpath)

class WSGIServer (TileStache.WSGITileServer):

	"""
		Wrap WSGI application, passing it a custom configuration.

		The WSGI application is an instance of TileStache:WSGITileServer.

		This method is initiated with a url_root that contains the scheme, host, port
		and path that must prefix the API calls on our local server.  Any valid http
		or https urls should work.

		The cache_responses parameter tells TileStache to cache all responses from
		the configuration server.
	"""

	def __init__(self, url_root, cache_responses=True, debug_level="DEBUG"):
		logging.basicConfig(level=debug_level)

		# Call API server at url to grab cache_dict

		cache_dict = json_load(urlopen(url_root + "/cache"))