I'm not sure about lambdas, but this reminded me the tutorial with "discriminators", which goes into some troubleshooting:
https://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/configuration/whirlwind_tour.html I feel like I've encountered something around this concept before , but I can't recall what project it was in to look at code. :/ On Wednesday, March 13, 2024 at 1:50:07 PM UTC-4 Laurent Daverio wrote: > Hello list, > > it seems that Google is allowing me to post on here again. A couple of > weeks ago, I was banned, both from emailing the list, AND from posting on > the web group 💩 > > I am trying to create a series of routes based on lambda functions, > something like: > > ``` > config.add_route('doc1.delete_selection', '/doc1/-/delete_selection') > config.add_route('doc2.delete_selection', '/doc2/-/delete_selection') > config.add_view( > lambda request: _delete_multi(request, Doc1Resource), > route_name='doc1.delete_selection', request_method='POST', > renderer='json') > config.add_view( > lambda request: _delete_multi(request, Doc2Resource), > route_name='doc2.delete_selection', request_method='POST', > renderer='json') > ``` > > (I also have `archive_selection` and `unarchive_selection` routes) > > I'm under the impression that `config.add_view` can't take lambda > functions as arguments, as it tries to resolve their names ("maybe_dotted", > "maybe_resolve", etc.). All I can say it that the views seem to be calling > the wrong functions. This prevents me from using for loops and lambda for > generating the routes in a more concise way :/ > > Could anyone confirm if I'm correct? > > Many thanks, > > Laurent. > > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/61212748-c660-443d-bdb0-89a84d08cd89n%40googlegroups.com.