Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
plq committed Jul 28, 2015
1 parent 2237d7b commit 66f7a49
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions spyne/protocol/soap/soap11.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ def create_in_document(self, ctx, charset=None):
if isinstance(ctx.transport, HttpTransportContext):
# according to the soap via http standard, soap requests must only
# work with proper POST requests.
content_type = ctx.transport.req_env.get("CONTENT_TYPE")
http_verb = ctx.transport.req_env['REQUEST_METHOD'].upper()
content_type = ctx.transport.get_request_content_type()
http_verb = ctx.transport.get_request_method()
if content_type is None or http_verb != "POST":
ctx.transport.resp_code = HTTP_405
raise RequestNotAllowed(
Expand Down
29 changes: 14 additions & 15 deletions spyne/server/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,37 @@
from __future__ import absolute_import

import logging
from functools import update_wrapper
from django.conf import settings
from django.http import HttpResponse, HttpResponseNotAllowed, Http404
from django.views.decorators.csrf import csrf_exempt
from spyne.util import _bytes_join
logger = logging.getLogger(__name__)

try:
from django.http import StreamingHttpResponse
except ImportError as e:
def StreamingHttpResponse(*args, **kwargs):
raise e
from functools import update_wrapper

from spyne.application import get_fault_string_from_exception, Application
from spyne.auxproc import process_contexts
from spyne.interface import AllYourInterfaceDocuments
from spyne.model.fault import Fault
from spyne.protocol.soap import Soap11
from spyne.protocol.http import HttpRpc
from spyne.server.http import HttpBase, HttpMethodContext
from spyne.server.http import HttpBase, HttpMethodContext, HttpTransportContext
from spyne.server.wsgi import WsgiApplication
from spyne.util import _bytes_join

from django.http import HttpResponse, HttpResponseNotAllowed, Http404
from django.views.decorators.csrf import csrf_exempt

logger = logging.getLogger(__name__)

try:
from django.http import StreamingHttpResponse
except ImportError as e:
def StreamingHttpResponse(*args, **kwargs):
raise e

class DjangoApplication(WsgiApplication):
"""You should use this for regular RPC."""

HttpResponseObject = HttpResponse

# noinspection PyMethodOverriding
# because this is VERY similar to a Wsgi app
# but not that much.
def __call__(self, request):
retval = self.HttpResponseObject()

Expand Down Expand Up @@ -271,7 +272,6 @@ def as_view(cls, **initkwargs):
"""Register application, server and create new view.
:returns: callable view function
"""

# sanitize keyword arguments
Expand Down Expand Up @@ -336,7 +336,6 @@ def get(self, request, *args, **kwargs):
def post(self, request, *args, **kwargs):
return self.server.handle_rpc(request, *args, **kwargs)


def http_method_not_allowed(self, request, *args, **kwargs):
logger.warning('Method Not Allowed (%s): %s', request.method,
request.path, extra={'status_code': 405, 'request':
Expand Down
3 changes: 2 additions & 1 deletion spyne/server/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ class WsgiTransportContext(HttpTransportContext):
:class:`WsgiMethodContext` class."""

def __init__(self, parent, transport, req_env, content_type):
super(WsgiTransportContext, self).__init__(parent, transport, req_env, content_type)
super(WsgiTransportContext, self).__init__(parent, transport,
req_env, content_type)

self.req_env = self.req
"""WSGI Request environment"""
Expand Down

0 comments on commit 66f7a49

Please # to comment.