1. Ian Bicking
  2. wsgi-peps


mitsuhiko  committed 8fe179a

Slightly better wording.

  • Participants
  • Parent commits 9532234
  • Branches default

Comments (0)

Files changed (1)

File pep-XXXX.txt

View file
     environ['SCRIPT_NAME'] = script_name
     environ['wsgi.uri_encoding'] = uri_encoding
-URI Recoding
+URI Re-decoding
-A middleware might re-encode the values if the `wsgi.uri_encoding` is
+A middleware might re-decode the values if the `wsgi.uri_encoding` is
 `iso-8859-1` and only then.  If it performs re-encoding it must alter
 the value of `wsgi.uri_encoding` as well.  For example if an application
 accepts legacy URL as `iso-8859-7` encoded, this middleware might be
     import codecs
     iso_8859_1 = codecs.lookup('iso-8859-1')
-    def reencode(string):
+    def redecode(string):
         return string.encode('iso-8859-1').decode('iso-8859-7')
     def latin7_fallback_middleware(application):
         def new_application(environ, start_response):
             if codecs.lookup(environ['wsgi.uri_encoding']) == iso_8859_1:
-                environ['PATH_INFO'] = reencode(environ['PATH_INFO'])
-                environ['SCRIPT_NAME'] = reencode(environ['SCRIPT_NAME'])
+                environ['PATH_INFO'] = redecode(environ['PATH_INFO'])
+                environ['SCRIPT_NAME'] = redecode(environ['SCRIPT_NAME'])
                 environ['wsgi.uri_encoding'] = 'iso-8859-7'
             return application(environ, start_response)
         return new_application