This sounds like an application-global object. These are typically stored on the registry at config-time. For example, in your main you could set config.registry.foo = contract. The registry is available as request.registry and subsequently anything you add to it. You can see lots of examples of this in pyramid addons and things like the dbsession_factory in the alchemy cookiecutter.
On Sat, Oct 6, 2018 at 5:00 PM Lukasz Szybalski <szybal...@gmail.com> wrote: > Hello, > I have an enterprise system that is creating a class but it takes a long > time to initiate. About 2 sec, 90K _setitem from pickle. Nothing to > profile, since OS cashes the file its as fast as it gets. > > I'm trying to find a way in pyramid where I can: > > #store below at start, of the process, let it initiate, > #then somehow make it read only, > #so that a process can use it later and modify its own copy > > from enterprise import Contract > my= Contract() > > > #rest of the program > my2 = copy my (or copy on write, similar how qcow format works) > my2.find_contract('abc') > my2.add_name('Lucas') > return (my2.stuff) > > I don't seem to be finding the right terminology, or technique to do this, > and where to place it in pyramid? > > Thanks > Lucas > > -- > http://lucasmanual.com/ <http://lucasmanual.com/blog/> > > -- > 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 post to this group, send email to pylons-discuss@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pylons-discuss/CAKkTUv3qgT%2BUk0-uvLB1owZEA3W%3D-7XA-wkiyZbteWHPAcO6vg%40mail.gmail.com > <https://groups.google.com/d/msgid/pylons-discuss/CAKkTUv3qgT%2BUk0-uvLB1owZEA3W%3D-7XA-wkiyZbteWHPAcO6vg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to pylons-discuss@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/CAKdhhwEc87HDyELbK45Q5HVmQjDMT7M6U8M89e_OC7c0Mkz_mQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.