I've been using some code to add characters to channels. It works but has unexpected side effects. For example,
channel = find_channel(caller, "Corinth")
channel.connect(caller)
This successfully adds a character/player to a channel but when I use the
channels command, it lists the channel as not being subscribed too. I tried making new test characters and the channel arrangement seemed to carry across characters, which does seem to confirm that it's using players and not characters. Worse though, I get this error if I try to addcom and delcom a channel again and use aliases for it:
ct test
Traceback (most recent call last):
File "/home/ubuntu/muddev/evennia/evennia/commands/cmdhandler.py", line 741, in cmdhandler
error_to.msg(exc.sysarg)
File "/home/ubuntu/muddev/evennia/evennia/objects/objects.py", line 526, in msg
session.data_out(text=text, **kwargs)
File "/home/ubuntu/muddev/evennia/evennia/server/serversession.py", line 378, in data_out
self.sessionhandler.data_out(self, **kwargs)
File "/home/ubuntu/muddev/evennia/evennia/server/sessionhandler.py", line 704, in data_out
**kwargs)
File "/home/ubuntu/muddev/evennia/evennia/server/amp.py", line 485, in send_MsgServer2Portal
return self.send_data(MsgServer2Portal, session.sessid, **kwargs)
File "/home/ubuntu/muddev/evennia/evennia/server/amp.py", line 421, in send_data
packed_data=dumps((sessid, kwargs))
File "/home/ubuntu/muddev/evennia/evennia/server/amp.py", line 322, in <lambda>
dumps = lambda data: to_str(pickle.dumps(to_str(data), pickle.HIGHEST_PROTOCOL))
TypeError: 'NoneType' object is not callable
Looking at this code also seems to suggest it's player specific, although the terms are somewhat vague I've noticed. From comms.py in /comms/:
Notes:
This will first try Player subscribers and only try Object
if the Player fails.
"""
has_sub = self.subscriptions.has(subscriber)
if not has_sub and hasattr(subscriber, "player"):
# it's common to send an Object when we
# by default only allow Players to subscribe.
has_sub = self.subscriptions.has(subscriber.player)
return has_sub
So what I think I need here (I'm not positive though) is to get channels to attach to character objects and not to players, at which point the default commands will hopefully start performing as I expect. If people understand what I'm saying here and know what should be changed to get this happening, let me know, thanks :D
Edit: models in /comms/ seems like one possible place where this code could be found but it seems like a pretty difficult issue for me... possibly around here?
for subscriber in make_iter(entity):
if subscriber:
clsname = subscriber.__dbclass__.__name__
# chooses the right type
if clsname == "ObjectDB":
self.obj.db_object_subscriptions.add(subscriber)
elif clsname == "PlayerDB":
self.obj.db_subscriptions.add(subscriber)