コード例 #1
0
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponse, HttpResponseServerError
from django.conf import settings
from django.shortcuts import render_to_response
from dispatcher import DjangoXMLRPCDispatcher
from decorators import xmlrpc_func, permission_required

# We create a local DEBUG variable from the data in settings.
DEBUG = hasattr(settings, 'XMLRPC_DEBUG') and settings.XMLRPC_DEBUG

# Declare xmlrpcdispatcher correctly depending on our python version
if sys.version_info[:3] >= (
        2,
        5,
):
    xmlrpcdispatcher = DjangoXMLRPCDispatcher(allow_none=False, encoding=None)
else:
    xmlrpcdispatcher = DjangoXMLRPCDispatcher()


@xmlrpc_func(returns='string', args=['string'])
def test_xmlrpc(text):
    """Simply returns the args passed to it as a string"""
    return "Here's a response! %s" % str(text)


def handle_xmlrpc(request):
    """Handles XML-RPC requests. All XML-RPC calls should be forwarded here

    request
        The HttpRequest object that carries the XML-RPC call. If this is a
コード例 #2
0
ファイル: views.py プロジェクト: csitifr/gnowsys-studio
from django.utils.datastructures import SortedDict
try:
    from django.views.decorators.csrf import csrf_exempt
except ImportError:
    from django.contrib.csrf.middleware import csrf_exempt

from dispatcher import DjangoXMLRPCDispatcher
from decorators import xmlrpc_func


# We create a local DEBUG variable from the data in settings.
DEBUG = hasattr(settings, 'XMLRPC_DEBUG') and settings.XMLRPC_DEBUG

# Declare xmlrpcdispatcher correctly depending on our python version
if sys.version_info[:3] >= (2, 5,):
    xmlrpcdispatcher = DjangoXMLRPCDispatcher(allow_none=True, encoding=None)
else:
    xmlrpcdispatcher = DjangoXMLRPCDispatcher()


def request_datas(request):
    if django.VERSION[1] > 3:
        return request.body
    return request.raw_post_data


@xmlrpc_func(returns='string', args=['string'])
def test_xmlrpc(text):
    """Simply returns the args passed to it as a string"""
    return "Here's a response! %s" % str(text)
コード例 #3
0
ファイル: views.py プロジェクト: PhiTheta/ISON
    from django.views.decorators.csrf import csrf_exempt
except ImportError:
    from django.contrib.csrf.middleware import csrf_exempt

from dispatcher import DjangoXMLRPCDispatcher
from decorators import xmlrpc_func

# We create a local DEBUG variable from the data in settings.
DEBUG = hasattr(settings, 'XMLRPC_DEBUG') and settings.XMLRPC_DEBUG

# Declare xmlrpcdispatcher correctly depending on our python version
if sys.version_info[:3] >= (
        2,
        5,
):
    xmlrpcdispatcher = DjangoXMLRPCDispatcher(allow_none=True, encoding=None)
else:
    xmlrpcdispatcher = DjangoXMLRPCDispatcher()


def request_datas(request):
    if django.VERSION[1] > 3:
        return request.body
    return request.raw_post_data


@xmlrpc_func(returns='string', args=['string'])
def test_xmlrpc(text):
    """Simply returns the args passed to it as a string"""
    return "Here's a response! %s" % str(text)
コード例 #4
0
ファイル: views.py プロジェクト: aparo/django-xmlrpc
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.views.decorators.csrf import csrf_exempt
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponse, HttpResponseServerError

from dispatcher import DjangoXMLRPCDispatcher
from decorators import xmlrpc_func, permission_required


# We create a local DEBUG variable from the data in settings.
DEBUG = hasattr(settings, 'XMLRPC_DEBUG') and settings.XMLRPC_DEBUG

# Declare xmlrpcdispatcher correctly depending on our python version
if sys.version_info[:3] >= (2, 5,):
    xmlrpcdispatcher = DjangoXMLRPCDispatcher(allow_none=False, encoding=None)
else:
    xmlrpcdispatcher = DjangoXMLRPCDispatcher()


@xmlrpc_func(returns='string', args=['string'])
def test_xmlrpc(text):
    """Simply returns the args passed to it as a string"""
    return "Here's a response! %s" % str(text)

@csrf_exempt
def handle_xmlrpc(request):
    """Handles XML-RPC requests. All XML-RPC calls should be forwarded here

    request
        The HttpRequest object that carries the XML-RPC call. If this is a
コード例 #5
0
from django.utils.datastructures import SortedDict
try:
    from django.views.decorators.csrf import csrf_exempt
except ImportError:
    from django.contrib.csrf.middleware import csrf_exempt

from dispatcher import DjangoXMLRPCDispatcher
from decorators import xmlrpc_func


# We create a local DEBUG variable from the data in settings.
DEBUG = hasattr(settings, 'XMLRPC_DEBUG') and settings.XMLRPC_DEBUG

# Declare xmlrpcdispatcher correctly depending on our python version
if sys.version_info[:3] >= (2, 5,):
    xmlrpcdispatcher = DjangoXMLRPCDispatcher(allow_none=True, encoding=None)
else:
    xmlrpcdispatcher = DjangoXMLRPCDispatcher()


def request_datas(request):
    if django.VERSION[1] > 3:
        return request.body
    return request.raw_post_data


@xmlrpc_func(returns='string', args=['string'])
def test_xmlrpc(text):
    """Simply returns the args passed to it as a string"""
    return "Here's a response! %s" % str(text)