# HG changeset patch # User Tero Marttila # Date 1412359679 -10800 # Node ID 7bd8d6062c9e32200720ae2dc952bc0bacf1fe92 # Parent dfd8022d000eac6fe870850e2586c2122e1080b0 pngtile.application: url(): helper to construct urls diff -r dfd8022d000e -r 7bd8d6062c9e pngtile/application.py --- a/pngtile/application.py Mon Sep 15 01:48:29 2014 +0300 +++ b/pngtile/application.py Fri Oct 03 21:07:59 2014 +0300 @@ -1,10 +1,19 @@ from werkzeug import Request, Response, exceptions from werkzeug.utils import html +import werkzeug.urls import pypngtile import os.path +def url (server, *path, **args): + """ + >>> url('http://foo/', 'bar, 'quux.png', x=5, y=2) + 'http://foo/bar/quux.png?x=5&y=2' + """ + + return werkzeug.urls.Href(server)(*path, **args) + class BaseApplication (object): IMAGE_TYPES = ( 'png',