PyWSGIRef 1.1.7__tar.gz → 1.1.9__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.
- {pywsgiref-1.1.7/src/PyWSGIRef.egg-info → pywsgiref-1.1.9}/PKG-INFO +8 -5
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/README.md +7 -3
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/pyproject.toml +1 -2
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef/__init__.py +2 -2
- pywsgiref-1.1.9/src/PyWSGIRef/patterns.py +13 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef/pyhtml.py +44 -2
- {pywsgiref-1.1.7 → pywsgiref-1.1.9/src/PyWSGIRef.egg-info}/PKG-INFO +8 -5
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef.egg-info/requires.txt +0 -1
- pywsgiref-1.1.7/src/PyWSGIRef/patterns.py +0 -9
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/LICENSE +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/setup.cfg +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef/__main__.py +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef/beta.py +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef/commons.py +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef/defaults.py +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef/exceptions.py +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef/finished.py +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef/loadContent.py +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef/simpleServer.py +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef/templateDict.py +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef.egg-info/SOURCES.txt +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef.egg-info/dependency_links.txt +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/src/PyWSGIRef.egg-info/top_level.txt +0 -0
- {pywsgiref-1.1.7 → pywsgiref-1.1.9}/tests/testMainServer.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyWSGIRef
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.9
|
|
4
4
|
Summary: easy server-setup
|
|
5
5
|
Author-email: Leander Kafemann <leander@kafemann.berlin>
|
|
6
6
|
Project-URL: Homepage, https://github.com/LeanderKafemann/PyWSGIRef
|
|
@@ -11,7 +11,6 @@ Requires-Python: >=3.11
|
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
13
|
Requires-Dist: requests
|
|
14
|
-
Requires-Dist: typing
|
|
15
14
|
Requires-Dist: legacy-cgi
|
|
16
15
|
Requires-Dist: naturalsize
|
|
17
16
|
Dynamic: license-file
|
|
@@ -159,7 +158,11 @@ PyWSGIRef also provides a simple way to end PyHTML files:<br/>
|
|
|
159
158
|
just use the <code><{{evalPyHTML}}></code> phrase at the end of the document and<br/>
|
|
160
159
|
PyWSGIRef will automatically add the closing html and body tags.<br/><br/>
|
|
161
160
|
You can also add PyWSGIRef's own, featured modern stylesheet using:<br/>
|
|
162
|
-
<code><{{evalPyHTML-modernStyling: true}}></code> inside the head block of your PyHTML file
|
|
161
|
+
<code><{{evalPyHTML-modernStyling: true}}></code> inside the head block of your PyHTML file.<br/><br/>
|
|
162
|
+
With the <code><{{evalPyHTML-script: alert('Hello, World!'); :script-}}></code> phrase,<br/>
|
|
163
|
+
you can add a script block anywhere inside your PyHTML file.<br/>
|
|
164
|
+
Using pretty much the same syntax, you can also add a style block using
|
|
165
|
+
<code><{{evalPyHTML-style: body { background-color: lightblue; } :style-}}></code>.
|
|
163
166
|
### Shutting down your server
|
|
164
167
|
You can shut down your server by calling the <code>shutdown</code> method on the server object:
|
|
165
168
|
```python
|
|
@@ -189,8 +192,8 @@ from PyWSGIRef import BETA
|
|
|
189
192
|
BETA.enable()
|
|
190
193
|
```
|
|
191
194
|
Currently to be tested are:<br/>
|
|
192
|
-
- PyHTML
|
|
193
|
-
- PyHTML
|
|
195
|
+
- PyHTML python script blocks<br/>
|
|
196
|
+
- PyHTML python if clause blocks<br/>
|
|
194
197
|
- PyHTML include static resource blocks<br/><br/>
|
|
195
198
|
|
|
196
199
|
Thanks a lot for helping improving PyWSGIRef!
|
|
@@ -141,7 +141,11 @@ PyWSGIRef also provides a simple way to end PyHTML files:<br/>
|
|
|
141
141
|
just use the <code><{{evalPyHTML}}></code> phrase at the end of the document and<br/>
|
|
142
142
|
PyWSGIRef will automatically add the closing html and body tags.<br/><br/>
|
|
143
143
|
You can also add PyWSGIRef's own, featured modern stylesheet using:<br/>
|
|
144
|
-
<code><{{evalPyHTML-modernStyling: true}}></code> inside the head block of your PyHTML file
|
|
144
|
+
<code><{{evalPyHTML-modernStyling: true}}></code> inside the head block of your PyHTML file.<br/><br/>
|
|
145
|
+
With the <code><{{evalPyHTML-script: alert('Hello, World!'); :script-}}></code> phrase,<br/>
|
|
146
|
+
you can add a script block anywhere inside your PyHTML file.<br/>
|
|
147
|
+
Using pretty much the same syntax, you can also add a style block using
|
|
148
|
+
<code><{{evalPyHTML-style: body { background-color: lightblue; } :style-}}></code>.
|
|
145
149
|
### Shutting down your server
|
|
146
150
|
You can shut down your server by calling the <code>shutdown</code> method on the server object:
|
|
147
151
|
```python
|
|
@@ -171,8 +175,8 @@ from PyWSGIRef import BETA
|
|
|
171
175
|
BETA.enable()
|
|
172
176
|
```
|
|
173
177
|
Currently to be tested are:<br/>
|
|
174
|
-
- PyHTML
|
|
175
|
-
- PyHTML
|
|
178
|
+
- PyHTML python script blocks<br/>
|
|
179
|
+
- PyHTML python if clause blocks<br/>
|
|
176
180
|
- PyHTML include static resource blocks<br/><br/>
|
|
177
181
|
|
|
178
182
|
Thanks a lot for helping improving PyWSGIRef!
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "PyWSGIRef"
|
|
3
|
-
version = "1.1.
|
|
3
|
+
version = "1.1.9"
|
|
4
4
|
authors = [
|
|
5
5
|
{name="Leander Kafemann", email="leander@kafemann.berlin" },
|
|
6
6
|
]
|
|
@@ -14,7 +14,6 @@ classifiers = [
|
|
|
14
14
|
]
|
|
15
15
|
dependencies = [
|
|
16
16
|
"requests",
|
|
17
|
-
"typing",
|
|
18
17
|
"legacy-cgi",
|
|
19
18
|
"naturalsize",
|
|
20
19
|
]
|
|
@@ -17,8 +17,8 @@ def about():
|
|
|
17
17
|
"""
|
|
18
18
|
Returns information about your release and other projects by Leander Kafemann
|
|
19
19
|
"""
|
|
20
|
-
return {"Version": (1, 1,
|
|
21
|
-
"recommend": ("
|
|
20
|
+
return {"Version": (1, 1, 9), "Author": "Leander Kafemann", "date": "21.06.2025",\
|
|
21
|
+
"recommend": ("Buero by LK", "pyimager by LK"), "feedbackTo": "leander@kafemann.berlin"}
|
|
22
22
|
|
|
23
23
|
SCHABLONEN = TemplateDict()
|
|
24
24
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
EVAL_PYHTML = "<{{evalPyHTML}}>"
|
|
2
|
+
|
|
3
|
+
MODERN_STYLING_PHRASE = "<{{evalPyHTML-modernStyling: true}}>"
|
|
4
|
+
|
|
5
|
+
INCLUDE_PATTERN = r"<\{\{evalPyHTML-include: (.*?) :include-\}\}\>"
|
|
6
|
+
|
|
7
|
+
SCRIPT_PATTERN = r"<\{\{evalPyHTML-script: (.*?) :script-\}\}\>"
|
|
8
|
+
|
|
9
|
+
STYLE_PATTERN = r"<\{\{evalPyHTML-style: (.*?) :style-\}\}\>"
|
|
10
|
+
|
|
11
|
+
EVAL_BLOCK_PATTERN = r"<\{\{evalPyHTML-eval: (.*?) :eval-\}\}\>"
|
|
12
|
+
|
|
13
|
+
IF_BLOCK_PATTERN = r"<\{\{evalPyHTML-if: (.*?)\}\}\>(.*?)((<\{\{evalPyHTML-else\}\}\>(.*?))?)<\{\{evalPyHTML-endif\}\}\>"
|
|
@@ -76,6 +76,46 @@ class PyHTML:
|
|
|
76
76
|
replacement = f"<style>{style_content}</style>"
|
|
77
77
|
self.html = self.html[:idx] + replacement + self.html[idxEnd:]
|
|
78
78
|
|
|
79
|
+
def _replace_eval_blocks(self, context=None):
|
|
80
|
+
"""
|
|
81
|
+
Replaces eval replacement phrases with evaluated Python expressions.
|
|
82
|
+
WARNING: This method uses eval, which can execute arbitrary code.
|
|
83
|
+
"""
|
|
84
|
+
if context is None:
|
|
85
|
+
context = {}
|
|
86
|
+
for match in re.finditer(EVAL_BLOCK_PATTERN, self.html, re.DOTALL):
|
|
87
|
+
idx, idxEnd = match.span()
|
|
88
|
+
code = match.group(1).strip()
|
|
89
|
+
try:
|
|
90
|
+
# eval f�r Ausdr�cke, exec f�r Statements
|
|
91
|
+
result = str(eval(code, {}, context))
|
|
92
|
+
except Exception as e:
|
|
93
|
+
result = f"<b>EvalError: {e}</b>"
|
|
94
|
+
self.html = self.html[:idx] + result + self.html[idxEnd:]
|
|
95
|
+
|
|
96
|
+
def _replace_if_blocks(self, context=None):
|
|
97
|
+
"""
|
|
98
|
+
Replaces with html code based on the evaluation of conditions in if blocks.
|
|
99
|
+
"""
|
|
100
|
+
if context is None:
|
|
101
|
+
context = {}
|
|
102
|
+
# re.DOTALL f�r mehrzeilige Bl�cke
|
|
103
|
+
while True:
|
|
104
|
+
match = re.search(IF_BLOCK_PATTERN, self.html, re.DOTALL)
|
|
105
|
+
if not match:
|
|
106
|
+
break
|
|
107
|
+
condition = match.group(1).strip()
|
|
108
|
+
if_content = match.group(2)
|
|
109
|
+
else_content = match.group(5) if match.group(5) is not None else ""
|
|
110
|
+
try:
|
|
111
|
+
if eval(condition, {}, context):
|
|
112
|
+
replacement = if_content
|
|
113
|
+
else:
|
|
114
|
+
replacement = else_content
|
|
115
|
+
except Exception as e:
|
|
116
|
+
replacement = f"<b>IfEvalError: {e}</b>"
|
|
117
|
+
self.html = self.html[:match.start()] + replacement + self.html[match.end():]
|
|
118
|
+
|
|
79
119
|
def decode(self):
|
|
80
120
|
"""
|
|
81
121
|
Decodes the HTML content by replacing specific phrases and applying modern styling.
|
|
@@ -83,10 +123,12 @@ class PyHTML:
|
|
|
83
123
|
self.html = self.html.strip()
|
|
84
124
|
self._replace_eval_phrase()
|
|
85
125
|
self._replace_modern_styling()
|
|
126
|
+
self._replace_script_blocks()
|
|
127
|
+
self._replace_style_blocks()
|
|
86
128
|
if BETA.value:
|
|
87
129
|
self._replace_includes()
|
|
88
|
-
self.
|
|
89
|
-
self.
|
|
130
|
+
self._replace_eval_blocks()
|
|
131
|
+
self._replace_if_blocks()
|
|
90
132
|
|
|
91
133
|
def decoded(self) -> str:
|
|
92
134
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyWSGIRef
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.9
|
|
4
4
|
Summary: easy server-setup
|
|
5
5
|
Author-email: Leander Kafemann <leander@kafemann.berlin>
|
|
6
6
|
Project-URL: Homepage, https://github.com/LeanderKafemann/PyWSGIRef
|
|
@@ -11,7 +11,6 @@ Requires-Python: >=3.11
|
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
13
|
Requires-Dist: requests
|
|
14
|
-
Requires-Dist: typing
|
|
15
14
|
Requires-Dist: legacy-cgi
|
|
16
15
|
Requires-Dist: naturalsize
|
|
17
16
|
Dynamic: license-file
|
|
@@ -159,7 +158,11 @@ PyWSGIRef also provides a simple way to end PyHTML files:<br/>
|
|
|
159
158
|
just use the <code><{{evalPyHTML}}></code> phrase at the end of the document and<br/>
|
|
160
159
|
PyWSGIRef will automatically add the closing html and body tags.<br/><br/>
|
|
161
160
|
You can also add PyWSGIRef's own, featured modern stylesheet using:<br/>
|
|
162
|
-
<code><{{evalPyHTML-modernStyling: true}}></code> inside the head block of your PyHTML file
|
|
161
|
+
<code><{{evalPyHTML-modernStyling: true}}></code> inside the head block of your PyHTML file.<br/><br/>
|
|
162
|
+
With the <code><{{evalPyHTML-script: alert('Hello, World!'); :script-}}></code> phrase,<br/>
|
|
163
|
+
you can add a script block anywhere inside your PyHTML file.<br/>
|
|
164
|
+
Using pretty much the same syntax, you can also add a style block using
|
|
165
|
+
<code><{{evalPyHTML-style: body { background-color: lightblue; } :style-}}></code>.
|
|
163
166
|
### Shutting down your server
|
|
164
167
|
You can shut down your server by calling the <code>shutdown</code> method on the server object:
|
|
165
168
|
```python
|
|
@@ -189,8 +192,8 @@ from PyWSGIRef import BETA
|
|
|
189
192
|
BETA.enable()
|
|
190
193
|
```
|
|
191
194
|
Currently to be tested are:<br/>
|
|
192
|
-
- PyHTML
|
|
193
|
-
- PyHTML
|
|
195
|
+
- PyHTML python script blocks<br/>
|
|
196
|
+
- PyHTML python if clause blocks<br/>
|
|
194
197
|
- PyHTML include static resource blocks<br/><br/>
|
|
195
198
|
|
|
196
199
|
Thanks a lot for helping improving PyWSGIRef!
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
EVAL_PYHTML = "<{{evalPyHTML}}>"
|
|
2
|
-
|
|
3
|
-
MODERN_STYLING_PHRASE = "<{{evalPyHTML-modernStyling: true}}>"
|
|
4
|
-
|
|
5
|
-
INCLUDE_PATTERN = r"<\{\{evalPyHTML-include: (.*?) :include-\}\}\>"
|
|
6
|
-
|
|
7
|
-
SCRIPT_PATTERN = r"<\{\{evalPyHTML-script: (.*?) :script-\}\}\>"
|
|
8
|
-
|
|
9
|
-
STYLE_PATTERN = r"<\{\{evalPyHTML-style: (.*?) :style-\}\}\>"
|
|
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
|