Skip to content

Commit 0a2e7ef

Browse files
committed
Review fixes
1 parent a1e9a0b commit 0a2e7ef

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

python/Glacier2/session/server/poke_session/box.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import CatchThemAll
66
import Ice
77

8-
from .user_id_resolver import UserIdResolver
98
from .store import PokeStore
9+
from .user_id_resolver import UserIdResolver
1010

1111

1212
class SharedPokeBox(CatchThemAll.PokeBox):
1313
"""
1414
SharedPokeBox is an Ice servant that implements Slice interface PokeBox. The same shared servant
15-
implements all PokeBox objects; this is doable because all the state is stored in the IPokeStore.
15+
implements all PokeBox objects; this is doable because all the state is stored in the PokeStore.
1616
"""
1717

1818
def __init__(self, pokeStore: PokeStore, userIdResolver: UserIdResolver):
@@ -43,7 +43,7 @@ def caught(self, pokemon: list[str], current: Ice.Current) -> None:
4343
"""
4444
Add new Pokémon to the Pokémon collection for the user associated with the current session.
4545
"""
46-
userId = self.getUserId(current)
46+
userId = self.getUserId(current.id.name)
4747

4848
# Retrieve the existing collection for the user and add the new Pokémon.
4949
savedPokemon = list(self._pokeStore.retrieveCollection(userId) or [])
@@ -57,9 +57,8 @@ def caught(self, pokemon: list[str], current: Ice.Current) -> None:
5757
def releaseAll(self, current: Ice.Current) -> None:
5858
self._pokeStore.saveCollection(self.getUserId(current), [])
5959

60-
@override
61-
def getUserId(self, current: Ice.Current) -> str:
62-
userId = self._userIdResolver.getUserId(current.id.name)
60+
def getUserId(self, token: str) -> str:
61+
userId = self._userIdResolver.getUserId(token)
6362
if userId is None:
6463
raise Ice.DispatchException(Ice.ReplyStatus.Unauthorized.value, "Invalid session token")
6564
return userId

python/Glacier2/session/server/poke_session/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(
2828
The object adapter that hosts this servant and the PokeBox objects.
2929
sessionControl : Glacier2.SessionControlPrx
3030
The session control proxy.
31-
userIdResolver : IUserIdResolver
31+
userIdResolver : UserIdResolver
3232
The user ID resolver.
3333
"""
3434
self._adapter = adapter

python/Glacier2/session/slice/PokeBox.ice

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) ZeroC, Inc.
22

3-
// Include the Glacier/Session.ice file included in the Glacier2 NuGet package.
3+
// Include the Glacier/Session.ice file included in the zeroc-ice pip package.
44
#include <Glacier2/Session.ice>
55

66
module CatchThemAll

0 commit comments

Comments
 (0)