Patchwork [1,of,7] hgweb: prefix private variables of sessionvars with '_'

login
register
mail settings
Submitter Yuya Nishihara
Date April 14, 2018, 12:49 p.m.
Message ID <7b406ab5b3e9c3da9527.1523710151@mimosa>
Download mbox | patch
Permalink /patch/31022/
State Accepted
Headers show

Comments

Yuya Nishihara - April 14, 2018, 12:49 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1522591382 -32400
#      Sun Apr 01 23:03:02 2018 +0900
# Node ID 7b406ab5b3e9c3da9527a3001ba62e29506bd73a
# Parent  34cde18a454484a1cf6e716a3325ca9282277d59
hgweb: prefix private variables of sessionvars with '_'

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -653,17 +653,17 @@  def diffstat(tmpl, ctx, statgen, parity)
 
 class sessionvars(object):
     def __init__(self, vars, start='?'):
-        self.start = start
-        self.vars = vars
+        self._start = start
+        self._vars = vars
     def __getitem__(self, key):
-        return self.vars[key]
+        return self._vars[key]
     def __setitem__(self, key, value):
-        self.vars[key] = value
+        self._vars[key] = value
     def __copy__(self):
-        return sessionvars(copy.copy(self.vars), self.start)
+        return sessionvars(copy.copy(self._vars), self._start)
     def __iter__(self):
-        separator = self.start
-        for key, value in sorted(self.vars.iteritems()):
+        separator = self._start
+        for key, value in sorted(self._vars.iteritems()):
             yield {'name': key,
                    'value': pycompat.bytestr(value),
                    'separator': separator,