Changed how lazy-loading of handlers work, using a werkzeug recipe. Much more efficient now.

This commit is contained in:
Griatch 2014-07-06 13:10:03 +02:00
parent 680e603c4d
commit e6950aadf2
10 changed files with 125 additions and 144 deletions

View file

@ -7,7 +7,7 @@ All commands in Evennia inherit from the 'Command' class in this module.
import re
from src.locks.lockhandler import LockHandler
from src.utils.utils import is_iter, fill, LazyLoadHandler
from src.utils.utils import is_iter, fill, lazy_property
def _init_command(mcs, **kwargs):
@ -155,7 +155,10 @@ class Command(object):
overloading evential same-named class properties."""
if kwargs:
_init_command(self, **kwargs)
self.lockhandler = LazyLoadHandler(self, "lockhandler", LockHandler)
@lazy_property
def lockhandler(self):
return LockHandler(self)
def __str__(self):
"Print the command"