From 2c0c9eec76afd66b43ee313a2364d12dfcc87516 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 15 Jun 2015 16:08:04 +0530 Subject: [PATCH] ... --- src/calibre/srv/routes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/srv/routes.py b/src/calibre/srv/routes.py index ba51db5b07..4e381b163c 100644 --- a/src/calibre/srv/routes.py +++ b/src/calibre/srv/routes.py @@ -168,9 +168,11 @@ class Route(object): if isinstance(x, unicode): x = x.encode('utf-8') return urlquote(x, '') - args = {k:quoted(v) for k, v in kwargs.iteritems()} + args = {k:'' for k in self.defaults} + args.update(kwargs) + args = {k:quoted(v) for k, v in args.iteritems()} route = self.var_pat.sub(lambda m:'{%s}' % m.group(1).partition('=')[0].lstrip('+'), self.endpoint.route) - return route.format(**args) + return route.format(**args).rstrip('/') def __str__(self): return self.endpoint.route