Skip to content

Commit 80a6058

Browse files
add application param (1.1.17)
1 parent aea8e89 commit 80a6058

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "PyWSGIRef"
3-
version = "1.1.16"
3+
version = "1.1.17"
44
authors = [
55
{name="Leander Kafemann", email="[email protected]" },
66
]

src/PyWSGIRef/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def about():
1818
"""
1919
Returns information about your release and other projects by Leander Kafemann
2020
"""
21-
return {"Version": (1, 1, 16), "Author": "Leander Kafemann", "date": "05.09.2025",\
21+
return {"Version": (1, 1, 17), "Author": "Leander Kafemann", "date": "02.11.2025",\
2222
"recommend": ("pyimager"), "feedbackTo": "[email protected]"}
2323

2424
SCHABLONEN = TemplateDict()
@@ -34,7 +34,8 @@ def addSchablone(name: str, content: str):
3434
SCHABLONEN[name] = PyHTML(content)
3535

3636
def makeApplicationObject(contentGeneratingFunction: Callable, advanced: bool = False, setAdvancedHeaders: bool = False,\
37-
getIP: bool = False, vercelPythonHosting: bool = False, getStats: bool = False) -> Callable:
37+
getIP: bool = False, vercelPythonHosting: bool = False, getStats: bool = False,
38+
customEncoding: bool = False) -> Callable:
3839
"""
3940
Returns a WSGI application object based on your contentGeneratingFunction.
4041
The contentGeneratingFunction should take a single argument (the path) and return the content as a string.
@@ -43,6 +44,7 @@ def makeApplicationObject(contentGeneratingFunction: Callable, advanced: bool =
4344
If getIP is True, the contentGeneratingFunction will receive the IP address of the client as an additional argument.
4445
If vercelPythonHosting is True, your application object will be optimized for Vercel's unusual WSGI methods.
4546
If getStats is True, stats are saved in the STATS object (BETA).
47+
If customEncoding is True, the contentGeneratingFunction has to encode the content itself.
4648
Locks BETA mode.
4749
"""
4850
if not callable(contentGeneratingFunction):
@@ -85,6 +87,8 @@ def simpleApplication(environ, start_response) -> list:
8587
if getStats:
8688
STATS.stopPerfTime(perfTime)
8789
if not vercelPythonHosting:
90+
if customEncoding:
91+
return content
8892
return [content.encode("utf-8")]
8993
return simpleApplication
9094

0 commit comments

Comments
 (0)