plain 0.2.5__py3-none-any.whl → 0.3.0__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.
plain/test/client.py CHANGED
@@ -2,7 +2,6 @@ import json
2
2
  import mimetypes
3
3
  import os
4
4
  import sys
5
- from copy import copy
6
5
  from functools import partial
7
6
  from http import HTTPStatus
8
7
  from http.cookies import SimpleCookie
@@ -196,19 +195,6 @@ class ClientHandler(BaseHandler):
196
195
  return response
197
196
 
198
197
 
199
- def store_rendered_templates(store, signal, sender, template, context, **kwargs):
200
- """
201
- Store templates and contexts that are rendered.
202
-
203
- The context is copied so that it is an accurate representation at the time
204
- of rendering.
205
- """
206
- store.setdefault("templates", []).append(template)
207
- if "context" not in store:
208
- store["context"] = ContextList()
209
- store["context"].append(copy(context))
210
-
211
-
212
198
  def encode_multipart(boundary, data):
213
199
  """
214
200
  Encode multipart POST data from a dictionary of form values.
@@ -683,12 +669,6 @@ class Client(ClientMixin, RequestFactory):
683
669
  """
684
670
  environ = self._base_environ(**request)
685
671
 
686
- # Curry a data dictionary into an instance of the template renderer
687
- # callback function.
688
- data = {}
689
- partial(store_rendered_templates, data)
690
- "template-render-%s" % id(request)
691
- # signals.template_rendered.connect(on_template_render, dispatch_uid=signal_uid)
692
672
  # Capture exceptions created by the handler.
693
673
  exception_uid = "request-exception-%s" % id(request)
694
674
  got_request_exception.connect(self.store_exc_info, dispatch_uid=exception_uid)
@@ -702,20 +682,18 @@ class Client(ClientMixin, RequestFactory):
702
682
  # Save the client and request that stimulated the response.
703
683
  response.client = self
704
684
  response.request = request
705
- # Add any rendered template detail to the response.
706
- response.templates = data.get("templates", [])
707
- response.context = data.get("context")
708
685
  response.json = partial(self._parse_json, response)
686
+
687
+ # If the request had a user attached, make it available on the response.
688
+ if hasattr(response.wsgi_request, "user"):
689
+ response.user = response.wsgi_request.user
690
+
709
691
  # Attach the ResolverMatch instance to the response.
710
692
  urlconf = getattr(response.wsgi_request, "urlconf", None)
711
693
  response.resolver_match = SimpleLazyObject(
712
694
  lambda: resolve(request["PATH_INFO"], urlconf=urlconf),
713
695
  )
714
- # Flatten a single context. Not really necessary anymore thanks to the
715
- # __getattr__ flattening in ContextList, but has some edge case
716
- # backwards compatibility implications.
717
- if response.context and len(response.context) == 1:
718
- response.context = response.context[0]
696
+
719
697
  # Update persistent cookie data.
720
698
  if response.cookies:
721
699
  self.cookies.update(response.cookies)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plain
3
- Version: 0.2.5
3
+ Version: 0.3.0
4
4
  Summary: A web framework for building products with Python.
5
5
  Author: Dave Gaeddert
6
6
  Author-email: dave.gaeddert@dropseed.dev
@@ -101,7 +101,7 @@ plain/templates/jinja/filters.py,sha256=3KJKKbxcv9dLzUDWPcaa88k3NU2m1GG3iMIgFhzX
101
101
  plain/templates/jinja/globals.py,sha256=MRhkTVVH2iKWc_GPX5E2uoafBV-tDVxyY58d_S4Zgwo,479
102
102
  plain/test/README.md,sha256=Zso3Ir7a8vQerzKB6egjROQWkpveLAbscn7VTROPAiU,37
103
103
  plain/test/__init__.py,sha256=rXe88Y602NP8DBnReSyXb7dUzKoWweLuT43j-qwOUl4,138
104
- plain/test/client.py,sha256=w8QxRE04ozCyF5TZRxrtg-R9ECiZ0VV105t9Ty89cXg,32412
104
+ plain/test/client.py,sha256=cu43S-NL606VERUYi7NjvzIrVchlNLHqcKro7pnYmS4,31385
105
105
  plain/urls/README.md,sha256=pWnCvgYkWN7rG7hSyBOtX4ZUP3iO7FhqM6lvwwYll6c,33
106
106
  plain/urls/__init__.py,sha256=3UzwIufXjIks2K_X_Vms2MV19IqvyPLrXUeHU3WP47c,753
107
107
  plain/urls/base.py,sha256=ECaOCEXs1ygKn4k1mt5XxSNPNlg5raJvx0aPaj7DFfE,3719
@@ -152,8 +152,8 @@ plain/views/objects.py,sha256=9QBYyb8PgkRirXCQ8-Pms4_yMzP37dfeL30hWRYmtZg,7909
152
152
  plain/views/redirect.py,sha256=KLnlktzK6ZNMTlaEiZpMKQMEP5zeTgGLJ9BIkIJfwBo,1733
153
153
  plain/views/templates.py,sha256=nF9CcdhhjAyp3LB0RrSYnBaHpHzMfPSw719RCdcXk7o,2007
154
154
  plain/wsgi.py,sha256=R6k5FiAElvGDApEbMPTT0MPqSD7n2e2Az5chQqJZU0I,236
155
- plain-0.2.5.dist-info/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
156
- plain-0.2.5.dist-info/METADATA,sha256=KyaK66wyLHe9OHXObllwbTbUPmyk6jNqTGRo-yOJkkI,2716
157
- plain-0.2.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
158
- plain-0.2.5.dist-info/entry_points.txt,sha256=7O1RZTmMasKYB73bfqQcTwIhsXo7RjEIKv2WbtTtOIM,39
159
- plain-0.2.5.dist-info/RECORD,,
155
+ plain-0.3.0.dist-info/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
156
+ plain-0.3.0.dist-info/METADATA,sha256=Z7t7-Jdot0U9cymStFyaaItjoTsk8Ls8lSEu4pkzJ7Y,2716
157
+ plain-0.3.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
158
+ plain-0.3.0.dist-info/entry_points.txt,sha256=7O1RZTmMasKYB73bfqQcTwIhsXo7RjEIKv2WbtTtOIM,39
159
+ plain-0.3.0.dist-info/RECORD,,
File without changes
File without changes