Fixed deprecation warnings for future django1.10.
This commit is contained in:
parent
e6a866a150
commit
5a9cf29f45
2 changed files with 17 additions and 16 deletions
|
|
@ -116,18 +116,17 @@ def dbsafe_decode(value, compress_object=False):
|
||||||
value = decompress(value)
|
value = decompress(value)
|
||||||
return loads(value)
|
return loads(value)
|
||||||
|
|
||||||
|
#def _get_subfield_superclass():
|
||||||
def _get_subfield_superclass():
|
# # hardcore trick to support django < 1.3 - there was something wrong with
|
||||||
# hardcore trick to support django < 1.3 - there was something wrong with
|
# # inheritance and SubfieldBase before django 1.3
|
||||||
# inheritance and SubfieldBase before django 1.3
|
# # see https://github.com/django/django/commit/222c73261650201f5ce99e8dd4b1ce0d30a69eb4
|
||||||
# see https://github.com/django/django/commit/222c73261650201f5ce99e8dd4b1ce0d30a69eb4
|
# if django.VERSION < (1,3):
|
||||||
if django.VERSION < (1,3):
|
# return models.Field
|
||||||
return models.Field
|
# # mimic six.with_metaclass
|
||||||
# mimic six.with_metaclass
|
# meta = models.SubfieldBase
|
||||||
meta = models.SubfieldBase
|
# base = models.Field
|
||||||
base = models.Field
|
# return meta("NewBase", (base,), {})
|
||||||
return meta("NewBase", (base,), {})
|
# #return six.with_metaclass(models.SubfieldBase, models.Field)
|
||||||
#return six.with_metaclass(models.SubfieldBase, models.Field)
|
|
||||||
|
|
||||||
|
|
||||||
class PickledWidget(Textarea):
|
class PickledWidget(Textarea):
|
||||||
|
|
@ -169,7 +168,7 @@ class PickledFormField(CharField):
|
||||||
raise ValidationError(self.error_messages['invalid'])
|
raise ValidationError(self.error_messages['invalid'])
|
||||||
|
|
||||||
|
|
||||||
class PickledObjectField(with_metaclass(models.SubfieldBase, _get_subfield_superclass())):
|
class PickledObjectField(with_metaclass(models.SubfieldBase, models.Field)):
|
||||||
"""
|
"""
|
||||||
A field that will accept *any* python object and store it in the
|
A field that will accept *any* python object and store it in the
|
||||||
database. PickledObjectField will optionally compress its values if
|
database. PickledObjectField will optionally compress its values if
|
||||||
|
|
@ -204,6 +203,8 @@ class PickledObjectField(with_metaclass(models.SubfieldBase, _get_subfield_super
|
||||||
# If the field doesn't have a default, then we punt to models.Field.
|
# If the field doesn't have a default, then we punt to models.Field.
|
||||||
return super(PickledObjectField, self).get_default()
|
return super(PickledObjectField, self).get_default()
|
||||||
|
|
||||||
|
#def from_db_value():pass
|
||||||
|
|
||||||
def to_python(self, value):
|
def to_python(self, value):
|
||||||
"""
|
"""
|
||||||
B64decode and unpickle the object, optionally decompressing it.
|
B64decode and unpickle the object, optionally decompressing it.
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from mock import Mock
|
from mock import Mock
|
||||||
from evennia.objects import DefaultObject, DefaultCharacter, DefaultRoom, DefaultExit
|
from evennia.objects.objects import DefaultObject, DefaultCharacter, DefaultRoom, DefaultExit
|
||||||
from evennia.players import DefaultPlayer
|
from evennia.players.players import DefaultPlayer
|
||||||
from evennia.scripts import DefaultScript
|
from evennia.scripts.scripts import DefaultScript
|
||||||
from evennia.server.serversession import ServerSession
|
from evennia.server.serversession import ServerSession
|
||||||
from evennia.server.sessionhandler import SESSIONS
|
from evennia.server.sessionhandler import SESSIONS
|
||||||
from evennia.utils import create
|
from evennia.utils import create
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue