Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions spyne/client/twisted/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from spyne.client import RemoteProcedureBase
from spyne.client import ClientBase

from zope.interface import implements
from zope.interface import classImplements

from twisted.internet import reactor
from twisted.internet.defer import Deferred
Expand All @@ -41,9 +41,6 @@


class _Producer(object):
if six.PY2:
implements(IBodyProducer)

_deferred = None

def __init__(self, body):
Expand Down Expand Up @@ -85,6 +82,10 @@ def stopProducing(self):
self.__paused = True


if six.PY2:
classImplements(_Producer, IBodyProducer)


class _Protocol(Protocol):
def __init__(self, ctx):
self.ctx = ctx
Expand Down
2 changes: 1 addition & 1 deletion spyne/protocol/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def _compile_host_pattern(cls, pattern):
pattern = _full_pattern_re.sub(r'(?P<\1>.*)', pattern)

pattern_b = pattern.encode(cls.HOST_ENCODING)
pattern_b = _fragment_pattern_b_re.sub(b'(?P<\\1>[^\.]*)', pattern_b)
pattern_b = _fragment_pattern_b_re.sub(rb'(?P<\\1>[^\.]*)', pattern_b)
pattern_b = _full_pattern_b_re.sub(b'(?P<\\1>.*)', pattern_b)

return re.compile(pattern), re.compile(pattern_b)
Expand Down
2 changes: 1 addition & 1 deletion spyne/protocol/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
#

"""The ``spyne.protocol.json`` package contains the Json-related protocols.
r"""The ``spyne.protocol.json`` package contains the Json-related protocols.
Currently, only :class:`spyne.protocol.json.JsonDocument` is supported.

Initially released in 2.8.0-rc.
Expand Down
12 changes: 9 additions & 3 deletions spyne/store/relational/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
from sqlalchemy.dialects.postgresql.base import PGUuid, PGInet

from sqlalchemy.orm import relationship
from sqlalchemy.orm import mapper
from sqlalchemy.ext.associationproxy import association_proxy

# TODO: find the latest way of checking whether a class is already mapped
Expand Down Expand Up @@ -87,6 +86,11 @@

from spyne.util import sanitize_args

if int(sqlalchemy.__version__.split('.')[0]) < 2:
from sqlalchemy.orm import mapper
else:
from sqlalchemy.orm import registry
mapper = registry().map_imperatively

# Inheritance type constants.
class _SINGLE:
Expand Down Expand Up @@ -582,10 +586,11 @@ def _gen_array_m2m(cls, props, subname, arrser, storage):
rel_kwargs = dict(
lazy=storage.lazy,
backref=storage.backref,
cascade=storage.cascade,
order_by=storage.order_by,
back_populates=storage.back_populates,
)
if storage.cascade: # sqla >=2 doesn't accept False
rel_kwargs['cascade'] = cascade

if storage.explicit_join:
# Specify primaryjoin and secondaryjoin when requested.
Expand Down Expand Up @@ -753,11 +758,12 @@ def _gen_array_o2m(cls, props, subname, arrser, arrser_cust, storage):
rel_kwargs = dict(
lazy=storage.lazy,
backref=storage.backref,
cascade=storage.cascade,
order_by=storage.order_by,
foreign_keys=[col],
back_populates=storage.back_populates,
)
if storage.cascade: # sqla >=2 doesn't accept False
rel_kwargs['cascade'] = cascade

if storage.single_parent is not None:
rel_kwargs['single_parent'] = storage.single_parent
Expand Down
2 changes: 1 addition & 1 deletion spyne/test/interop/test_pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ def testGetWsdl(self):

request = Request(env)
resp = request.get_response(wsgi_app)
self.assert_(resp.status.startswith("200 "))
self.assertTrue(resp.status.startswith("200 "))
node = etree.XML(resp.body) # will throw exception if non well formed

6 changes: 3 additions & 3 deletions spyne/test/multipython/model/test_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class Attributes(ComplexModel.Attributes):

Base2 = Base.customize(prop1=4)

self.assertNotEquals(Base.Attributes.prop1, Base2.Attributes.prop1)
self.assertNotEqual(Base.Attributes.prop1, Base2.Attributes.prop1)
self.assertEqual(Base.Attributes.prop2, Base2.Attributes.prop2)

class Derived(Base):
Expand All @@ -156,15 +156,15 @@ class Attributes(Base.Attributes):
self.assertEqual(Derived.Attributes.prop1, 3)
self.assertEqual(Derived2.Attributes.prop1, 5)

self.assertNotEquals(Derived.Attributes.prop3, Derived2.Attributes.prop3)
self.assertNotEqual(Derived.Attributes.prop3, Derived2.Attributes.prop3)
self.assertEqual(Derived.Attributes.prop4, Derived2.Attributes.prop4)

Derived3 = Derived.customize(prop3=12)
Base.prop1 = 4

# changes made to bases propagate, unless overridden
self.assertEqual(Derived.Attributes.prop1, Base.Attributes.prop1)
self.assertNotEquals(Derived2.Attributes.prop1, Base.Attributes.prop1)
self.assertNotEqual(Derived2.Attributes.prop1, Base.Attributes.prop1)
self.assertEqual(Derived3.Attributes.prop1, Base.Attributes.prop1)

def test_declare_order(self):
Expand Down
4 changes: 2 additions & 2 deletions spyne/test/protocol/_test_dictdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ def some_call(p):
print(ctx.out_document)

d = convert_dict({"some_callResponse": {"some_callResult": inner}})
self.assertEquals(ctx.out_document[0], d)
self.assertEqual(ctx.out_document[0], d)

def test_validation_freq_parent(self):
class C(ComplexModel):
Expand Down Expand Up @@ -1308,7 +1308,7 @@ def some_call(sc):
doc = [{"C": {"s1": "s1","s2": "s2"}}]
ctx = _dry_me([SomeService], {"some_call": doc})

self.assertEquals(ctx.out_document[0], convert_dict(
self.assertEqual(ctx.out_document[0], convert_dict(
{'some_callResponse': {'some_callResult': {'C': {'s2': 's2'}}}})
)

Expand Down
Loading