Re: [Zope] Re: FSSession newbie problem

2000-06-12 Thread Marcello Lupo

Hi,
well the system run now but as i told before if i put a dtml-call
FSSession in all my pages, FSSession open one session for page
everytime i load it. So the cart result everytime containing only the
last item and the files created contain the values.
If i put dtml-call FSSession only in the first document of the e-comm
section it works well, but the file created do not contain the values,
seems to remain in MEMORY.

Should I make some kind of call to FSSession UID in the pages to let the
FSSession to recover the right session and not to open a new one?
Becouse the problem seems to be in fact that the FSSession is not able
to recover the correct ID of the file (from cookie).

I made some try and if i use the site passing via Roxen web server
through the PCGI the cookie is all another becouse the browser has a
cookie that was set from another application on the same server so the
browser seems to pass only that cookie and not the SessionUID cookie.
I tried to clean all my cookies and it worked fine if a go directly to
my pages not passing from the pages that generate the other cookie.

If i pass directly from the Zope port to access the resource it is ok...

Have some ideas to let the browser pass the cookie in a right way? 
I think we can work on the PATH but i don't know how.
Thanks for help.
Bye

Hung Jung Lu wrote:
 
 From: Pavlos Christoforou [EMAIL PROTECTED]
 On Fri, 9 Jun 2000, Marcello Lupo wrote:
   1) Is necessary to call FSSession in every document of the site 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
 
 Pavlos: this is the part that is confusing to newbies. FSSession can be made
 in such a way that this initial call can be avoided. HappySession works that
 way: no need for explicit initialization. Matter of fact, in the very first
 call to the HappySession (any dictionary method), it does the initialization
 itself behind the scene. FSSession can do the same thing.
 
 It's a minor detail, but anything to make a newbie's life easier is worth
 it. :)
 
 regards,
 
 Hung Jung
 
 
 Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

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




Re: [Zope] Re: FSSession newbie problem

2000-06-12 Thread Hung Jung Lu

From: Marcello Lupo [EMAIL PROTECTED]
Have some ideas to let the browser pass the cookie in a right way?
I think we can work on the PATH but i don't know how.

Okie, you have a cookie problem.

You should definitely solve your cookie problem, if you can. But you can 
also use cookie-less sessions by tweaking the URL: you can append SessionUID 
form variable for all your links, and also use hidden fields for all your 
FORM requests.

FSSession and SQLSession both come with URL-modifier feature. For FSSession, 
instead of a link like:

  a href="dtml-var my_url" ...

you would use

  a href="dtml-var "FSSession.url(my_url)"" ...

And for forms, you have to remember to place a hidden field:

  form ...
  input type=hidden name="SessionUID" value="dtml-var 
"FSSession.getName()""
  ...
  /form

regards,

Hung Jung



Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


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




Re: [Zope] Re: FSSession newbie problem

2000-06-09 Thread Pavlos Christoforou

On Fri, 9 Jun 2000, Marcello Lupo wrote:

 dtml-var "FSSession('carrello')"br   It prints out "None"

I supose you mean  ...FSSession['carrello'] ..
 
 The FSSession is in the same folder of my two methods, may be this a
 problem?

No it should not

 one.
 Probably the second method point to a different session file than the
 first.

I also have dtml-call FSSession in my standard html header and I never
had problems. I will try a few tests when I return. Please keep me posted
if you continue having troubles.

Pavlos


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




Re: [Zope] Re: FSSession newbie problem

2000-06-09 Thread Pavlos Christoforou

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
untested

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

/dtml-if

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

Pavlos


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




Re: [Zope] Re: FSSession newbie problem

2000-06-09 Thread Hung Jung Lu

From: Pavlos Christoforou [EMAIL PROTECTED]
On Fri, 9 Jun 2000, Marcello Lupo wrote:
  1) Is necessary to call FSSession in every document of the site 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

Pavlos: this is the part that is confusing to newbies. FSSession can be made 
in such a way that this initial call can be avoided. HappySession works that 
way: no need for explicit initialization. Matter of fact, in the very first 
call to the HappySession (any dictionary method), it does the initialization 
itself behind the scene. FSSession can do the same thing.

It's a minor detail, but anything to make a newbie's life easier is worth 
it. :)

regards,

Hung Jung


Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


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




Re: [Zope] Re: FSSession newbie problem

2000-06-09 Thread Pavlos Christoforou

On Fri, 9 Jun 2000, Hung Jung Lu wrote:

 Pavlos: this is the part that is confusing to newbies. FSSession can be made 
 in such a way that this initial call can be avoided. HappySession works that 

You are right. There is no real need for the initial call. It was
initially designed like this because I inherited directly from UserDict
and I was lazy to override every call to check whether FSSession was
initialized or not. Also and more important I wanted to be compatible with
SQLSession so the migrating users from one to the other will do so without
needing to change much of the code. The initial call is useful if you need
to pass parameters, like noCookie or _force_new_session etc etc.

Pavlos


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