Skip to content

Commit 3dbc88f

Browse files
committed
getting rid of monkey-patching method to initialize webio
1 parent 68bbb45 commit 3dbc88f

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
project = u'pyexcel-webio'
2222
copyright = u'2015-2017 Onni Software Ltd.'
2323
version = '0.1.1'
24-
release = '0.1.1'
24+
release = '0.1.2'
2525
exclude_patterns = []
2626
pygments_style = 'sphinx'
2727
html_theme = 'default'

pyexcel_webio.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
overrides: "pyexcel.yaml"
22
name: "pyexcel-webio"
33
nick_name: webio
4-
version: "0.1.1"
5-
current_version: "0.1.1"
4+
version: "0.1.2"
5+
current_version: "0.1.2"
66
release: "0.1.1"
77
dependencies:
88
- pyexcel>=0.4.0

pyexcel_webio/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def dummy_func(content, content_type=None, status=200, file_name=None):
259259
return None
260260

261261

262-
ExcelResponse = dummy_func
262+
__excel_response_func__ = dummy_func
263263

264264

265265
def _make_response(content, file_type,
@@ -269,9 +269,15 @@ def _make_response(content, file_type,
269269
if file_name:
270270
if not file_name.endswith(file_type):
271271
file_name = "%s.%s" % (file_name, file_type)
272-
return ExcelResponse(content,
273-
content_type=FILE_TYPE_MIME_TABLE[file_type],
274-
status=status, file_name=file_name)
272+
return __excel_response_func__(
273+
content,
274+
content_type=FILE_TYPE_MIME_TABLE[file_type],
275+
status=status, file_name=file_name)
276+
277+
278+
def init_webio(response_function):
279+
global __excel_response_func__
280+
__excel_response_func__ = response_function
275281

276282

277283
def make_response(pyexcel_instance, file_type,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
NAME = 'pyexcel-webio'
99
AUTHOR = 'C.W.'
10-
VERSION = '0.1.1'
10+
VERSION = '0.1.2'
1111
1212
LICENSE = 'New BSD'
1313
DESCRIPTION = (

tests/test_webio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def dumpy_response(content, content_type=None, status=200, file_name=None):
2121
f.write(content)
2222

2323

24-
webio.ExcelResponse = dumpy_response
24+
webio.init_webio(dumpy_response)
2525

2626

2727
class TestExceptions:

0 commit comments

Comments
 (0)