dynamically building URL patterns list

121 views
Skip to first unread message

Rajdeep Rath

unread,
Feb 4, 2021, 12:31:00 PM2/4/21
to python-...@googlegroups.com
I am trying to build url patterns list dynamically based on condition. However, wherever i append two lists with tuples such as  - [url(r"/", base.MainHandler)] and init the Application, i get weird AssertionError or some other error. isn't this supposed to be a just simple list?

what am I doing wrong?

Regards

Rajdeep Rath

unread,
Feb 4, 2021, 12:42:29 PM2/4/21
to python-...@googlegroups.com
Also, what is the use case for Custom Routing? Where is it applicable?
https://www.tornadoweb.org/en/stable/routing.html

Ben Darnell

unread,
Feb 6, 2021, 9:01:35 PM2/6/21
to Tornado Mailing List
On Thu, Feb 4, 2021 at 12:42 PM Rajdeep Rath <rajde...@gmail.com> wrote:
Also, what is the use case for Custom Routing? Where is it applicable?
https://www.tornadoweb.org/en/stable/routing.html


You can use it whenever you want something more customizable than what Application does by default. For example, to match in some way other than a regex on the request path, or to nest multiple Applications on one HTTPServer.

You could even use it all the time. I think that's the direction I'd like to go in the future, but right now it's a little cumbersome because there are so many objects to import. It probably needs a little shorthand to become the default mode of operation.
 

On Thu, Feb 4, 2021 at 11:00 PM Rajdeep Rath <rajde...@gmail.com> wrote:
I am trying to build url patterns list dynamically based on condition. However, wherever i append two lists with tuples such as  - [url(r"/", base.MainHandler)] and init the Application, i get weird AssertionError or some other error. isn't this supposed to be a just simple list?

Yes, it's supposed to just be a simple list. Without seeing how you're assembling the list or what AssertionError you're seeing it's hard to say what might be going wrong.

-Ben
 

what am I doing wrong?

Regards

--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-tornado/CAP869y9z7d3U2ZOuxgK8dZ%2BHOHpEMyGw0qDNJnKSAFaTtV9Xqg%40mail.gmail.com.

Rajdeep Rath

unread,
Mar 26, 2021, 2:22:05 PM3/26/21
to python-...@googlegroups.com
FYI I figured this out on my own, thanks.

Reply all
Reply to author
Forward
0 new messages