Optimize _Saverdict.update that caused issues for webclient option update (#2224)

This commit is contained in:
Griatch 2020-11-01 11:19:14 +01:00
parent 965dffa2b7
commit 6f3548eea9
5 changed files with 10 additions and 5 deletions

View file

@ -389,7 +389,7 @@ gaming style you like and possibly any new ones you can come up with!
(aka MUDs, MUSHes, MUX, MOOs...). It is open-source and |wfree to use|n, also for
commercial projects (BSD license).
Out of the box, Evennia provides a |wfull, if empty game|n. Whereas you can play
Out of the box, Evennia provides a |wworking, if empty game|n. Whereas you can play
via traditional telnet MUD-clients, the server runs your game's website and
offers a |wHTML5 webclient|n so that people can play your game in their browser
without downloading anything extra.

View file

@ -93,7 +93,7 @@ class MonitorHandler(object):
def at_update(self, obj, fieldname):
"""
Called by the field as it saves.
Called by the field/attribute as it saves.
"""
to_delete = []

View file

@ -522,9 +522,8 @@ def webclient_options(session, *args, **kwargs):
session=session,
)
else:
# kwargs provided: persist them to the account object
for key, value in kwargs.items():
clientoptions[key] = value
# kwargs provided: persist them to the account object.
clientoptions.update(kwargs)
# OOB protocol-specific aliases and wrappers

View file

@ -300,6 +300,10 @@ class _SaverDict(_SaverMutable, MutableMapping):
def has_key(self, key):
return key in self._data
@_save
def update(self, *args, **kwargs):
self._data.update(*args, **kwargs)
class _SaverSet(_SaverMutable, MutableSet):
"""

View file

@ -268,12 +268,14 @@ An "emitter" object must have a function
// Parse the incoming data, send to emitter
// Incoming data is on the form [cmdname, args, kwargs]
data = JSON.parse(data);
// console.log(" server->client:", data)
Evennia.emit(data[0], data[1], data[2]);
};
}
var msg = function(data) {
// send data across the wire. Make sure to json it.
// console.log("client->server:", data)
websocket.send(JSON.stringify(data));
};