View | Details | Raw Unified | Return to bug 211435 | Differences between
and this patch

Collapse All | Expand All

(-)net/py-flask-xml-rpc/Makefile (+20 lines)
Line 0 Link Here
1
# $FreeBSD$
2
3
PORTNAME=	Flask-XML-RPC
4
PORTVERSION=	0.1.2
5
CATEGORIES=	net python
6
MASTER_SITES=	CHEESESHOP
7
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
8
9
MAINTAINER=	john@saltant.com
10
COMMENT=	Simple framework for creating XML-RPC APIs with Flask
11
12
LICENSE=	MIT
13
14
RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}Flask>0:www/py-flask
15
16
NO_ARCH=	yes
17
USES=		python
18
USE_PYTHON=	autoplist distutils
19
20
.include <bsd.port.mk>
(-)net/py-flask-xml-rpc/distinfo (+2 lines)
Line 0 Link Here
1
SHA256 (Flask-XML-RPC-0.1.2.tar.gz) = 4adc7482240a916e8c2205cba38b4bd6e648692d189419686a3116768fa48ab7
2
SIZE (Flask-XML-RPC-0.1.2.tar.gz) = 5756
(-)net/py-flask-xml-rpc/files/patch-flaskext_xmlrpc.py (+56 lines)
Line 0 Link Here
1
Obtained-From: https://bitbucket.org/leafstorm/flask-xml-rpc/pull-requests/2/added-python3-support-alongside-python2/commits
2
3
# HG changeset patch
4
# User Maxime "Pepe_" Buquet <pep+code@bouah.net>
5
# Date 1425540278 -32400
6
# Node ID 9da0e2bcfe5e32a1db95b639f41f67d3e1a43b80
7
# Parent  06a6c81e3a98ecb647e729e239f5de11814901d3
8
Added Python3 support alongside Python2
9
10
--- flaskext/xmlrpc.py.orig	2015-03-05 00:00:00 UTC
11
+++ flaskext/xmlrpc.py
12
@@ -10,9 +10,16 @@
13
 """
14
 
15
 from flask import request, current_app
16
-from SimpleXMLRPCServer import SimpleXMLRPCDispatcher as Dispatcher
17
 import sys
18
-import xmlrpclib
19
+
20
+if sys.version_info[0] == 2:
21
+    from SimpleXMLRPCServer import SimpleXMLRPCDispatcher as Dispatcher
22
+    import xmlrpclib
23
+    string_types = basestring
24
+else:
25
+    from xmlrpc.server import SimpleXMLRPCDispatcher as Dispatcher
26
+    import xmlrpc.client as xmlrpclib
27
+    string_types = str
28
 
29
 Fault = xmlrpclib.Fault
30
 
31
@@ -97,7 +104,7 @@
32
                      If not given, the function's :obj:`__name__` attribute
33
                      will be used.
34
         """
35
-        if isinstance(function, basestring):
36
+        if isinstance(function, string_types):
37
             return lambda fn: self.register_function(fn, function)
38
         return Dispatcher.register_function(self, function, name)
39
     
40
@@ -198,7 +205,7 @@
41
                      If not given, the function's :obj:`__name__` attribute
42
                      will be used.
43
         """
44
-        if isinstance(function, basestring):
45
+        if isinstance(function, string_types):
46
             return lambda fn: self.register_function(fn, function)
47
         if name is None:
48
             name = function.__name__
49
@@ -249,7 +256,8 @@
50
     """
51
     try:
52
         return xmlrpclib.loads(response)[0][0]
53
-    except Fault, fault:
54
+    except Fault:
55
+        _, fault = sys.exec_info()[:2]
56
         return fault
(-)net/py-flask-xml-rpc/files/patch-tests_test-xmlrpc.py (+45 lines)
Line 0 Link Here
1
Obtained-From: https://bitbucket.org/leafstorm/flask-xml-rpc/pull-requests/2/added-python3-support-alongside-python2/commits
2
3
# HG changeset patch
4
# User Maxime "Pepe_" Buquet <pep+code@bouah.net>
5
# Date 1425540278 -32400
6
# Node ID 9da0e2bcfe5e32a1db95b639f41f67d3e1a43b80
7
# Parent  06a6c81e3a98ecb647e729e239f5de11814901d3
8
Added Python3 support alongside Python2
9
10
--- tests/test-xmlrpc.py.orig	2015-03-05 00:00:00 UTC
11
+++ tests/test-xmlrpc.py
12
@@ -7,12 +7,19 @@
13
 :copyright: (c) 2010 by Matthew "LeafStorm" Frazier.
14
 :license: MIT, see LICENSE for more details.
15
 """
16
-import xmlrpclib
17
 from flask import Flask
18
 from flaskext.xmlrpc import (XMLRPCHandler, XMLRPCNamespace, Fault,
19
                              dump_method_call, load_method_response,
20
                              test_xmlrpc_call, XMLRPCTester)
21
 
22
+import sys
23
+PY2 = sys.version_info[0] == 2
24
+
25
+if PY2:
26
+    import xmlrpclib
27
+else:
28
+    import xmlrpc.client as xmlrpclib
29
+
30
 
31
 def hello(name='world'):
32
     if not name:
33
@@ -39,7 +46,11 @@
34
         handler = XMLRPCHandler('api')
35
         app = Flask(__name__)
36
         handler.connect(app, '/api')
37
-        assert app.view_functions[handler.endpoint_name].im_self is handler
38
+        if PY2:
39
+            app_handler = app.view_functions[handler.endpoint_name].im_self
40
+        else:
41
+            app_handler = app.view_functions[handler.endpoint_name].__self__
42
+        assert app_handler is handler
43
     
44
     def test_register(self):
45
         handler = XMLRPCHandler('api')
(-)net/py-flask-xml-rpc/pkg-descr (+6 lines)
Line 0 Link Here
1
Flask-XML-RPC is an extension for Flask that makes it easy to create APIs
2
based on the XML-RPC standard. It features easy registration of methods
3
and namespacing, connects seamlessly to your Flask app, and includes
4
plenty of testing helpers.
5
6
WWW: https://bitbucket.org/leafstorm/flask-xml-rpc/

Return to bug 211435