minor PEP 8 whitespace, docstring, comment edits
This commit is contained in:
parent
0af6f2498e
commit
dd8468aab6
1 changed files with 13 additions and 16 deletions
|
|
@ -32,8 +32,9 @@ from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
# Handlers for Session.db/ndb operation
|
# Handlers for Session.db/ndb operation
|
||||||
|
|
||||||
|
|
||||||
class NDbHolder(object):
|
class NDbHolder(object):
|
||||||
"Holder for allowing property access of attributes"
|
"""Holder for allowing property access of attributes"""
|
||||||
def __init__(self, obj, name, manager_name='attributes'):
|
def __init__(self, obj, name, manager_name='attributes'):
|
||||||
_SA(self, name, _GA(obj, manager_name))
|
_SA(self, name, _GA(obj, manager_name))
|
||||||
_SA(self, 'name', name)
|
_SA(self, 'name', name)
|
||||||
|
|
@ -145,9 +146,9 @@ class NAttributeHandler(object):
|
||||||
return [key for key in self._store if not key.startswith("_")]
|
return [key for key in self._store if not key.startswith("_")]
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
# Server Session
|
# Server Session
|
||||||
#------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
|
|
||||||
class ServerSession(Session):
|
class ServerSession(Session):
|
||||||
"""
|
"""
|
||||||
|
|
@ -160,7 +161,7 @@ class ServerSession(Session):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"Initiate to avoid AttributeErrors down the line"
|
"""Initiate to avoid AttributeErrors down the line"""
|
||||||
self.puppet = None
|
self.puppet = None
|
||||||
self.player = None
|
self.player = None
|
||||||
self.cmdset_storage_string = ""
|
self.cmdset_storage_string = ""
|
||||||
|
|
@ -203,7 +204,7 @@ class ServerSession(Session):
|
||||||
obj.player = self.player
|
obj.player = self.player
|
||||||
self.puid = obj.id
|
self.puid = obj.id
|
||||||
self.puppet = obj
|
self.puppet = obj
|
||||||
#obj.scripts.validate()
|
# obj.scripts.validate()
|
||||||
obj.locks.cache_lock_bypass(obj)
|
obj.locks.cache_lock_bypass(obj)
|
||||||
|
|
||||||
def at_login(self, player):
|
def at_login(self, player):
|
||||||
|
|
@ -264,7 +265,6 @@ class ServerSession(Session):
|
||||||
MONITOR_HANDLER.remove(player, "_saved_webclient_options",
|
MONITOR_HANDLER.remove(player, "_saved_webclient_options",
|
||||||
self.sessid)
|
self.sessid)
|
||||||
|
|
||||||
|
|
||||||
def get_player(self):
|
def get_player(self):
|
||||||
"""
|
"""
|
||||||
Get the player associated with this session
|
Get the player associated with this session
|
||||||
|
|
@ -364,7 +364,6 @@ class ServerSession(Session):
|
||||||
self.protocol_flags.update(kwargs)
|
self.protocol_flags.update(kwargs)
|
||||||
self.sessionhandler.session_portal_sync(self)
|
self.sessionhandler.session_portal_sync(self)
|
||||||
|
|
||||||
|
|
||||||
def data_out(self, **kwargs):
|
def data_out(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
Sending data from Evennia->Client
|
Sending data from Evennia->Client
|
||||||
|
|
@ -437,7 +436,7 @@ class ServerSession(Session):
|
||||||
self.sessionhandler.data_in(self, **kwargs)
|
self.sessionhandler.data_in(self, **kwargs)
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
"Handle session comparisons"
|
"""Handle session comparisons"""
|
||||||
try:
|
try:
|
||||||
return self.address == other.address
|
return self.address == other.address
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|
@ -462,11 +461,9 @@ class ServerSession(Session):
|
||||||
return "%s%s@%s" % (self.uname, symbol, address)
|
return "%s%s@%s" % (self.uname, symbol, address)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
"Unicode representation"
|
"""Unicode representation"""
|
||||||
return u"%s" % str(self)
|
return u"%s" % str(self)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Dummy API hooks for use during non-loggedin operation
|
# Dummy API hooks for use during non-loggedin operation
|
||||||
|
|
||||||
def at_cmdset_get(self, **kwargs):
|
def at_cmdset_get(self, **kwargs):
|
||||||
|
|
@ -488,7 +485,7 @@ class ServerSession(Session):
|
||||||
def attributes(self):
|
def attributes(self):
|
||||||
return self.nattributes
|
return self.nattributes
|
||||||
|
|
||||||
#@property
|
# @property
|
||||||
def ndb_get(self):
|
def ndb_get(self):
|
||||||
"""
|
"""
|
||||||
A non-persistent store (ndb: NonDataBase). Everything stored
|
A non-persistent store (ndb: NonDataBase). Everything stored
|
||||||
|
|
@ -503,7 +500,7 @@ class ServerSession(Session):
|
||||||
self._ndb_holder = NDbHolder(self, "nattrhandler", manager_name="nattributes")
|
self._ndb_holder = NDbHolder(self, "nattrhandler", manager_name="nattributes")
|
||||||
return self._ndb_holder
|
return self._ndb_holder
|
||||||
|
|
||||||
#@ndb.setter
|
# @ndb.setter
|
||||||
def ndb_set(self, value):
|
def ndb_set(self, value):
|
||||||
"""
|
"""
|
||||||
Stop accidentally replacing the db object
|
Stop accidentally replacing the db object
|
||||||
|
|
@ -516,9 +513,9 @@ class ServerSession(Session):
|
||||||
string += "Use ndb.attr=value instead."
|
string += "Use ndb.attr=value instead."
|
||||||
raise Exception(string)
|
raise Exception(string)
|
||||||
|
|
||||||
#@ndb.deleter
|
# @ndb.deleter
|
||||||
def ndb_del(self):
|
def ndb_del(self):
|
||||||
"Stop accidental deletion."
|
"""Stop accidental deletion."""
|
||||||
raise Exception("Cannot delete the ndb object!")
|
raise Exception("Cannot delete the ndb object!")
|
||||||
ndb = property(ndb_get, ndb_set, ndb_del)
|
ndb = property(ndb_get, ndb_set, ndb_del)
|
||||||
db = property(ndb_get, ndb_set, ndb_del)
|
db = property(ndb_get, ndb_set, ndb_del)
|
||||||
|
|
@ -526,5 +523,5 @@ class ServerSession(Session):
|
||||||
# Mock access method for the session (there is no lock info
|
# Mock access method for the session (there is no lock info
|
||||||
# at this stage, so we just present a uniform API)
|
# at this stage, so we just present a uniform API)
|
||||||
def access(self, *args, **kwargs):
|
def access(self, *args, **kwargs):
|
||||||
"Dummy method to mimic the logged-in API."
|
"""Dummy method to mimic the logged-in API."""
|
||||||
return True
|
return True
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue