Re: [Webware-discuss] Session Issue

2007-05-14 Thread Christoph Zwerschke
Jerome Kerdreux wrote:
> Hum .. I guess you found something. The url is 
> http://www.larsen-b.com/Articles/X.html 
> but the cookie path is "/wk/"  ... Do you have a idea to fix this ? 

I cannot see how this happens with the rewrite rules you posted, but you 
wrote that you are using another URLDispatcher. So I assume,

http://www.larsen-b.com/Articles/X.html

is somehow redirected to something like

http://www.larsen-b.com/wk/blog/Articles?id=X

But because the redirected URI is completly different, Webware cannot 
determine the correct cookie path and sets it to '/wk' instead of '/'.

Can you check the following? In WebKit/Request.py there are the 
following lines (two times):

if i >= 0:
 self._servletPath = self._uri[:i]

Can you change both of these cases to:

self._servletPath = i >= 0 and self._uri[:i] or '/'

Let me know if this solves the problem.

-- Chris

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss


Re: [Webware-discuss] Static Contents

2007-05-14 Thread Adam Kerrison

> Then, you should configure Apache to serve the static content instead of
> Webware. In the first case, you would need mod_rewrite, the second case
> is straightforward, but you will need a redirect if the front page shall
> be dynamic already.
> 
We serve all our static content directly via Apache as it just reduces the
number of requests into Webware and Apache is just really good at it :-)

We avoid using mod_rewrite by using absolute URLs for the static content:
/images/whatever, /css/whatever, etc ­ as long as Apache can find the files
everything is fine. It also helps that we are only running one web
application so we can do whatever we need to the Apache server :)

Adam K
-- 
Adam Kerrison

This email and any attachment may contain confidential, privileged information 
for the sole use of the intended recipient. If you are not the intended 
recipient, do not disclose, reproduce, disseminate or otherwise use this 
communication. If you received this communication in error, please immediately 
notify the sender via email and delete the communication from your system. 
Company information : Tideway Systems Ltd, Registered Office: Anchor House, 
15-19 Britten Street, London, SW3 3TY. Registered in England & Wales Reg. Reg. 
No: 4598072  VAT No: 805 5153 50 
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss


Re: [Webware-discuss] Session Issue

2007-05-14 Thread Jerome Kerdreux
On Mon, 14 May 2007 22:54:58 +0200
Christoph Zwerschke <[EMAIL PROTECTED]> wrote:

> Jerome Kerdreux schrieb:
> > Hum, I missed to say that firefox see the SID cookie, the issue is that 
> > my code doesn't have it, so create a new session cookie at each request. 
> > 
> > In awake(), I checked for  trans.request()._environ['HTTP_COOKIE'] this
> > give me some cookie but not the SID one .. 
> 
> Yes, Firefox sees the SID cookie, but when the cookie has set the wrong 
> path, Firefox does not send it back to your Webware application. You can 
> view the cookie path in Firefox and compare with the URL path of your 
> application. Do they fit together?


Hum .. I guess you found something. The url is 
http://www.larsen-b.com/Articles/X.html 
but the cookie path is "/wk/"  ... Do you have a idea to fix this ? 

Thank a lot. 

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss


Re: [Webware-discuss] Session Issue

2007-05-14 Thread Christoph Zwerschke
Jerome Kerdreux schrieb:
> Hum, I missed to say that firefox see the SID cookie, the issue is that 
> my code doesn't have it, so create a new session cookie at each request. 
> 
> In awake(), I checked for  trans.request()._environ['HTTP_COOKIE'] this
> give me some cookie but not the SID one .. 

Yes, Firefox sees the SID cookie, but when the cookie has set the wrong 
path, Firefox does not send it back to your Webware application. You can 
view the cookie path in Firefox and compare with the URL path of your 
application. Do they fit together?

-- Chris

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss


Re: [Webware-discuss] Session Issue

2007-05-14 Thread Jerome Kerdreux
On Mon, 14 May 2007 19:02:16 +0200
Christoph Zwerschke <[EMAIL PROTECTED]> wrote:

> Jkx wrote:
> >> * If you create an empty (default) working dir, does it work?
> > 
> > It should work (as my app is running), I only have some issues 
> > with Session (all other is working fine) 
> 
> I mean, do sessions (e.g. the CountVisits example) work when you create 
> an empty working dir?

I haven't checked this, but if I don't use apache (by configuring local 
http), everything is Ok . 


> 
> > Here is my conf: 
> > SessionPrefix = None # no prefix to session ID
> > IgnoreInvalidSession = True
> > UseAutomaticPathSessions = False
> > UseCookieSessions = True
> 
> That's all default and ok.
> 
> >> * Are you using mod_rewrite?
> > 
> > mod_rewrite + mod_wekit2 
> > I used a URLDispatcher too.. but I don't think the issue is here .. 
> 
> Well, mod_rewrite can be the problem. The reason could be that Webware 
> sets your cookie path to /wk/blog/ but your webbrowser does not know 
> about /wk/blog so it ignores the cookie. You can check the cookie path 
> with Firefox for instance.

Hum, I missed to say that firefox see the SID cookie, the issue is that 
my code doesn't have it, so create a new session cookie at each request. 

In awake(), I checked for  trans.request()._environ['HTTP_COOKIE'] this
give me some cookie but not the SID one .. 


Bye .




-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss


Re: [Webware-discuss] Static Contents

2007-05-14 Thread Christoph Zwerschke
Mico Siahaan wrote:
> I am making a website using Webkit + Cheetah Template. I want the
> directory structure to be like this:
> 
> web:
> | - application (this directory was made using MakeAppWorkDir.py)
>   |- Lib
>   |- MyContext
> |- templates
> |- css
> |- images
> |- flash

