Merge ~cjwatson/launchpad:pgsession-mutable-mapping into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: e25623c84a4c9e50bf554bb6dd40384d23965a6b
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:pgsession-mutable-mapping
Merge into: launchpad:master
Diff against target: 38 lines (+7/-4)
1 file modified
lib/lp/services/webapp/pgsession.py (+7/-4)
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
Review via email: mp+379791@code.launchpad.net

Commit message

Convert PGSessionPkgData to collections.MutableMapping

Description of the change

UserDict doesn't exist in Python 3.

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/services/webapp/pgsession.py b/lib/lp/services/webapp/pgsession.py
2index a11fedb..eefdd2a 100644
3--- a/lib/lp/services/webapp/pgsession.py
4+++ b/lib/lp/services/webapp/pgsession.py
5@@ -5,9 +5,9 @@
6
7 __metaclass__ = type
8
9+from collections import MutableMapping
10 import hashlib
11 import time
12-from UserDict import DictMixin
13
14 from lazr.restful.utils import get_current_browser_request
15 from six.moves import cPickle as pickle
16@@ -162,7 +162,7 @@ class PGSessionData(PGSessionBase):
17
18
19 @implementer(ISessionPkgData)
20-class PGSessionPkgData(DictMixin, PGSessionBase):
21+class PGSessionPkgData(MutableMapping, PGSessionBase):
22
23 @property
24 def store(self):
25@@ -229,8 +229,11 @@ class PGSessionPkgData(DictMixin, PGSessionBase):
26 ensure_unicode(key)),
27 noresult=True)
28
29- def keys(self):
30- return self._data_cache.keys()
31+ def __iter__(self):
32+ return iter(self._data_cache)
33+
34+ def __len__(self):
35+ return len(self._data_cache)
36
37
38 data_container = PGSessionDataContainer()

Subscribers

People subscribed via source and target branches

to status/vote changes: