Mea culpa!

Yes, they are equivalent. My key was empty... sorry. I think I'm
tired...

Thank you very much.

ionel


On May 8, 11:27 pm, mdipierro <[email protected]> wrote:
> They should be equivalent. Can you show the traceback?
>
> On May 8, 9:54 pm, ionel <[email protected]> wrote:
>
> > But I allready did that... and its working...
>
> > Something like that:
>
> > if not session.c:
> >     c = MyClass()
> >     session.c = c
> > else:
> >     c = session.c
>
> > But my question was why I cannot use session['c'] instead of session.c
>
> > Thank you!
>
> > i
>
> > On May 8, 9:31 pm, mdipierro <[email protected]> wrote:
>
> > > You cannot store your own classes in the session because the session
> > > is retrieved before your own classes are defined. You can only store
> > > in session primitive types. You can serialize your objects yourself.
>
> > > On May 8, 7:30 pm, ionel <[email protected]> wrote:
>
> > > > Hello,
>
> > > > I'd like to have something like that:
>
> > > > class MyClass():
> > > >    def __init__(self, id)
> > > >        self.id = id
>
> > > > c = MyClass('some_id')
>
> > > > session[c.id] = c
>
> > > > I do not see a solution for this.
> > > > Can somebody help me?
>
> > > > Thanks.
>
> > > > i.

Reply via email to