class HttpDbDispatcher(object): """ this is our custom dispatcher which strips out the database name (first url part) and pass the rest of the url to the default dispatcher """ dispatcher = Dispatcher() def __call__(self, path_info): list = path_info.strip('/').split('/', 1) #handle root url if len(list) < 2: self.dispatcher("/") return DBNAME = list[0] self.dispatcher(list[1])
def __init__(self, prefixes, enc, next_dispatcher=Dispatcher()): self.prefixes = prefixes self.enc = enc self.next_dispatcher = next_dispatcher