django-components 0.85__tar.gz → 0.86__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_components-0.85/src/django_components.egg-info → django_components-0.86}/PKG-INFO +2 -2
- {django_components-0.85 → django_components-0.86}/README.md +1 -1
- {django_components-0.85 → django_components-0.86}/pyproject.toml +1 -1
- django_components-0.86/src/django_components/management/commands/upgradecomponent.py +69 -0
- {django_components-0.85 → django_components-0.86/src/django_components.egg-info}/PKG-INFO +2 -2
- django_components-0.85/src/django_components/management/commands/upgradecomponent.py +0 -66
- {django_components-0.85 → django_components-0.86}/LICENSE +0 -0
- {django_components-0.85 → django_components-0.86}/setup.cfg +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/__init__.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/app_settings.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/apps.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/attributes.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/autodiscover.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/component.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/component_media.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/component_registry.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/context.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/expression.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/logger.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/management/__init__.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/management/commands/__init__.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/management/commands/startcomponent.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/middleware.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/node.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/provide.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/py.typed +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/safer_staticfiles/__init__.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/safer_staticfiles/apps.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/slots.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/template_loader.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/template_parser.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/templatetags/__init__.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/templatetags/component_tags.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/types.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components/utils.py +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components.egg-info/SOURCES.txt +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components.egg-info/dependency_links.txt +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components.egg-info/requires.txt +0 -0
- {django_components-0.85 → django_components-0.86}/src/django_components.egg-info/top_level.txt +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_attributes.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_autodiscover.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_command_startcomponent.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_component.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_component_as_view.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_component_media.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_context.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_dependency_rendering.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_registry.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_safer_staticfiles.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_settings.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_template_loader.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_template_parser.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_templatetags.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_templatetags_component.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_templatetags_provide.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_templatetags_slot_fill.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/test_templatetags_templating.py +0 -0
- {django_components-0.85 → django_components-0.86}/tests/testutils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: django_components
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.86
|
|
4
4
|
Summary: A way to create simple reusable template components in Django.
|
|
5
5
|
Author-email: Emil Stenström <emil@emilstenstrom.se>
|
|
6
6
|
License: MIT
|
|
@@ -104,7 +104,7 @@ And this is what gets rendered (plus the CSS and Javascript you've specified):
|
|
|
104
104
|
|
|
105
105
|
**Version 0.67** CHANGED the default way how context variables are resolved in slots. See the [documentation](https://github.com/EmilStenstrom/django-components/tree/0.67#isolate-components-slots) for more details.
|
|
106
106
|
|
|
107
|
-
🚨📢 **Version 0.5** CHANGES THE SYNTAX for components. `component_block` is now `component`, and `component` blocks need an ending `endcomponent` tag. The new `python manage.py upgradecomponent` command can be used to upgrade a directory (use --path argument to point to each dir) of components to the new syntax automatically.
|
|
107
|
+
🚨📢 **Version 0.5** CHANGES THE SYNTAX for components. `component_block` is now `component`, and `component` blocks need an ending `endcomponent` tag. The new `python manage.py upgradecomponent` command can be used to upgrade a directory (use --path argument to point to each dir) of templates that use components to the new syntax automatically.
|
|
108
108
|
|
|
109
109
|
This change is done to simplify the API in anticipation of a 1.0 release of django_components. After 1.0 we intend to be stricter with big changes like this in point releases.
|
|
110
110
|
|
|
@@ -80,7 +80,7 @@ And this is what gets rendered (plus the CSS and Javascript you've specified):
|
|
|
80
80
|
|
|
81
81
|
**Version 0.67** CHANGED the default way how context variables are resolved in slots. See the [documentation](https://github.com/EmilStenstrom/django-components/tree/0.67#isolate-components-slots) for more details.
|
|
82
82
|
|
|
83
|
-
🚨📢 **Version 0.5** CHANGES THE SYNTAX for components. `component_block` is now `component`, and `component` blocks need an ending `endcomponent` tag. The new `python manage.py upgradecomponent` command can be used to upgrade a directory (use --path argument to point to each dir) of components to the new syntax automatically.
|
|
83
|
+
🚨📢 **Version 0.5** CHANGES THE SYNTAX for components. `component_block` is now `component`, and `component` blocks need an ending `endcomponent` tag. The new `python manage.py upgradecomponent` command can be used to upgrade a directory (use --path argument to point to each dir) of templates that use components to the new syntax automatically.
|
|
84
84
|
|
|
85
85
|
This change is done to simplify the API in anticipation of a 1.0 release of django_components. After 1.0 we intend to be stricter with big changes like this in point releases.
|
|
86
86
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "django_components"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.86"
|
|
8
8
|
requires-python = ">=3.8, <4.0"
|
|
9
9
|
description = "A way to create simple reusable template components in Django."
|
|
10
10
|
keywords = ["django", "components", "css", "js", "html"]
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from django.conf import settings
|
|
7
|
+
from django.core.management.base import BaseCommand, CommandParser
|
|
8
|
+
from django.template.engine import Engine
|
|
9
|
+
|
|
10
|
+
from django_components.template_loader import Loader
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Command(BaseCommand):
|
|
14
|
+
help = "Updates component and component_block tags to the new syntax"
|
|
15
|
+
|
|
16
|
+
def add_arguments(self, parser: CommandParser) -> None:
|
|
17
|
+
parser.add_argument("--path", type=str, help="Path to search for components")
|
|
18
|
+
|
|
19
|
+
def handle(self, *args: Any, **options: Any) -> None:
|
|
20
|
+
current_engine = Engine.get_default()
|
|
21
|
+
loader = Loader(current_engine)
|
|
22
|
+
dirs = loader.get_dirs()
|
|
23
|
+
|
|
24
|
+
if settings.BASE_DIR:
|
|
25
|
+
dirs.append(Path(settings.BASE_DIR) / "templates")
|
|
26
|
+
|
|
27
|
+
if options["path"]:
|
|
28
|
+
dirs = [options["path"]]
|
|
29
|
+
|
|
30
|
+
for dir_path in dirs:
|
|
31
|
+
self.stdout.write(f"Searching for components in {dir_path}...")
|
|
32
|
+
for root, _, files in os.walk(dir_path):
|
|
33
|
+
for file in files:
|
|
34
|
+
if file.endswith((".html", ".py")):
|
|
35
|
+
file_path = os.path.join(root, file)
|
|
36
|
+
with open(file_path, "r+", encoding="utf-8") as f:
|
|
37
|
+
content = f.read()
|
|
38
|
+
content_with_closed_components, step0_count = re.subn(
|
|
39
|
+
r'({%\s*component\s*"(\w+?)"(.*?)%})(?!.*?{%\s*endcomponent\s*%})',
|
|
40
|
+
r"\1{% endcomponent %}",
|
|
41
|
+
content,
|
|
42
|
+
flags=re.DOTALL,
|
|
43
|
+
)
|
|
44
|
+
updated_content, step1_count_opening = re.subn(
|
|
45
|
+
r'{%\s*component_block\s*"(\w+?)"\s*(.*?)%}',
|
|
46
|
+
r'{% component "\1" \2%}',
|
|
47
|
+
content_with_closed_components,
|
|
48
|
+
flags=re.DOTALL,
|
|
49
|
+
)
|
|
50
|
+
updated_content, step2_count_closing = re.subn(
|
|
51
|
+
r'{%\s*endcomponent_block\s*"(\w+?)"\s*%}',
|
|
52
|
+
r"{% endcomponent %}",
|
|
53
|
+
updated_content,
|
|
54
|
+
flags=re.DOTALL,
|
|
55
|
+
)
|
|
56
|
+
updated_content, step2_count_closing_no_name = re.subn(
|
|
57
|
+
r"{%\s*endcomponent_block\s*%}",
|
|
58
|
+
r"{% endcomponent %}",
|
|
59
|
+
updated_content,
|
|
60
|
+
flags=re.DOTALL,
|
|
61
|
+
)
|
|
62
|
+
total_updates = (
|
|
63
|
+
step0_count + step1_count_opening + step2_count_closing + step2_count_closing_no_name
|
|
64
|
+
)
|
|
65
|
+
if total_updates > 0:
|
|
66
|
+
f.seek(0)
|
|
67
|
+
f.write(updated_content)
|
|
68
|
+
f.truncate()
|
|
69
|
+
self.stdout.write(f"Updated {file_path}: {total_updates} changes made")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: django_components
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.86
|
|
4
4
|
Summary: A way to create simple reusable template components in Django.
|
|
5
5
|
Author-email: Emil Stenström <emil@emilstenstrom.se>
|
|
6
6
|
License: MIT
|
|
@@ -104,7 +104,7 @@ And this is what gets rendered (plus the CSS and Javascript you've specified):
|
|
|
104
104
|
|
|
105
105
|
**Version 0.67** CHANGED the default way how context variables are resolved in slots. See the [documentation](https://github.com/EmilStenstrom/django-components/tree/0.67#isolate-components-slots) for more details.
|
|
106
106
|
|
|
107
|
-
🚨📢 **Version 0.5** CHANGES THE SYNTAX for components. `component_block` is now `component`, and `component` blocks need an ending `endcomponent` tag. The new `python manage.py upgradecomponent` command can be used to upgrade a directory (use --path argument to point to each dir) of components to the new syntax automatically.
|
|
107
|
+
🚨📢 **Version 0.5** CHANGES THE SYNTAX for components. `component_block` is now `component`, and `component` blocks need an ending `endcomponent` tag. The new `python manage.py upgradecomponent` command can be used to upgrade a directory (use --path argument to point to each dir) of templates that use components to the new syntax automatically.
|
|
108
108
|
|
|
109
109
|
This change is done to simplify the API in anticipation of a 1.0 release of django_components. After 1.0 we intend to be stricter with big changes like this in point releases.
|
|
110
110
|
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import re
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
from typing import Any
|
|
5
|
-
|
|
6
|
-
from django.conf import settings
|
|
7
|
-
from django.core.management.base import BaseCommand, CommandParser
|
|
8
|
-
from django.template.engine import Engine
|
|
9
|
-
|
|
10
|
-
from django_components.template_loader import Loader
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class Command(BaseCommand):
|
|
14
|
-
help = "Updates component and component_block tags to the new syntax"
|
|
15
|
-
|
|
16
|
-
def add_arguments(self, parser: CommandParser) -> None:
|
|
17
|
-
parser.add_argument("--path", type=str, help="Path to search for components")
|
|
18
|
-
|
|
19
|
-
def handle(self, *args: Any, **options: Any) -> None:
|
|
20
|
-
current_engine = Engine.get_default()
|
|
21
|
-
loader = Loader(current_engine)
|
|
22
|
-
dirs = loader.get_dirs()
|
|
23
|
-
|
|
24
|
-
if settings.BASE_DIR:
|
|
25
|
-
dirs.append(Path(settings.BASE_DIR) / "templates")
|
|
26
|
-
|
|
27
|
-
if options["path"]:
|
|
28
|
-
dirs = [options["path"]]
|
|
29
|
-
|
|
30
|
-
for dir_path in dirs:
|
|
31
|
-
self.stdout.write(f"Searching for components in {dir_path}...")
|
|
32
|
-
for root, _, files in os.walk(dir_path):
|
|
33
|
-
for file in files:
|
|
34
|
-
if file.endswith((".html", ".py")):
|
|
35
|
-
file_path = os.path.join(root, file)
|
|
36
|
-
with open(file_path, "r+", encoding="utf-8") as f:
|
|
37
|
-
content = f.read()
|
|
38
|
-
content_with_closed_components, step0_count = re.subn(
|
|
39
|
-
r'({%\s*component\s*"(\w+?)"(.*?)%})(?!.*?{%\s*endcomponent\s*%})',
|
|
40
|
-
r"\1{% endcomponent %}",
|
|
41
|
-
content,
|
|
42
|
-
flags=re.DOTALL,
|
|
43
|
-
)
|
|
44
|
-
updated_content, step1_count_opening = re.subn(
|
|
45
|
-
r'{%\s*component_block\s*"(\w+?)"\s*(.*?)%}',
|
|
46
|
-
r'{% component "\1" \2%}',
|
|
47
|
-
content_with_closed_components,
|
|
48
|
-
flags=re.DOTALL,
|
|
49
|
-
)
|
|
50
|
-
updated_content, step2_count_closing = re.subn(
|
|
51
|
-
r'{%\s*endcomponent_block\s*"(\w+?)"\s*%}',
|
|
52
|
-
r"{% endcomponent %}",
|
|
53
|
-
updated_content,
|
|
54
|
-
flags=re.DOTALL,
|
|
55
|
-
)
|
|
56
|
-
updated_content, step2_count_closing_no_name = re.subn(
|
|
57
|
-
r"{%\s*endcomponent_block\s*%}", r"{% endcomponent %}", updated_content, flags=re.DOTALL
|
|
58
|
-
)
|
|
59
|
-
total_updates = (
|
|
60
|
-
step0_count + step1_count_opening + step2_count_closing + step2_count_closing_no_name
|
|
61
|
-
)
|
|
62
|
-
if total_updates > 0:
|
|
63
|
-
f.seek(0)
|
|
64
|
-
f.write(updated_content)
|
|
65
|
-
f.truncate()
|
|
66
|
-
self.stdout.write(f"Updated {file_path}: {total_updates} changes made")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_components-0.85 → django_components-0.86}/src/django_components/component_registry.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_components-0.85 → django_components-0.86}/src/django_components/management/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_components-0.85 → django_components-0.86}/src/django_components/safer_staticfiles/apps.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_components-0.85 → django_components-0.86}/src/django_components/templatetags/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_components-0.85 → django_components-0.86}/src/django_components.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{django_components-0.85 → django_components-0.86}/src/django_components.egg-info/requires.txt
RENAMED
|
File without changes
|
{django_components-0.85 → django_components-0.86}/src/django_components.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|