plain 0.20.0__py3-none-any.whl → 0.21.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.
@@ -14,11 +14,16 @@ logger = logging.getLogger("plain.request")
14
14
 
15
15
 
16
16
  # These middleware classes are always used by Plain.
17
- BUILTIN_MIDDLEWARE = [
18
- "plain.internal.middleware.headers.DefaultHeadersMiddleware",
19
- "plain.internal.middleware.https.HttpsRedirectMiddleware",
17
+ BUILTIN_BEFORE_MIDDLEWARE = [
18
+ "plain.internal.middleware.headers.DefaultHeadersMiddleware", # Runs after response, to set missing headers
19
+ "plain.internal.middleware.https.HttpsRedirectMiddleware", # Runs before response, to redirect to HTTPS quickly
20
+ "plain.csrf.middleware.CsrfViewMiddleware", # Runs before and after get_response...
21
+ ]
22
+
23
+ BUILTIN_AFTER_MIDDLEWARE = [
24
+ # Want this to run first (when reversed) so the slash middleware
25
+ # can immediately redirect to the slash-appended path if there is one.
20
26
  "plain.internal.middleware.slash.RedirectSlashMiddleware",
21
- "plain.csrf.middleware.CsrfViewMiddleware",
22
27
  ]
23
28
 
24
29
 
@@ -34,7 +39,9 @@ class BaseHandler:
34
39
  get_response = self._get_response
35
40
  handler = convert_exception_to_response(get_response)
36
41
 
37
- middlewares = reversed(BUILTIN_MIDDLEWARE + settings.MIDDLEWARE)
42
+ middlewares = reversed(
43
+ BUILTIN_BEFORE_MIDDLEWARE + settings.MIDDLEWARE + BUILTIN_AFTER_MIDDLEWARE
44
+ )
38
45
 
39
46
  for middleware_path in middlewares:
40
47
  middleware = import_string(middleware_path)
plain/views/objects.py CHANGED
@@ -80,6 +80,8 @@ class CreateView(ObjectTemplateViewMixin, FormView):
80
80
  View for creating a new object, with a response rendered by a template.
81
81
  """
82
82
 
83
+ template_name_suffix = "_form"
84
+
83
85
  def post(self) -> Response:
84
86
  """
85
87
  Handle POST requests: instantiate a form instance with the passed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain
3
- Version: 0.20.0
3
+ Version: 0.21.0
4
4
  Summary: A web framework for building products with Python.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-File: LICENSE
@@ -47,7 +47,7 @@ plain/internal/files/uploadedfile.py,sha256=JRB7T3quQjg-1y3l1ASPxywtSQZhaeMc45uF
47
47
  plain/internal/files/uploadhandler.py,sha256=eEnd5onstypjHYtg367PnVWwCaF1kAPlLPSV7goIf_E,7198
48
48
  plain/internal/files/utils.py,sha256=xN4HTJXDRdcoNyrL1dFd528MBwodRlHZM8DGTD_oBIg,2646
49
49
  plain/internal/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
- plain/internal/handlers/base.py,sha256=_1aRNrNgqdx8kkUlXYRJNOTnZ_Z236JNYNcTdp7RRjc,4228
50
+ plain/internal/handlers/base.py,sha256=M9P3f5JaMmGxzxW7b6p72zAHxFXHuNl57aRcmRCMoWo,4609
51
51
  plain/internal/handlers/exception.py,sha256=DH9gh1FyqgetFpMaB8yLIVE6phBTVPKQLA1GIn9MOeI,4555
52
52
  plain/internal/handlers/wsgi.py,sha256=estA1QKHTk3ZqziWxenHsw5UO2cwPp3Zr0XjkDeM5TY,7561
53
53
  plain/internal/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -135,11 +135,11 @@ plain/views/csrf.py,sha256=7q6l5xzLWhRnMY64aNj0hR6G-3pxI2yhRwG6k_5j00E,144
135
135
  plain/views/errors.py,sha256=Y4oGX4Z6D2COKcDEfINvXE1acE8Ad15KwNNWPs5BCfc,967
136
136
  plain/views/exceptions.py,sha256=b4euI49ZUKS9O8AGAcFfiDpstzkRAuuj_uYQXzWNHME,138
137
137
  plain/views/forms.py,sha256=RhlaUcZCkeqokY_fvv-NOS-kgZAG4XhDLOPbf9K_Zlc,2691
138
- plain/views/objects.py,sha256=fRfS6KNehIGqkbPw4nSafj8HStxYExHmbggolBbzcxs,7921
138
+ plain/views/objects.py,sha256=LfYEbBWLTmwvEcJlcsWlD0DO29QWIYRt2h8quvq46cE,7957
139
139
  plain/views/redirect.py,sha256=KLnlktzK6ZNMTlaEiZpMKQMEP5zeTgGLJ9BIkIJfwBo,1733
140
140
  plain/views/templates.py,sha256=nF9CcdhhjAyp3LB0RrSYnBaHpHzMfPSw719RCdcXk7o,2007
141
- plain-0.20.0.dist-info/METADATA,sha256=xC6F5-ztR9t_Fa39_xt2VG8d2OqeVp4BSeoq7MG7afU,2518
142
- plain-0.20.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
143
- plain-0.20.0.dist-info/entry_points.txt,sha256=DHHprvufgd7xypiBiqMANYRnpJ9xPPYhYbnPGwOkWqE,40
144
- plain-0.20.0.dist-info/licenses/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
145
- plain-0.20.0.dist-info/RECORD,,
141
+ plain-0.21.0.dist-info/METADATA,sha256=LtYn44-bRq4_6avgmAO4ZCrSVHbEKo4upBXusnOOLr8,2518
142
+ plain-0.21.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
143
+ plain-0.21.0.dist-info/entry_points.txt,sha256=DHHprvufgd7xypiBiqMANYRnpJ9xPPYhYbnPGwOkWqE,40
144
+ plain-0.21.0.dist-info/licenses/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
145
+ plain-0.21.0.dist-info/RECORD,,
File without changes