First, I suggest putting all static content in one separate directory:

web:
 | - application (this directory was made using MakeAppWorkDir.py)
   |- Lib
   |- MyContext
   | - Static
   |- templates
   |- css
   |- images
   |- flash


If all these static content belongs to your application, you should make 
it a subdirectory of your Webware working directory ("application") as 
indicated above, otherwise you can put it directly below "web" or use an 
already existing htdocs folder instead of "Static".

Then, you should choose a default context. You can either make 
"MyContext" the default context, then you must prefix your static 
content in the URL with something like "/static/", or you can choose 
your Static folder as the default, then you must prefix your Webware app 
context with something like "/app/".

In the first case, you would set

Contexts = { 'static': 'Static', 'default': 'MyContext'}

or you can also create contexts for all your static categories:

Contexts = { 'css': 'Static/css', ... 'default': 'MyContext'}

in the second case

Contexts = { 'app': 'MyContext', 'default': 'Static'}

Now you can already test your application with the built-in webserver.

Then, you should configure Apache to serve the static content instead of 
Webware. In the first case, you would need mod_rewrite, the second case 
is straightforward, but you will need a redirect if the front page shall 
be dynamic already.

See also the various recipes in the Webware Wiki,
http://wiki.w4py.org/webware-recipes
http://wiki.w4py.org/modrewrite-recipes

Hope that helps.

-- Chris







-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss


Re: [Webware-discuss] Session Issue

2007-05-14 Thread Christoph Zwerschke
Jkx wrote:
>> * If you create an empty (default) working dir, does it work?
> 
> It should work (as my app is running), I only have some issues 
> with Session (all other is working fine) 

I mean, do sessions (e.g. the CountVisits example) work when you create 
an empty working dir?

> Here is my conf: 
> SessionPrefix = None # no prefix to session ID
> IgnoreInvalidSession = True
> UseAutomaticPathSessions = False
> UseCookieSessions = True

That's all default and ok.

>> * Are you using mod_rewrite?
> 
> mod_rewrite + mod_wekit2 
> I used a URLDispatcher too.. but I don't think the issue is here .. 

Well, mod_rewrite can be the problem. The reason could be that Webware 
sets your cookie path to /wk/blog/ but your webbrowser does not know 
about /wk/blog so it ignores the cookie. You can check the cookie path 
with Firefox for instance.

I'll try with a similar config when I find some time.

-- Chris

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss


Re: [Webware-discuss] Static Contents

2007-05-14 Thread Jeremy Kaplan
If you are using Apache as your webserver then you can use the
DocumentRoot and RewriteEngine as follows:

DocumentRoot /www-root

RewriteEngine On
RewriteRule ^/images(.*) - [L]

Or some appropriate variant.

If you're not using apache, I'm not able to help, sorry.

jd
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mico
Siahaan
Sent: Sunday, May 13, 2007 8:45 PM
To: Discussion of Webware for Python including feedback and proposals.
Subject: [Webware-discuss] Static Contents

Dear all,

I am making a website using Webkit + Cheetah Template. I want the
directory structure to be like this:

web:
| - application (this directory was made using MakeAppWorkDir.py)
  |- Lib
  |- MyContext
|- templates
|- css
|- images
|- flash

In short, I want to separate between Servlet and templates and static
contents. But now, my problem is I can't do it. Let say I have template
:



Then webware will try to feed someimage.jpg from
web/application/MyContext/images/. This is not what I want.

Can you give me tips how to accomplish it?

thanks and best regards,

--
Mico Siahaan
---
Mobile: +62-8121025010
Email: [EMAIL PROTECTED]
Blog: www.tentangmico.info/blog

Visit our shop: http://www.immanuelbookstore.com


-
This SF.net email is sponsored by DB2 Express Download DB2 Express C -
the FREE version of DB2 express and take control of your XML. No limits.
Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss


[Webware-discuss] Session Issue

2007-05-14 Thread Jkx



For un unknow reason I haven't receive the answer from Chris .. 
So this is a cut/paste from the mail archive. 



>> After some tweaks in the webware context config, all is working 
>> quite fine. (migration was easy :) .. but the session doesn't work
>> any more. And even worst I try to do some debuging, and find that
>> trans.request()._environ['HTTP_COOKIE'], contains some cookies but
>> not the SID one, beside this cookie is present on the browser side. 
>> 
>> Hum, just wordering if I missed something ?? 

> Probably, since this is working well for me. ;-)
> Some things that you can check:

> * Did you create a new working dir with MakeAppWorkDir and merged
   your project there or did you take the old one?

I used MakeAppWorkDir, and merged with my project. 


> * If you create an empty (default) working dir, does it work?

It should work (as my app is running), I only have some issues 
with Session (all other is working fine) 


> * Have you set
>UseAutomaticPathSessions = False
 UseCookieSessions = True

Here is my conf: 

# The session ID can be prefixed with "hostname" or any other string:
SessionPrefix = None # no prefix to session ID
IgnoreInvalidSession = True
UseAutomaticPathSessions = False
UseCookieSessions = True


> * Are you using mod_rewrite?

mod_rewrite + mod_wekit2 

I used a URLDispatcher too.. but I don't think the issue is here .. 


==

ServerName larsen-b.com

DocumentRoot /var/www/larsen-b.com/www/


 WKServer localhost 8087
 SetHandler webkit-handler



RewriteEngine on
RewriteRule ^(.*)/archives/(.*).html$ $1/Article?id=$2 [QSA]

RewriteRule ^/static/(.*) /var/www/larsen-b.com/www/static/$1 [L]
RewriteRule ^/(.*) /wk/blog/$1 [L,PT]




Thanks for any help 

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss