Re: [pylons-discuss] Question about creating routes

2024-03-13 Thread Theron Luhn
That’s a result of the lack of block scoping in Python. `op` is going to resolve when the lambda first executes, which is always after the loop has finished, and scoped to the containing function so `op` will always be the final loop value. Easiest workaround is to just wrap the loop contents

Re: [pylons-discuss] Question about creating routes

2024-03-13 Thread Laurent Daverio
Thank you everybody, I'll try to set up a working example tomorrow. Actually you're right, my question was formulated incorrectly, it may not be a question of lambdas. Basically, I was trying to create a series of routes in a reasonably concise way, something like this : 2 types of objects (actes,

Re: [pylons-discuss] Question about creating routes

2024-03-13 Thread Michael Merickel
Laurent, what error do you get? I'm not immediately aware of limitations around using lambdas in Pyramid. This example below works fine with a lambda as a view: from pyramid.config import Configurator from waitress import serve config = Configurator() config.add_route('foo', '/') config.add_view(

Re: [pylons-discuss] Question about creating routes

2024-03-13 Thread Mike Orr
I'm not an expert in this, but I think the maybe-resolve functions only do lookups when the spec is a string, and pass non-strings through unchanged. As far as I know lambdas are regular functions, so I'd expect it to pass them through like view callable functions. Maybe another exception is occurr

[pylons-discuss] Re: Question about creating routes

2024-03-13 Thread Jonathan Vanasco
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

[pylons-discuss] Question about creating routes

2024-03-13 Thread Laurent Daverio
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_selec

[pylons-discuss] Test

2024-03-13 Thread Laurent Daverio
-- 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.c