hgweb: lift {sessionvars} to a wrapped type
Since a sessionvars object is updated in-place, we can't simply wrap it by
mappinglist.
--- a/mercurial/hgweb/webutil.py Sun Apr 01 23:03:58 2018 +0900
+++ b/mercurial/hgweb/webutil.py Sun Apr 01 23:12:37 2018 +0900
@@ -651,7 +651,7 @@
'parity': next(parity),
})
-class sessionvars(object):
+class sessionvars(templateutil.wrapped):
def __init__(self, vars, start='?'):
self._start = start
self._vars = vars
@@ -665,7 +665,7 @@
def __copy__(self):
return sessionvars(copy.copy(self._vars), self._start)
- def __iter__(self):
+ def itermaps(self, context):
separator = self._start
for key, value in sorted(self._vars.iteritems()):
yield {'name': key,
@@ -674,6 +674,16 @@
}
separator = '&'
+ def join(self, context, mapping, sep):
+ # could be '{separator}{name}={value|urlescape}'
+ raise error.ParseError(_('not displayable without template'))
+
+ def show(self, context, mapping):
+ return self.join(context, '')
+
+ def tovalue(self, context, mapping):
+ return self._vars
+
class wsgiui(uimod.ui):
# default termwidth breaks under mod_wsgi
def termwidth(self):