Don't use long, since it doesn't exist in python3.
This commit is contained in:
parent
11b61fe335
commit
c9404bfb51
2 changed files with 7 additions and 5 deletions
|
|
@ -9,6 +9,7 @@ from django.db.models.fields import exceptions
|
||||||
from evennia.typeclasses.managers import TypedObjectManager, TypeclassManager
|
from evennia.typeclasses.managers import TypedObjectManager, TypeclassManager
|
||||||
from evennia.typeclasses.managers import returns_typeclass, returns_typeclass_list
|
from evennia.typeclasses.managers import returns_typeclass, returns_typeclass_list
|
||||||
from evennia.utils.utils import to_unicode, is_iter, make_iter, string_partial_matching
|
from evennia.utils.utils import to_unicode, is_iter, make_iter, string_partial_matching
|
||||||
|
from builtins import int
|
||||||
|
|
||||||
__all__ = ("ObjectManager",)
|
__all__ = ("ObjectManager",)
|
||||||
_GA = object.__getattribute__
|
_GA = object.__getattribute__
|
||||||
|
|
@ -149,7 +150,7 @@ class ObjectDBManager(TypedObjectManager):
|
||||||
|
|
||||||
## This doesn't work if attribute_value is an object. Workaround below
|
## This doesn't work if attribute_value is an object. Workaround below
|
||||||
|
|
||||||
if isinstance(attribute_value, (basestring, int, float, bool, long)):
|
if isinstance(attribute_value, (basestring, int, float, bool)):
|
||||||
return self.filter(cand_restriction & type_restriction & Q(db_attributes__db_key=attribute_name, db_attributes__db_value=attribute_value))
|
return self.filter(cand_restriction & type_restriction & Q(db_attributes__db_key=attribute_name, db_attributes__db_value=attribute_value))
|
||||||
else:
|
else:
|
||||||
# We have to loop for safety since the referenced lookup gives deepcopy error if attribute value is an object.
|
# We have to loop for safety since the referenced lookup gives deepcopy error if attribute value is an object.
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ from django.contrib.contenttypes.models import ContentType
|
||||||
from evennia.server.models import ServerConfig
|
from evennia.server.models import ServerConfig
|
||||||
from evennia.utils.utils import to_str, uses_database
|
from evennia.utils.utils import to_str, uses_database
|
||||||
from evennia.utils import logger
|
from evennia.utils import logger
|
||||||
|
from builtins import int
|
||||||
|
|
||||||
__all__ = ("to_pickle", "from_pickle", "do_pickle", "do_unpickle")
|
__all__ = ("to_pickle", "from_pickle", "do_pickle", "do_unpickle")
|
||||||
|
|
||||||
|
|
@ -121,7 +122,7 @@ class _SaverMutable(object):
|
||||||
def process_tree(item, parent):
|
def process_tree(item, parent):
|
||||||
"recursively populate the tree, storing parents"
|
"recursively populate the tree, storing parents"
|
||||||
dtype = type(item)
|
dtype = type(item)
|
||||||
if dtype in (basestring, int, long, float, bool, tuple):
|
if dtype in (basestring, int, float, bool, tuple):
|
||||||
return item
|
return item
|
||||||
elif dtype == list:
|
elif dtype == list:
|
||||||
dat = _SaverList(parent=parent)
|
dat = _SaverList(parent=parent)
|
||||||
|
|
@ -280,7 +281,7 @@ def to_pickle(data):
|
||||||
def process_item(item):
|
def process_item(item):
|
||||||
"Recursive processor and identification of data"
|
"Recursive processor and identification of data"
|
||||||
dtype = type(item)
|
dtype = type(item)
|
||||||
if dtype in (basestring, int, long, float, bool):
|
if dtype in (basestring, int, float, bool):
|
||||||
return item
|
return item
|
||||||
elif dtype == tuple:
|
elif dtype == tuple:
|
||||||
return tuple(process_item(val) for val in item)
|
return tuple(process_item(val) for val in item)
|
||||||
|
|
@ -325,7 +326,7 @@ def from_pickle(data, db_obj=None):
|
||||||
def process_item(item):
|
def process_item(item):
|
||||||
"Recursive processor and identification of data"
|
"Recursive processor and identification of data"
|
||||||
dtype = type(item)
|
dtype = type(item)
|
||||||
if dtype in (basestring, int, long, float, bool):
|
if dtype in (basestring, int, float, bool):
|
||||||
return item
|
return item
|
||||||
elif _IS_PACKED_DBOBJ(item):
|
elif _IS_PACKED_DBOBJ(item):
|
||||||
# this must be checked before tuple
|
# this must be checked before tuple
|
||||||
|
|
@ -348,7 +349,7 @@ def from_pickle(data, db_obj=None):
|
||||||
def process_tree(item, parent):
|
def process_tree(item, parent):
|
||||||
"Recursive processor, building a parent-tree from iterable data"
|
"Recursive processor, building a parent-tree from iterable data"
|
||||||
dtype = type(item)
|
dtype = type(item)
|
||||||
if dtype in (basestring, int, long, float, bool):
|
if dtype in (basestring, int, float, bool):
|
||||||
return item
|
return item
|
||||||
elif _IS_PACKED_DBOBJ(item):
|
elif _IS_PACKED_DBOBJ(item):
|
||||||
# this must be checked before tuple
|
# this must be checked before tuple
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue