Skip to content

Commit 407b506

Browse files
committed
rename URL resolver functions
1 parent fbb0037 commit 407b506

File tree

5 files changed

+21
-15
lines changed

5 files changed

+21
-15
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ your_app/
5353
To start, we'll need to use [`channels`](https://channels.readthedocs.io/en/stable/) to
5454
create a `ProtocolTypeRouter` that will become the top of our ASGI application stack.
5555
Under the `"websocket"` protocol, we'll then add a path for IDOM's websocket consumer
56-
using `django_idom_websocket_consumer_path`. If you wish to change the route where this
56+
using `idom_websocket_path`. If you wish to change the route where this
5757
websocket is served from see the [settings](#configuration-options).
5858

5959
```python
@@ -62,7 +62,7 @@ import os
6262

6363
from django.core.asgi import get_asgi_application
6464

65-
from django_idom import django_idom_websocket_consumer_path
65+
from django_idom import idom_websocket_path
6666

6767
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_app.settings")
6868

@@ -76,7 +76,7 @@ application = ProtocolTypeRouter(
7676
"http": http_asgi_app,
7777
"websocket": URLRouter(
7878
# add a path for IDOM's websocket
79-
[django_idom_websocket_consumer_path()]
79+
[idom_websocket_path()]
8080
),
8181
}
8282
)
@@ -158,17 +158,17 @@ Your view for this template can be defined just
158158
## `urls.py`
159159

160160
To your list of URLs you'll need to include IDOM's static web modules path using
161-
`django_idom_web_modules_path`:
161+
`idom_web_modules_path`:
162162

163163
```python
164164
from django.urls import path
165-
from django_idom import django_idom_web_modules_path
165+
from django_idom import idom_web_modules_path
166166
from .views import your_template # define this view like any other HTML template
167167

168168

169169
urlpatterns = [
170170
path("", your_template),
171-
django_idom_web_modules_path(),
171+
idom_web_modules_path(),
172172
]
173173
```
174174

src/django_idom/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from .app_paths import django_idom_web_modules_path, django_idom_websocket_consumer_path
1+
from .app_paths import idom_web_modules_path, idom_websocket_path
22

33

44
__version__ = "0.0.1"
5-
__all__ = ["django_idom_websocket_consumer_path", "django_idom_web_modules_path"]
5+
__all__ = ["idom_websocket_path", "idom_web_modules_path"]

src/django_idom/app_paths.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
from .websocket_consumer import IdomAsyncWebSocketConsumer
66

77

8-
def django_idom_websocket_consumer_path(*args, **kwargs):
8+
def idom_websocket_path(*args, **kwargs):
99
"""Return a URL resolver for :class:`IdomAsyncWebSocketConsumer`
1010
1111
While this is relatively uncommon in most Django apps, because the URL of the
1212
websocket must be defined by the setting ``IDOM_WEBSOCKET_URL``. There's no need
13-
to allow users to configure the URL themselves
13+
to allow users to configure the URL themselves.
1414
"""
1515
return path(
1616
IDOM_WEBSOCKET_URL + "<view_id>/",
@@ -20,7 +20,13 @@ def django_idom_websocket_consumer_path(*args, **kwargs):
2020
)
2121

2222

23-
def django_idom_web_modules_path(*args, **kwargs):
23+
def idom_web_modules_path(*args, **kwargs):
24+
"""Return a URL resolver for static web modules required by IDOM
25+
26+
While this is relatively uncommon in most Django apps, because the URL of the
27+
websocket must be defined by the setting ``IDOM_WEBSOCKET_URL``. There's no need
28+
to allow users to configure the URL themselves.
29+
"""
2430
return path(
2531
IDOM_WEB_MODULES_URL + "<path:file>",
2632
views.web_modules_file,

tests/test_app/asgi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from django.core.asgi import get_asgi_application
1313

14-
from django_idom import django_idom_websocket_consumer_path
14+
from django_idom import idom_websocket_path
1515

1616

1717
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_app.settings")
@@ -25,6 +25,6 @@
2525
application = ProtocolTypeRouter(
2626
{
2727
"http": http_asgi_app,
28-
"websocket": URLRouter([django_idom_websocket_consumer_path()]),
28+
"websocket": URLRouter([idom_websocket_path()]),
2929
}
3030
)

tests/test_app/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
"""
2020
from django.urls import path
2121

22-
from django_idom import django_idom_web_modules_path
22+
from django_idom import idom_web_modules_path
2323

2424
from .views import base_template
2525

2626

2727
urlpatterns = [
2828
path("", base_template),
29-
django_idom_web_modules_path(),
29+
idom_web_modules_path(),
3030
]

0 commit comments

Comments
 (0)