WhakerPy 2.3__py3-none-any.whl → 2.4__py3-none-any.whl
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.
- whakerpy/__init__.py +1 -1
- whakerpy/htmlmaker/htmnodes/htmnode.py +27 -0
- whakerpy/webapp/webwsgi.py +19 -0
- {whakerpy-2.3.dist-info → whakerpy-2.4.dist-info}/METADATA +1 -1
- {whakerpy-2.3.dist-info → whakerpy-2.4.dist-info}/RECORD +9 -9
- {whakerpy-2.3.dist-info → whakerpy-2.4.dist-info}/WHEEL +0 -0
- {whakerpy-2.3.dist-info → whakerpy-2.4.dist-info}/licenses/AUTHORS.md +0 -0
- {whakerpy-2.3.dist-info → whakerpy-2.4.dist-info}/licenses/LICENSE.md +0 -0
- {whakerpy-2.3.dist-info → whakerpy-2.4.dist-info}/top_level.txt +0 -0
whakerpy/__init__.py
CHANGED
|
@@ -25,6 +25,6 @@ from .httpd import *
|
|
|
25
25
|
from .messages import error
|
|
26
26
|
from .webapp import *
|
|
27
27
|
|
|
28
|
-
__version__ = "2.
|
|
28
|
+
__version__ = "2.4"
|
|
29
29
|
___author__ = "Brigitte Bigi"
|
|
30
30
|
__copyright__ = "Copyright (C) 2023-2026 Brigitte Bigi, CNRS, Laboratoire Parole et Langage, Aix-en-Provence, France"
|
|
@@ -224,6 +224,33 @@ class TagNode(BaseTagNode):
|
|
|
224
224
|
"""Remove all children of the node."""
|
|
225
225
|
self._children.clear()
|
|
226
226
|
|
|
227
|
+
# -----------------------------------------------------------------------
|
|
228
|
+
# Convenient method to create and add a child node
|
|
229
|
+
# -----------------------------------------------------------------------
|
|
230
|
+
|
|
231
|
+
def element(self, tag: str = "div", ident=None, class_name=None, value=None) -> HTMLNode:
|
|
232
|
+
"""Create an HTML node and append it as a direct child of this node.
|
|
233
|
+
|
|
234
|
+
Convenient method to create a node and add it to the children of this
|
|
235
|
+
node in a single call, for example self.element("p", value="Hello.").
|
|
236
|
+
|
|
237
|
+
:param tag: (str) HTML element name
|
|
238
|
+
:param ident: (str) Optional identifier of the created node
|
|
239
|
+
:param class_name: (str) Optional value of the class attribute
|
|
240
|
+
:param value: (str) Optional text content of the tag
|
|
241
|
+
:return: (HTMLNode) The created and appended node
|
|
242
|
+
|
|
243
|
+
"""
|
|
244
|
+
attributes = dict()
|
|
245
|
+
if ident is not None:
|
|
246
|
+
attributes["id"] = str(ident)
|
|
247
|
+
if class_name is not None:
|
|
248
|
+
attributes["class"] = str(class_name)
|
|
249
|
+
|
|
250
|
+
node = HTMLNode(self.identifier, ident, tag, attributes=attributes, value=value)
|
|
251
|
+
self.append_child(node)
|
|
252
|
+
return node
|
|
253
|
+
|
|
227
254
|
# -----------------------------------------------------------------------
|
|
228
255
|
# HTML management: getters and setters
|
|
229
256
|
# -----------------------------------------------------------------------
|
whakerpy/webapp/webwsgi.py
CHANGED
|
@@ -60,6 +60,7 @@ key/values:
|
|
|
60
60
|
|
|
61
61
|
import os
|
|
62
62
|
import types
|
|
63
|
+
import logging
|
|
63
64
|
|
|
64
65
|
from ..httpd import HTTPDStatus
|
|
65
66
|
from ..httpd import HTTPDHandlerUtils
|
|
@@ -238,6 +239,14 @@ class WSGIApplication(object):
|
|
|
238
239
|
else:
|
|
239
240
|
# Process dynamic content. Events are empty if POST request.
|
|
240
241
|
events, accept = handler_utils.process_post(environ['wsgi.input'])
|
|
242
|
+
|
|
243
|
+
# A GET carries its data in the query string, the very same way a
|
|
244
|
+
# POST carries it in its body -- e.g. for a plain HTML form using
|
|
245
|
+
# method="get" (see do_GET() of the httpd request handler).
|
|
246
|
+
is_get = environ.get("REQUEST_METHOD", "GET").upper() == "GET"
|
|
247
|
+
if is_get is True:
|
|
248
|
+
events = HTTPDHandlerUtils.parse_query_string(environ.get("QUERY_STRING", ""))
|
|
249
|
+
|
|
241
250
|
has_to_return_data = HTTPDHandlerUtils.has_to_return_data(accept)
|
|
242
251
|
content, status = HTTPDHandlerUtils.bakery(
|
|
243
252
|
self._pages,
|
|
@@ -246,6 +255,16 @@ class WSGIApplication(object):
|
|
|
246
255
|
events,
|
|
247
256
|
has_to_return_data
|
|
248
257
|
)
|
|
258
|
+
|
|
259
|
+
# A GET is a navigation, not a form submission: query parameters
|
|
260
|
+
# the recipe does not handle (status 205) must not prevent the
|
|
261
|
+
# page from being served. The baked content is complete: serve
|
|
262
|
+
# it with a 200.
|
|
263
|
+
if is_get is True and status.code == 205:
|
|
264
|
+
logging.warning("Ignored unknown GET events {} for page {}"
|
|
265
|
+
"".format(events, page_name))
|
|
266
|
+
status = HTTPDStatus(200)
|
|
267
|
+
|
|
249
268
|
if has_to_return_data is False:
|
|
250
269
|
content = self.__policy.finalize_html(content)
|
|
251
270
|
return content, status
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
sample/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
sample/response.py,sha256=_jAaWLrHuGBYy0Y0aywxGrSDX365MSfASqWTISIotqw,12532
|
|
3
|
-
whakerpy/__init__.py,sha256=
|
|
3
|
+
whakerpy/__init__.py,sha256=5YZutVN8zQxpO9NNL-lL2TGUkaBv3dH70yZpOWoVz80,1827
|
|
4
4
|
whakerpy/messages.py,sha256=NSnQYFfarU16T59Zryuy2g2x7UwA8xgY_UDwRLQqPm4,2385
|
|
5
5
|
whakerpy/htmlmaker/__init__.py,sha256=zCHYhW37cyK68u90w2tFBLJx59ApGvqgNkxiIzuVtTM,3333
|
|
6
6
|
whakerpy/htmlmaker/hconsts.py,sha256=6I0Mmp72ZBzePGw-nH4qjD7TvENxXUPAT-qTeljwGe8,12115
|
|
@@ -16,7 +16,7 @@ whakerpy/htmlmaker/emptynodes/emptyelts.py,sha256=wqCtFMZU_bTCP4Z63Q3Pgwo1pNC1tM
|
|
|
16
16
|
whakerpy/htmlmaker/emptynodes/emptynode.py,sha256=caUy9V7CG-G_lgVwBAjMNKEdVeI8FBkTT28aREuuyXA,9920
|
|
17
17
|
whakerpy/htmlmaker/htmnodes/__init__.py,sha256=hOrs9nhL2aMCvukuPoOxRdinPAK_QFpWBpmTnp-iTQ8,1547
|
|
18
18
|
whakerpy/htmlmaker/htmnodes/htmelts.py,sha256=CTLX6hQWpulJuwW5F75gLTbKiiERkAkRLZ0LiHz9_lE,5398
|
|
19
|
-
whakerpy/htmlmaker/htmnodes/htmnode.py,sha256=
|
|
19
|
+
whakerpy/htmlmaker/htmnodes/htmnode.py,sha256=XpFspvlC5uFOPa723txR72OOZRPTGUFWVIPm0QjFIvw,12827
|
|
20
20
|
whakerpy/httpd/__init__.py,sha256=A4_Y6oN-8PY3TmGssX6DGKlUsE0wAGsNc5N1oo8HDK8,2031
|
|
21
21
|
whakerpy/httpd/handler.py,sha256=7hZc2rMALqRK2qKI1hYeN6FrrhBNDVcil5hjNdCpO4I,11518
|
|
22
22
|
whakerpy/httpd/hblacklist.py,sha256=H9-hhLGx9StYGo7ThBs23dVuqNRTveGvkt_SftH_oIc,6605
|
|
@@ -31,10 +31,10 @@ whakerpy/webapp/__init__.py,sha256=FCeq1HYEqFhGyquWajWVhWJbAsOYihBedtdUwpnQvis,2
|
|
|
31
31
|
whakerpy/webapp/webconfig.py,sha256=LmGUrfZ3btFSY3DoMpme2UXgiyHl48VlpnSXUyMk3MM,11215
|
|
32
32
|
whakerpy/webapp/weblocalserver.py,sha256=XjtVkUQPeFsVvX4ARLc_2_9eqc2KBmuQHMlxbr7DMUE,3180
|
|
33
33
|
whakerpy/webapp/webresponse.py,sha256=q4p12QHRFmq52K0lLkdqPJfexkG2SqZLluYF7Zg406g,4430
|
|
34
|
-
whakerpy/webapp/webwsgi.py,sha256=
|
|
35
|
-
whakerpy-2.
|
|
36
|
-
whakerpy-2.
|
|
37
|
-
whakerpy-2.
|
|
38
|
-
whakerpy-2.
|
|
39
|
-
whakerpy-2.
|
|
40
|
-
whakerpy-2.
|
|
34
|
+
whakerpy/webapp/webwsgi.py,sha256=6gmF9JxGn6pu3jYrJGGEnQG1msM3oi9q3y3sKQJmk2U,12511
|
|
35
|
+
whakerpy-2.4.dist-info/licenses/AUTHORS.md,sha256=VrCusdQ56bvNDiq7w_MA5mZoZXuP_JOG-ybTwpRT_u4,805
|
|
36
|
+
whakerpy-2.4.dist-info/licenses/LICENSE.md,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
|
37
|
+
whakerpy-2.4.dist-info/METADATA,sha256=oEM8cZQGhSD4gWNLBCvvwmWMGcc31Kf0bekFYVH20q4,15095
|
|
38
|
+
whakerpy-2.4.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
39
|
+
whakerpy-2.4.dist-info/top_level.txt,sha256=ZqGTnE-rI2S_jcI0kxnNeKd0z25TBv8Vkbe2iJ74-E0,16
|
|
40
|
+
whakerpy-2.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|