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
|
|
@ -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