> > So you should, at the very least, lock it whenever you are changing it. >
How would I go about "locking" it? Thank you for the advice - I had a feeling modifying the app configuration after launch may be a bad idea. I will try something more along the lines of what you suggested, but I would still like to know how I would "lock" the registry if I needed to. Thanks. On Friday, April 4, 2014 1:49:08 PM UTC-7, Michael Merickel wrote: > > > On Fri, Apr 4, 2014 at 3:35 PM, Tres Seaver <[email protected]<javascript:> > > wrote: > >> @view_config(route='extend_views') >> def extend_views(request): >> config = Configurator(request.registry) >> config.begin() >> config.add_route(...) #etc. >> config.commit() >> > > Be aware that this is super dangerous on any "real" site as the registry > is not thread-safe. So you should, at the very least, lock it whenever you > are changing it. Thanks to the GIL you can probably assume that reading > from it is mostly safe while you're modifying it, but in general it's just > a bad idea to try to reconfigure your app after it's already running. > Things like dynamic URLs are best solved with dispatch placeholders and/or > traversal combined with a central storage mechanism. For example, envision > putting the valid URLs into redis and then asking redis if the URL is valid > prior to invoking the view (this can be easily done in a route predicate). > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
