Moved import of SESSIONS to avoid a circular import situation under i18n.

This commit is contained in:
Griatch 2013-02-10 11:52:31 +01:00
parent 390bdd28a7
commit 433cb5b9c0
2 changed files with 10 additions and 4 deletions

View file

@ -47,7 +47,6 @@ from django.utils.encoding import smart_str
from src.server.caches import get_field_cache, set_field_cache, del_field_cache
from src.server.caches import get_prop_cache, set_prop_cache, del_prop_cache
from src.server.sessionhandler import SESSIONS
from src.players import manager
from src.typeclasses.models import Attribute, TypedObject, TypeNick, TypeNickHandler
from src.typeclasses.typeclass import TypeClass
@ -58,6 +57,7 @@ from src.utils.utils import inherits_from
__all__ = ("PlayerAttribute", "PlayerNick", "PlayerDB")
_SESSIONS = None
_AT_SEARCH_RESULT = utils.variable_from_module(*settings.SEARCH_AT_RESULT.rsplit('.', 1))
_GA = object.__getattribute__
@ -333,7 +333,10 @@ class PlayerDB(TypedObject):
#@property
def sessions_get(self):
"Getter. Retrieve sessions related to this player/user"
return SESSIONS.sessions_from_player(self)
global _SESSIONS
if not _SESSIONS:
from src.server.sessionhandler import SESSIONS as _SESSIONS
return _SESSIONS.sessions_from_player(self)
#@sessions.setter
def sessions_set(self, value):
"Setter. Protects the sessions property from adding things"