It's just a nice pattern to follow when building modules that need
access to the response/response/session.  Instead of passing them all
individually, you can just pass globals() and everything you need is
there, similar to auth and crud.

auth = Auth(globals(),db)
crud = Crud(globals(),db)


On Oct 31, 4:36 pm, b00m_chef <[email protected]> wrote:
> The problem was that I was using self.session.forget() thinking that
> that would take care of getting rid of all of the session info. As
> soon as I got rid of that line though, everything worked as normal...
> As for references in python, that is how I thought python worked
> (coming from C++), but this behavior gave me some doubt.
>
> Thanks for the pointer to look at the environment argument, though
> that didn't give any useful info...was there anything particularly
> interesting about that argument in that class?
>
> On Oct 31, 12:11 pm, b00m_chef <[email protected]> wrote:
>
> > thanks!
>
> > On Oct 31, 6:12 am, "mr.freeze" <[email protected]> wrote:
>
> > > Python passes arguments by reference so they are not copies. Take a
> > > look at the constructors for the Crud and Auth classes in gluon/
> > > tools.py. They receive a variable called 'environment' that contains
> > > the session and request.
>
> > > On Oct 30, 9:00 pm, b00m_chef <[email protected]> wrote:
>
> > > > How does one go about passing a pointer to the session and request
> > > > objects from your app to a module in said app. Basically, in a module,
> > > > I need to be able to manipulate all those objects without having to
> > > > return and re-assign them.
>
> > > > If I simply pass all the session, request, response, etc objects to my
> > > > module object in the constructor and then assign all to self.bla, then
> > > > I only get copies of those objects...I can't change them after.
>
> > > > Is the above possible?
>
> > > > Simple example of what I want to do is to be able to do
> > > > session.forget() in my module.
>
>

Reply via email to