On Fri, 9 Jun 2000, Marcello Lupo wrote:

> 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).

Yes it is neccessary beacuse HTTP is stateless. It will only start a new
session if FSSession cannot find a valid UID either through a cookie or a
FORM or as part of te URL

> 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.

As you descripe in your example carrello is a dictinory. So one way is to
make quantitita_prodotto a list and append to it. Something like

<dtml-if "FSSession['carrillo'].has_key('quantita_prodotto')">
<!-- need to fake the = sign which cannot be used in DTML expr-->
<dtml-call "FSSession['carrillo'].update({'quatita_prodotto':[]})">


plus some more logic to check if the variables are empty/correct etc ..


Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to