[Zope] Re: FSSession newbie problem

Marcello Lupo lupo@atisworld.com
Fri, 09 Jun 2000 15:58:37 +0200


Hi,
Yes the problem was the () indeed of [].
And i think because i was calling another time an FSSession in the
second page starting a new empty session too. 

Thanks for help.

But i have other two questions:

1) Is necessary to call FSSession in every document of the site or is
sufficient on the first page (home page of the e-com for example)?
 Becouse i noticed (obviously) that every time it open a file the HD.
And i think this is a problem because every time it initialize a new
session passing the new cookie to the Browser (i think).

2) How may i change the value of an element in a dictionary contained in
FSSession?

  Example: I have the object 'carrello' as in the examples before that
contain a dictionary passed to it from the form.
  I store the quantity of the item ordered in the value
'quantita_prodotto' in the object 'carrello'.
  If a user add another piece of that item i need to update the
'quantita_prodotto' summing to it the new item.
  I think this is possible but i ignore the syntax to do this.

Thank you for help.

Hung Jung Lu wrote:
> 
> --- In zope@egroups.com, Marcello Lupo <lupo@a...> wrote:
> >and macically i obtain the same error.
> >this is the code i used:
> ><dtml-call FSSession>
> ><dtml-unless "FSSession.has_key('cart')">
> ><dtml-call "FSSession.set('cart',{})">
> ></dtml-unless>
> >
> ><dtml-call "FSSession['carrello'].update(REQUEST.form)">
> 
> I have tried your code with 'cart' everywhere, and it worked just fine. Can
> you print out the form variables?  Are all the statements inside the same
> DTML file? It really works fine. Also, make sure that FSSession is in a
> parent folder of your DTML method. (Root folder is usually a good idea.) Is
> your machine cookie-enabled?
> 
> ====================================================
> <dtml-var standard_html_header>
> <dtml-call FSSession>
> <dtml-unless "FSSession.has_key('cart')">
>   <dtml-call "FSSession.set('cart',{})">
> </dtml-unless>
> <dtml-call "FSSession['cart'].update(REQUEST.form)">
> <dtml-var "FSSession['cart']">
> <dtml-var standard_html_footer>
> ====================================================
> 
> If you still have problems, you can try SQLSession or HappySession. For
> beginners I would recommend HappySession so you don't need to worry about
> the details of FSSession or SQLSession.
> 
> Download HappySession from
> http://www.zope.org/Members/hungjunglu/Products/HappySession
> 
> Add an HappySession instance in your Zope hierarchy. Then try:
> 
> ====================================================
> <dtml-var standard_html_header>
> <dtml-unless "SESSION.has_key('cart')">
>   <dtml-call "SESSION.set('cart',{})">
> </dtml-unless>
> <dtml-call "SESSION['cart'].update(REQUEST.form)">
> <dtml-var "SESSION['cart']">
> <dtml-var standard_html_footer>
> ====================================================
> 
> regards,
> 
> Hung Jung
> 
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com