Skip to content

Commit 2e490ae

Browse files
author
Mark Finger
committed
Renamed args and settings.
watch_source is now watch_source_files and WATCH_SOURCE is now WATCH_SOURCE_FILES, both converge on a similar naming scheme as webpack's.
1 parent 4fbbb94 commit 2e490ae

6 files changed

Lines changed: 17 additions & 17 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ render_component(
140140
to_static_markup = False,
141141

142142
# [optional] a boolean indicating that the component should be bundled for
143-
# reuse on the client-side. If `translate` or `watch_source` are provided, this
143+
# reuse on the client-side. If `translate` or `watch_source_files` are provided, this
144144
# argument is ignored
145145
bundle = True,
146146

@@ -151,7 +151,7 @@ render_component(
151151
# [optional] a boolean indicating that your source files should be watched
152152
# for changes. When changes are detected, the component is rebuilt in background,
153153
# ready for the next request. If not defined, defaults to `DEBUG`
154-
watch_source = True,
154+
watch_source_files = True,
155155

156156
# [optional] a class which is used to encode the props to JSON. Defaults
157157
# to `django.core.serializers.json.DjangoJSONEncoder`
@@ -254,7 +254,7 @@ bundle_component(
254254
# [optional] a boolean indicating that your source files should be watched
255255
# for changes. When changes are detected, the component is rebuilt in
256256
# background, ready for the next request. If not defined, defaults to `DEBUG`
257-
watch_source = True,
257+
watch_source_files = True,
258258

259259
)
260260
```

react/bundle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
from .conf import settings
88

99

10-
def bundle_component(path, translate=None, watch_source=None):
10+
def bundle_component(path, translate=None, watch_source_files=None):
1111
filename = get_component_config_filename(path, translate)
12-
return webpack(filename, watch_source=watch_source)
12+
return webpack(filename, watch_source_files=watch_source_files)
1313

1414
# TODO: replace this with a deterministic config file writer in webpack
1515
COMPONENT_CONFIG_FILES = {}

react/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ class Conf(conf.Conf):
55
django_namespace = 'REACT'
66

77
DEV_TOOL = False
8-
WATCH_SOURCE = False
8+
WATCH_SOURCE_FILES = False
99

1010
settings = Conf()

react/render.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818

1919
class RenderedComponent(object):
20-
def __init__(self, markup, path_to_source, props, serialized_props, watch_source, bundle, to_static_markup):
20+
def __init__(self, markup, path_to_source, props, serialized_props, watch_source_files, bundle, to_static_markup):
2121
self.markup = markup
2222
self.path_to_source = path_to_source
2323
self.props = props
2424
self.serialized_props = serialized_props
25-
self.watch_source = watch_source
25+
self.watch_source_files = watch_source_files
2626
self.bundle = bundle
2727
self.to_static_markup = to_static_markup
2828

@@ -54,7 +54,7 @@ def get_bundle(self):
5454
raise ComponentWasNotBundled(
5555
(
5656
'The component "{path}" was not bundled during the rendering process. '
57-
'Call render_component with `bundle`, `translate`, or `watch_source` '
57+
'Call render_component with `bundle`, `translate`, or `watch_source_files` '
5858
'keyword arguments set to `True` to ensure that it is bundled.'
5959
).format(path=self.path_to_source)
6060
)
@@ -88,7 +88,7 @@ def render_component(
8888
# Rendering options
8989
path_to_source, props=None, to_static_markup=None,
9090
# Bundling options
91-
bundle=None, translate=None, watch_source=None,
91+
bundle=None, translate=None, watch_source_files=None,
9292
# Prop handling
9393
json_encoder=None
9494
):
@@ -101,12 +101,12 @@ def render_component(
101101
if not os.path.exists(path_to_source):
102102
raise ComponentSourceFileNotFound(path_to_source)
103103

104-
if watch_source is None:
105-
watch_source = settings.WATCH_SOURCE
104+
if watch_source_files is None:
105+
watch_source_files = settings.WATCH_SOURCE_FILES
106106

107107
bundled_component = None
108-
if bundle or translate or watch_source:
109-
bundled_component = bundle_component(path_to_source, translate=translate, watch_source=watch_source)
108+
if bundle or translate or watch_source_files:
109+
bundled_component = bundle_component(path_to_source, translate=translate, watch_source_files=watch_source_files)
110110
path_to_source = bundled_component.get_assets()[0]['path']
111111

112112
if json_encoder is None:
@@ -129,5 +129,5 @@ def render_component(
129129
markup = res.text
130130

131131
return RenderedComponent(
132-
markup, path_to_source, props, serialized_props, watch_source, bundled_component, to_static_markup
132+
markup, path_to_source, props, serialized_props, watch_source_files, bundled_component, to_static_markup
133133
)

tests/test_functionality.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def test_rendered_components_which_are_bundled_have_access_to_their_bundle(self)
336336
translated_component = render_component(HELLO_WORLD_COMPONENT_JS, to_static_markup=True, translate=True)
337337
self.assertIsInstance(translated_component.get_bundle(), WebpackBundle)
338338

339-
watched_component = render_component(HELLO_WORLD_COMPONENT_JS, to_static_markup=True, watch_source=True)
339+
watched_component = render_component(HELLO_WORLD_COMPONENT_JS, to_static_markup=True, watch_source_files=True)
340340
self.assertIsInstance(watched_component.get_bundle(), WebpackBundle)
341341

342342
def test_bundled_components_can_get_access_to_their_variable(self):

tests/test_performance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_performance(self):
5656
path_to_component,
5757
props={'name': 'world'},
5858
translate=True,
59-
watch_source=True,
59+
watch_source_files=True,
6060
to_static_markup=True
6161
)
6262
)

0 commit comments

Comments
 (0)