Skip to content

Commit 21ec195

Browse files
committed
refactor: fold web_fragments into project
1 parent a8f914b commit 21ec195

13 files changed

Lines changed: 754 additions & 14 deletions

File tree

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ dependencies = [
3333
"pytz",
3434
"pyyaml",
3535
"simplejson",
36-
"web-fragments",
3736
"webob>=1.6.0",
3837
]
3938

@@ -52,8 +51,10 @@ local_scheme = "no-local-version"
5251

5352
[tool.setuptools]
5453
include-package-data = true
55-
56-
[tool.setuptools.packages.find]
54+
packages = [
55+
"xblock",
56+
"web_fragments",
57+
]
5758

5859
[tool.setuptools.package-data]
5960
"xblock.utils" = ["public/*", "templates/*", "templatetags/*"]

uv.lock

Lines changed: 4 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web_fragments/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"""
2+
Web fragments.
3+
"""
4+
__version__ = '4.0.0'

web_fragments/apps.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""
2+
Web Fragments Django application initialization.
3+
"""
4+
from django.apps import AppConfig
5+
6+
7+
class WebFragmentsConfig(AppConfig):
8+
"""
9+
Configuration for the Web Fragments Django application.
10+
"""
11+
12+
name = 'web_fragments'

web_fragments/examples/__init__.py

Whitespace-only changes.

web_fragments/examples/urls.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Provides a URL for testing
5+
"""
6+
from django.urls import path
7+
8+
from web_fragments.examples.views import EXAMPLE_FRAGMENT_VIEW_NAME, ExampleFragmentView
9+
10+
urlpatterns = [
11+
path('test_fragment', ExampleFragmentView.as_view(), name=EXAMPLE_FRAGMENT_VIEW_NAME),
12+
]

web_fragments/examples/views.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Example fragment view.
5+
"""
6+
from web_fragments.fragment import Fragment
7+
from web_fragments.test_utils import TEST_CSS, TEST_HTML, TEST_JS
8+
from web_fragments.views import FragmentView
9+
10+
EXAMPLE_FRAGMENT_VIEW_NAME = 'example_fragment_view'
11+
12+
13+
class ExampleFragmentView(FragmentView):
14+
"""
15+
Simple fragment view for testing.
16+
"""
17+
18+
def render_to_fragment(self, request, **kwargs):
19+
"""
20+
Returns a simple fragment
21+
"""
22+
fragment = Fragment(TEST_HTML)
23+
fragment.add_javascript(TEST_JS)
24+
fragment.add_css(TEST_CSS)
25+
return fragment

0 commit comments

Comments
 (0)