Re-implemented the six.with_metaclass functionality to avoid having to include six in the distrubution.

This commit is contained in:
Griatch 2013-04-14 22:09:32 +02:00
parent d0edb84909
commit 29cde0921d

View file

@ -32,6 +32,7 @@ Modified for Evennia by Griatch.
from copy import deepcopy from copy import deepcopy
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
from zlib import compress, decompress from zlib import compress, decompress
#import six # not in default syslib
import django import django
from django.db import models from django.db import models
@ -112,7 +113,11 @@ def _get_subfield_superclass():
# 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
return six.with_metaclass(models.SubfieldBase, models.Field) # mimic six.with_metaclass
meta = models.SubfieldBase
base = models.Field
return meta("NewBase", (base,), {})
#return six.with_metaclass(models.SubfieldBase, models.Field)
class PickledObjectField(_get_subfield_superclass()): class PickledObjectField(_get_subfield_superclass()):