Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1044455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:49:53+00:00 2026-05-16T15:49:53+00:00

I write a router that takes the path of a request, match it against

  • 0

I write a router that takes the path of a request, match it against a regex and calls a WSGI handler, if the regex matches. The dict with the matching capturing groups is added to the envrion. Is it bad style to modify the environ with WSGI middleware?

But is that what WSGI middleware was invented for? I’ve just read WSGI Middleware Considered Harmful and wonder whether I should rewrite my router to be no longer a middleware. An application becomes dependend on my middleware, if it uses the dict with capturing groups. On the other hand no application has to use this additional dict. I could also forego the path param extraction and reduce the router to the routing, but then each application has to rerun the regex a second time for path parameter extraction.

So what to do:

  • leaving as is; with routing, path param extraction and environ manipulation
  • make the router a WSGI application and the current WSGI applications framework specific handlers
  • reduce the router to routing and extract perform regex matching a second time for path parameter extraction in the application to which the request was routed
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:49:54+00:00Added an answer on May 16, 2026 at 3:49 pm

    If you add things to the environ and then use those things in applications, without any fallbacks, then you have to some degree bound the application to the middleware.

    In this particular case there is a convention for how to add those captured values to the environ: wsgiorg.routing_args. So while you would be putting references to this capturing into your application, it’s not an entirely ad hoc communication.

    (Though you can certainly overuse middleware, I consider that particular article to overstate the case; middleware can be a good abstraction to consider, implement, and test different pieces of an application separately, even if initially those pieces are implemented for a singular goal by a single person)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I write a large static method that takes a generic as a parameter argument.
Wanna write a RegEx to validate a driving license. if it doesn't start with
Please write a list of tasks that a copy constructor and assignment operator need
I am attempting to write (or expand on an existing) graph search algorithm that
I'm trying to write a functional test for an action that must run over
Write a class ListNode which has the following properties: int value; ListNode *next; Provide
You write a function and, looking at the resulting assembly, you see it can
I write my app in VS 2008 and so use all the fanciful stuffs
I write a singleton c++ in the follow way: class A { private: static
I write a Text Editor with Java , and I want to add Undo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.