PyWSGIRef 1.1.9__tar.gz → 1.1.10__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.10}/PKG-INFO +1 -1
  2. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/pyproject.toml +1 -1
  3. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef/__init__.py +2 -2
  4. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef/pyhtml.py +13 -4
  5. {pywsgiref-1.1.9 → pywsgiref-1.1.10/src/PyWSGIRef.egg-info}/PKG-INFO +1 -1
  6. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/LICENSE +0 -0
  7. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/README.md +0 -0
  8. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/setup.cfg +0 -0
  9. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef/__main__.py +0 -0
  10. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef/beta.py +0 -0
  11. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef/commons.py +0 -0
  12. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef/defaults.py +0 -0
  13. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef/exceptions.py +0 -0
  14. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef/finished.py +0 -0
  15. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef/loadContent.py +0 -0
  16. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef/patterns.py +0 -0
  17. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef/simpleServer.py +0 -0
  18. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef/templateDict.py +0 -0
  19. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef.egg-info/SOURCES.txt +0 -0
  20. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef.egg-info/dependency_links.txt +0 -0
  21. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef.egg-info/requires.txt +0 -0
  22. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/src/PyWSGIRef.egg-info/top_level.txt +0 -0
  23. {pywsgiref-1.1.9 → pywsgiref-1.1.10}/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.10
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.10"
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, 10), "Author": "Leander Kafemann", "date": "24.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
@@ -10,6 +10,7 @@ from .patterns import *
10
10
  class PyHTML:
11
11
  def __init__(self, html: str = DEFAULT):
12
12
  self.html = html
13
+ self.context = None
13
14
 
14
15
  def _replace_eval_phrase(self):
15
16
  """
@@ -76,19 +77,19 @@ class PyHTML:
76
77
  replacement = f"<style>{style_content}</style>"
77
78
  self.html = self.html[:idx] + replacement + self.html[idxEnd:]
78
79
 
79
- def _replace_eval_blocks(self, context=None):
80
+ def _replace_eval_blocks(self):
80
81
  """
81
82
  Replaces eval replacement phrases with evaluated Python expressions.
82
83
  WARNING: This method uses eval, which can execute arbitrary code.
83
84
  """
84
- if context is None:
85
- context = {}
85
+ if self.context is None:
86
+ self.context = {}
86
87
  for match in re.finditer(EVAL_BLOCK_PATTERN, self.html, re.DOTALL):
87
88
  idx, idxEnd = match.span()
88
89
  code = match.group(1).strip()
89
90
  try:
90
91
  # eval f�r Ausdr�cke, exec f�r Statements
91
- result = str(eval(code, {}, context))
92
+ result = str(eval(code, {}, self.context))
92
93
  except Exception as e:
93
94
  result = f"<b>EvalError: {e}</b>"
94
95
  self.html = self.html[:idx] + result + self.html[idxEnd:]
@@ -135,4 +136,12 @@ class PyHTML:
135
136
  Returns the decoded HTML content.
136
137
  """
137
138
  self.decode()
139
+ return self.html
140
+
141
+ def decodedContext(self, context: dict) -> str:
142
+ """
143
+ Returns the decoded HTML content with the provided context.
144
+ """
145
+ self.context = context
146
+ self.decode()
138
147
  return self.html
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyWSGIRef
3
- Version: 1.1.9
3
+ Version: 1.1.10
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