mirror of
https://github.com/evennia/evennia.git
synced 2026-04-04 23:17:17 +02:00
Fix some formatting affected by the space conversion. IMPORTANT: Channel list attributes are now stored via Django's bundled version of simplejson instead of cPickle/pickle. Pickle isn't unicode-capable in 2.5 and lower, plus JSON is going to be a lot more accessible for web-stuff.
This commit is contained in:
parent
ffe9a563e0
commit
131f6410d4
6 changed files with 22 additions and 21 deletions
|
|
@ -95,7 +95,7 @@ def cmd_comlist(cdat):
|
|||
"""
|
||||
session = cdat['session']
|
||||
|
||||
session.msg("Alias Channel Status")
|
||||
session.msg("Alias Channel Status")
|
||||
for chan in session.channels_subscribed:
|
||||
if session.channels_subscribed[chan][1]:
|
||||
chan_on = "On"
|
||||
|
|
@ -131,9 +131,9 @@ def cmd_clist(cdat):
|
|||
Lists all available channels on the game.
|
||||
"""
|
||||
session = cdat['session']
|
||||
session.msg("** Channel Owner Description")
|
||||
session.msg("** Channel Owner Description")
|
||||
for chan in functions_comsys.get_all_channels():
|
||||
session.msg("%s%s %-13.13s %-15.15s %-45.45s" %
|
||||
session.msg("%s%s %-13.13s %-15.15s %-45.45s" %
|
||||
('-', '-', chan.get_name(), chan.get_owner().get_name(), 'No Description'))
|
||||
session.msg("-- End of Channel List --")
|
||||
|
||||
|
|
|
|||
|
|
@ -415,9 +415,9 @@ def cmd_who(cdat):
|
|||
# Only those with the see_session_data or superuser status can see
|
||||
# session details.
|
||||
if show_session_data:
|
||||
retval = "Player Name On For Idle Room Cmds Host\n\r"
|
||||
retval = "Player Name On For Idle Room Cmds Host\n\r"
|
||||
else:
|
||||
retval = "Player Name On For Idle\n\r"
|
||||
retval = "Player Name On For Idle\n\r"
|
||||
|
||||
for player in session_list:
|
||||
if not player.logged_in:
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ def cmd_list(cdat):
|
|||
loadvg = os.getloadavg()
|
||||
psize = resource.getpagesize()
|
||||
rusage = resource.getrusage(resource.RUSAGE_SELF)
|
||||
session.msg("Process ID: %10d %10d bytes per page" % (os.getpid(), psize))
|
||||
session.msg("Time used: %10d user %10d sys" % (rusage[0],rusage[1]))
|
||||
session.msg("Integral mem:%10d shared %10d private%10d stack" % (rusage[3], rusage[4], rusage[5]))
|
||||
session.msg("Max res mem: %10d pages %10d bytes" % (rusage[2],rusage[2] * psize))
|
||||
session.msg("Page faults: %10d hard %10d soft %10d swapouts" % (rusage[7], rusage[6], rusage[8]))
|
||||
session.msg("Disk I/O: %10d reads %10d writes" % (rusage[9], rusage[10]))
|
||||
session.msg("Process ID: %10d %10d bytes per page" % (os.getpid(), psize))
|
||||
session.msg("Time used: %10d user %10d sys" % (rusage[0],rusage[1]))
|
||||
session.msg("Integral mem:%10d shared %10d private%10d stack" % (rusage[3], rusage[4], rusage[5]))
|
||||
session.msg("Max res mem: %10d pages %10d bytes" % (rusage[2],rusage[2] * psize))
|
||||
session.msg("Page faults: %10d hard %10d soft %10d swapouts" % (rusage[7], rusage[6], rusage[8]))
|
||||
session.msg("Disk I/O: %10d reads %10d writes" % (rusage[9], rusage[10]))
|
||||
session.msg("Network I/O: %10d in %10d out" % (rusage[12], rusage[11]))
|
||||
session.msg("Context swi: %10d vol %10d forced %10d sigs" % (rusage[14], rusage[15], rusage[13]))
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import cPickle as pickle
|
||||
import time, datetime
|
||||
|
||||
from django.utils import simplejson
|
||||
|
||||
from apps.objects.models import CommChannel, CommChannelMessage
|
||||
import session_mgr
|
||||
import ansi
|
||||
|
|
@ -125,7 +126,7 @@ def plr_set_channel_listening(session, alias, listening):
|
|||
listening: (bool) A True or False value to determine listening status.
|
||||
"""
|
||||
plr_get_cdict(session).get(alias)[1] = listening
|
||||
plr_pickle_channels(session)
|
||||
plr_jsondump_channels(session)
|
||||
|
||||
def plr_set_channel(session, alias, cname, listening):
|
||||
"""
|
||||
|
|
@ -138,15 +139,15 @@ def plr_set_channel(session, alias, cname, listening):
|
|||
listening: (bool) A True or False value to determine listening status.
|
||||
"""
|
||||
plr_get_cdict(session)[alias] = [cname, listening]
|
||||
plr_pickle_channels(session)
|
||||
plr_jsondump_channels(session)
|
||||
|
||||
def plr_pickle_channels(session):
|
||||
def plr_jsondump_channels(session):
|
||||
"""
|
||||
Save the player's channel list to the CHANLIST attribute.
|
||||
|
||||
session: (SessionProtocol) A reference to the player session.
|
||||
"""
|
||||
session.get_pobject().set_attribute("CHANLIST", pickle.dumps(plr_get_cdict(session)))
|
||||
session.get_pobject().set_attribute("CHANLIST", simplejson.dumps(plr_get_cdict(session)))
|
||||
|
||||
def plr_del_channel(session, alias):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
from traceback import format_exc
|
||||
|
||||
from apps.config.models import ConfigValue, ConnectScreen
|
||||
from apps.config.models import ConfigValue
|
||||
import functions_general
|
||||
"""
|
||||
Handle the setting/retrieving of server config directives.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import time, sys
|
||||
from datetime import datetime
|
||||
import cPickle as pickle
|
||||
from django.utils import simplejson
|
||||
|
||||
from twisted.conch.telnet import StatefulTelnetProtocol
|
||||
|
||||
|
|
@ -68,11 +68,11 @@ class SessionProtocol(StatefulTelnetProtocol):
|
|||
|
||||
def load_user_channels(self):
|
||||
"""
|
||||
Un-pickle a user's channel list from their CHANLIST attribute.
|
||||
Parse JSON dict of a user's channel list from their CHANLIST attribute.
|
||||
"""
|
||||
chan_list = self.get_pobject().get_attribute_value("CHANLIST")
|
||||
if chan_list:
|
||||
self.channels_subscribed = pickle.loads(chan_list)
|
||||
self.channels_subscribed = simplejson.loads(chan_list)
|
||||
|
||||
def lineReceived(self, data):
|
||||
"""
|
||||
|
|
@ -159,7 +159,7 @@ class SessionProtocol(StatefulTelnetProtocol):
|
|||
pobject.set_attribute("Last", "%s" % (time.strftime("%a %b %d %H:%M:%S %Y", time.localtime()),))
|
||||
pobject.set_attribute("Lastsite", "%s" % (self.address[0],))
|
||||
|
||||
# Load their channel selection from a pickled attribute.
|
||||
# Load their channel selection from a JSON-encoded string attribute.
|
||||
self.load_user_channels()
|
||||
|
||||
def msg(self, message):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue