PyWSGIRef 1.1.9__tar.gz → 1.1.11__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.
Files changed (23) hide show
  1. {pywsgiref-1.1.9/src/PyWSGIRef.egg-info → pywsgiref-1.1.11}/PKG-INFO +1 -1
  2. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/pyproject.toml +1 -1
  3. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef/__init__.py +2 -2
  4. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef/pyhtml.py +19 -6
  5. {pywsgiref-1.1.9 → pywsgiref-1.1.11/src/PyWSGIRef.egg-info}/PKG-INFO +1 -1
  6. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/LICENSE +0 -0
  7. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/README.md +0 -0
  8. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/setup.cfg +0 -0
  9. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef/__main__.py +0 -0
  10. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef/beta.py +0 -0
  11. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef/commons.py +0 -0
  12. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef/defaults.py +0 -0
  13. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef/exceptions.py +0 -0
  14. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef/finished.py +0 -0
  15. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef/loadContent.py +0 -0
  16. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef/patterns.py +0 -0
  17. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef/simpleServer.py +0 -0
  18. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef/templateDict.py +0 -0
  19. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef.egg-info/SOURCES.txt +0 -0
  20. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef.egg-info/dependency_links.txt +0 -0
  21. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef.egg-info/requires.txt +0 -0
  22. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/src/PyWSGIRef.egg-info/top_level.txt +0 -0
  23. {pywsgiref-1.1.9 → pywsgiref-1.1.11}/tests/testMainServer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyWSGIRef
3
- Version: 1.1.9
3
+ Version: 1.1.11
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "PyWSGIRef"
3
- version = "1.1.9"
3
+ version = "1.1.11"
4
4
  authors = [
5
5
  {name="Leander Kafemann", email="leander@kafemann.berlin" },
6
6
  ]
@@ -17,7 +17,7 @@ def about():
17
17
  """
18
18
  Returns information about your release and other projects by Leander Kafemann
19
19
  """
20
- return {"Version": (1, 1, 9), "Author": "Leander Kafemann", "date": "21.06.2025",\
20
+ return {"Version": (1, 1, 11), "Author": "Leander Kafemann", "date": "25.06.2025",\
21
21
  "recommend": ("Buero by LK", "pyimager by LK"), "feedbackTo": "leander@kafemann.berlin"}
22
22
 
23
23
  SCHABLONEN = TemplateDict()
@@ -69,5 +69,5 @@ def setUpServer(application: Callable, port: int = 8000) -> WSGIServer:
69
69
  No additional Schablonen can be loaded from the web.
70
70
  """
71
71
  finished.set_true()
72
- server = make_server('', 8000, application)
72
+ server = make_server('', port, application)
73
73
  return server
@@ -1,3 +1,4 @@
1
+ import html
1
2
  import re
2
3
  from naturalsize import replStrPassage
3
4
 
@@ -10,6 +11,7 @@ from .patterns import *
10
11
  class PyHTML:
11
12
  def __init__(self, html: str = DEFAULT):
12
13
  self.html = html
14
+ self.context = None
13
15
 
14
16
  def _replace_eval_phrase(self):
15
17
  """
@@ -76,19 +78,19 @@ class PyHTML:
76
78
  replacement = f"<style>{style_content}</style>"
77
79
  self.html = self.html[:idx] + replacement + self.html[idxEnd:]
78
80
 
79
- def _replace_eval_blocks(self, context=None):
81
+ def _replace_eval_blocks(self):
80
82
  """
81
83
  Replaces eval replacement phrases with evaluated Python expressions.
82
84
  WARNING: This method uses eval, which can execute arbitrary code.
83
85
  """
84
- if context is None:
85
- context = {}
86
+ if self.context is None:
87
+ self.context = {}
86
88
  for match in re.finditer(EVAL_BLOCK_PATTERN, self.html, re.DOTALL):
87
89
  idx, idxEnd = match.span()
88
90
  code = match.group(1).strip()
89
91
  try:
90
92
  # eval f�r Ausdr�cke, exec f�r Statements
91
- result = str(eval(code, {}, context))
93
+ result = str(eval(code, {}, self.context))
92
94
  except Exception as e:
93
95
  result = f"<b>EvalError: {e}</b>"
94
96
  self.html = self.html[:idx] + result + self.html[idxEnd:]
@@ -130,9 +132,20 @@ class PyHTML:
130
132
  self._replace_eval_blocks()
131
133
  self._replace_if_blocks()
132
134
 
133
- def decoded(self) -> str:
135
+ def decoded(self, cacheDecoded: bool = False) -> str:
134
136
  """
135
137
  Returns the decoded HTML content.
136
138
  """
139
+ backup = self.html
137
140
  self.decode()
138
- return self.html
141
+ _return = self.html
142
+ if not cacheDecoded:
143
+ self.html = backup
144
+ return _return
145
+
146
+ def decodedContext(self, context: dict, cacheDecoded: bool = False) -> str:
147
+ """
148
+ Returns the decoded HTML content with the provided context.
149
+ """
150
+ self.context = context
151
+ return self.decoded(cacheDecoded)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyWSGIRef
3
- Version: 1.1.9
3
+ Version: 1.1.11
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
File without changes
File without changes
File without changes