Skip to content

Commit 15ad46b

Browse files
committed
move render to main namespace
1 parent 6d015ce commit 15ad46b

File tree

16 files changed

+71
-19
lines changed

16 files changed

+71
-19
lines changed

src/hyperpython/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# We put all
88
try:
99
from .core import Element, Text, Block
10+
from .render import render, render_html
1011
from .tags import (
1112
HTML5, h,
1213
body, head, meta, link, title, div, span, article, aside, details, footer,

src/hyperpython/components/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from .core import render, render_html
21
from .data import html_map, html_list, html_table, wrap
32
from .hyperlinks import a_or_span, a_or_p, hyperlink, breadcrumbs, url
43
from .icons import icon, fa_icon, fab_icon

src/hyperpython/components/data.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from collections import Mapping, Iterable
22

3-
from hyperpython import Element, h
4-
from .core import render
3+
from ..core import Element
4+
from ..tags import h
5+
from ..render import render
56
from ..tags import ul, ol, li, dl, dd, dt, table, thead, tbody, tr, td, th
67

78

src/hyperpython/components/hyperlinks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import collections
22

3-
from .core import render
3+
from ..render import render
44
from ..core import Element
55
from ..tags import a, p, span, h
66
from ..utils import escape, lazy_singledispatch

src/hyperpython/components/text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sidekick as sk
2-
from hyperpython.utils import safe
2+
from ..utils import safe
33

44
_markdown = sk.import_later('markdown:markdown')
55

src/hyperpython/django/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .components import csrf_input
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from django.middleware.csrf import get_token
2+
3+
from .. import input_
4+
5+
6+
def csrf_input(request=None, token=None, name='csrfmiddlewaretoken',
7+
**kwargs):
8+
"""
9+
Return an <input> field with the CSRF token.
10+
11+
Normally, request should be given as first argument. If not given, one must
12+
provide a token value to be passed to the input element.
13+
"""
14+
15+
if request is None and token is not None:
16+
token = token
17+
elif request is not None:
18+
token = get_token(request)
19+
else:
20+
raise TypeError('cannot retrieve CSRF token from empty request.')
21+
return input_(type='hidden', name=name, value=token, **kwargs)

src/hyperpython/integrations/django/templates.py renamed to src/hyperpython/django/templates.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class Origin:
6363
A container to hold debug information as described in the template API
6464
documentation.
6565
"""
66+
6667
def __init__(self, name, template_name):
6768
self.name = name
6869
self.template_name = template_name

src/hyperpython/integrations/__init__.py

Whitespace-only changes.

src/hyperpython/integrations/django/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)