From 634c914f6de11007ddb11d08d07071cdde3477b5 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sat, 25 Apr 2015 13:54:42 -0500 Subject: [PATCH] dispatch: routing: Remove Generator class --- src/milla/dispatch/routing.py | 40 ----------------------------------- 1 file changed, 40 deletions(-) diff --git a/src/milla/dispatch/routing.py b/src/milla/dispatch/routing.py index 7618b5a..f502384 100644 --- a/src/milla/dispatch/routing.py +++ b/src/milla/dispatch/routing.py @@ -205,43 +205,3 @@ class Router(object): controller = self._import_controller(controller) self.routes.append((self._compile_template(template), controller, vars)) - -class Generator(object): - '''URL generator - - Creates URL references based on a *WebOb* request. - - Typical usage: - - >>> generator = Generator(request) - >>> generator.generate('foo', 'bar') - '/foo/bar' - - A common pattern is to wrap this in a stub function:: - - url = Generator(request).generate - - .. deprecated:: 0.2 - Use :py:meth:`milla.Request.create_href` instead. - ''' - - def __init__(self, request, path_only=True): - self.request = request - self.path_only = path_only - warnings.warn( - 'Use of Generator is deprecated; ' - 'use milla.Request.create_href instead', - DeprecationWarning, - stacklevel=2 - ) - - def generate(self, *segments, **vars): - '''Combines segments and the application's URL into a new URL - ''' - - path = '/'.join(str(s) for s in segments) - - if self.path_only: - return self.request.create_href(path, **vars) - else: - return self.request.create_href_full(path, **vars)