The manager wrapper has trouble finding the path of the current class.

This commit is contained in:
Griatch 2014-12-20 19:19:48 +01:00
parent 043ebf7213
commit e28d544fb0
2 changed files with 7 additions and 16 deletions

View file

@ -42,10 +42,10 @@ from src.server.caches import get_prop_cache, set_prop_cache
#from src.server.caches import set_attr_cache
#from src.server.caches import call_ndb_hooks
from src.server.models import ServerConfig
#from src.server.models import ServerConfig
from src.typeclasses import managers
from src.locks.lockhandler import LockHandler
from src.utils import logger
#from src.utils import logger
from django.db.models.base import ModelBase
from src.utils.utils import (
make_iter, is_iter, to_str, inherits_from, lazy_property)
@ -752,7 +752,7 @@ from django.db.models.base import subclass_exception
import warnings
from django.db.models.options import Options
from django.utils.deprecation import RemovedInDjango19Warning
from django.core.exceptions import MultipleObjectsReturned
from django.core.exceptions import MultipleObjectsReturned, FieldError
from django.apps.config import MODELS_MODULE_NAME
from django.db.models.fields.related import OneToOneField
#/ django patch imports

View file

@ -22,19 +22,6 @@ from manager import SharedMemoryManager
AUTO_FLUSH_MIN_INTERVAL = 60.0 * 5 # at least 5 mins between cache flushes
# django patch imports
import copy
import sys
from django.apps import apps
from django.db.models.base import subclass_exception
import warnings
from django.db.models.options import Options
from django.utils.deprecation import RemovedInDjango19Warning
from django.core.exceptions import MultipleObjectsReturned
from django.apps.config import MODELS_MODULE_NAME
from django.db.models.fields.related import OneToOneField
#/ django patch imports
_GA = object.__getattribute__
_SA = object.__setattr__
@ -94,6 +81,10 @@ class SharedMemoryModelBase(ModelBase):
already has a wrapper of the given name, the automatic creation is skipped. Note: Remember to
document this auto-wrapping in the class header, this could seem very much like magic to the user otherwise.
"""
attrs["typename"] = cls.__name__
attrs["path"] = "%s.%s" % (attrs["__module__"], name)
# set up the typeclass handling only if a variable _is_typeclass is set on the class
def create_wrapper(cls, fieldname, wrappername, editable=True, foreignkey=False):
"Helper method to create property wrappers with unique names (must be in separate call)"