- commit
- 0fa6a17d2f1942d7b2d96e55f11b09a6123d87f5
- parent
- 9346311cc189b86ccdd71b2aabda98b9bd1b4fd9
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2014-10-05 21:39
rm example actions no longer needed because we have actual actions.
Diffstat
| M | laneya/actions.py | 8 | -------- |
| M | laneya/client.py | 10 | ---------- |
| M | laneya/server.py | 8 | ++------ |
3 files changed, 2 insertions, 24 deletions
diff --git a/laneya/actions.py b/laneya/actions.py
@@ -8,14 +8,6 @@ The actual processing of actions happens in the server and client. 8 8 """ 9 9 10 1011 -1 def echo(foo=''):12 -1 """Example server action."""13 -114 -115 -1 def other(foo=''):16 -1 """Example client action."""17 -118 -119 11 def move(direction=None): 20 12 """Start moving in the defined direction. 21 13
diff --git a/laneya/client.py b/laneya/client.py
@@ -9,10 +9,6 @@ import protocol 9 9 import deferred as q 10 10 11 1112 -1 def _print(s):13 -1 print(s)14 -115 -116 12 class ClientProtocol(protocol.ClientProtocol): 17 13 def updateReceived(self, action, **kwargs): # TODO 18 14 print(action, kwargs) @@ -24,12 +20,6 @@ class ClientProtocol(protocol.ClientProtocol): 24 20 def connected(protocol): # TODO 25 21 protocol.setup('testuser') 26 2227 -1 protocol.sendRequest('echo', foo='bar')\28 -1 .then(_print, log.err)29 -130 -1 protocol.sendRequest('other', foo='bar')\31 -1 .then(_print, log.err)32 -133 23 protocol.move('south') 34 24 reactor.callLater(2, lambda: protocol.move('west')) 35 25 reactor.callLater(4, lambda: protocol.move('north'))
diff --git a/laneya/server.py b/laneya/server.py
@@ -25,9 +25,7 @@ class Server(protocol.ServerProtocolFactory): 25 25 self.users[user] = User() 26 26 print("login %s" % user) 27 2728 -1 if action == 'echo':29 -1 return kwargs30 -1 elif action == 'move':-1 28 if action == 'move': 31 29 self.users[user].direction = kwargs['direction'] 32 30 return {} 33 31 elif action == 'logout': @@ -35,9 +33,7 @@ class Server(protocol.ServerProtocolFactory): 35 33 print("logout %s" % user) 36 34 return {} 37 35 else:38 -1 self.broadcastUpdate(action, **kwargs)39 -1 reactor.callLater(5, self.broadcastUpdate, action, **kwargs)40 -1 return {}-1 36 raise protocol.InvalidError 41 37 42 38 def mainloop(self): 43 39 for key, user in self.users.iteritems():