With Rikulo's StreamServer
, is it possible to specify a route with optionnal segments ?
For example, I tried to build this route pattern:
/default/(controller:\w+)/(action:\w+)(/(id:\w+))?
For matching both /default/user/get
and /default/user/get/myId
.
In fact, this route correctly matches these 2 URLs, but when I try to get the id value with connect.dataset['id']
, it's always null
:s
It is caused by the nested grouping which is not handled well in 0.7.4. Before it was fixed, you can use the following instead:
r"/default/(controller:\w+)/(action:\w+)/(id:\w+)?": yourHandler,
r"/default/(controller:\w+)/(action:\w+)": yourHandler
I posted the issue here.
Update: It has been fixed in 0.7.5. Please upgrade to the latest version.