[web2py] Re: Haiti: Proxy required - Django port? CGI port?

2010-01-23 Thread Fran
On Jan 23, 8:55 pm, mdipierro  wrote:
> It is a bit clunky to configure because you have to use routes. You
> can have multiple controllers to proxy different servers. Similarly to
> the original Django code it does not carry forward headers from the
> request. This means range requests, if modified since, streaming, does
> not work. It is a bit slow.

Well, thanks anyway :)

Seems like this doesn't really do what we wanted anyway...this allows
us to proxy requests via a proxy server.
What we wanted was an actual proxy server.
I must have read the Django app's docs wrong!

Luckily we have a working port of the CGI version...currently very
basic, but we can build on it :)

Many thanks,
Fran.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Haiti: Proxy required - Django port? CGI port?

2010-01-24 Thread mdipierro
This is a proxy server (just very limited) and can proxy only one
server.

On Jan 23, 6:45 pm, Fran  wrote:
> On Jan 23, 8:55 pm, mdipierro  wrote:
>
> > It is a bit clunky to configure because you have to use routes. You
> > can have multiple controllers to proxy different servers. Similarly to
> > the original Django code it does not carry forward headers from the
> > request. This means range requests, if modified since, streaming, does
> > not work. It is a bit slow.
>
> Well, thanks anyway :)
>
> Seems like this doesn't really do what we wanted anyway...this allows
> us to proxy requests via a proxy server.
> What we wanted was an actual proxy server.
> I must have read the Django app's docs wrong!
>
> Luckily we have a working port of the CGI version...currently very
> basic, but we can build on it :)
>
> Many thanks,
> Fran.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Haiti: Proxy required - Django port? CGI port?

2010-01-24 Thread mdipierro
I should add that the original Django Proxy also did caching of the
pages. The one I send you did not. Is this the functionality you need?
It could be added easily adding

if request.env.request_method=='GET':
proxy=cache(request.env.path_info,cache.disk,3600)(proxy)

Massimo

On Jan 23, 6:45 pm, Fran  wrote:
> On Jan 23, 8:55 pm, mdipierro  wrote:
>
> > It is a bit clunky to configure because you have to use routes. You
> > can have multiple controllers to proxy different servers. Similarly to
> > the original Django code it does not carry forward headers from the
> > request. This means range requests, if modified since, streaming, does
> > not work. It is a bit slow.
>
> Well, thanks anyway :)
>
> Seems like this doesn't really do what we wanted anyway...this allows
> us to proxy requests via a proxy server.
> What we wanted was an actual proxy server.
> I must have read the Django app's docs wrong!
>
> Luckily we have a working port of the CGI version...currently very
> basic, but we can build on it :)
>
> Many thanks,
> Fran.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Haiti: Proxy required - Django port? CGI port?

2010-01-24 Thread John Heenan
On Jan 25, 2:32 am, mdipierro  wrote:
> I should add that the original Django Proxy also did caching of the
> pages. The one I send you did not. Is this the functionality you need?
> It could be added easily adding
>
> if request.env.request_method=='GET':
>     proxy=cache(request.env.path_info,cache.disk,3600)(proxy)
>

I was confused by this technique at first.

The __call__ function of the Cache global class instance, cache, is
shown used as a decorator on page 113 of the web2py manual (2nd ed).

@cache cannot be used before def proxy since the use of a cache is
conditional on what the request method is (namely GET).

The above usage is just an alternative that modifiies the already
defined proxy function on a per request basis.

John Heenan

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Haiti: Proxy required - Django port? CGI port?

2010-01-24 Thread John Heenan
On Jan 25, 10:44 am, John Heenan  wrote:
> The __call__ function of the Cache global class instance, cache, is

More confusion busting that is going off topic and should be placed in
a topic of its own that discusses style issues.

For those who are not adjusted to the 'web2py way', the above mention
of 'global class instance' might appear incorrect, impossible or at
the least, 'not the Python way', since no import is implied or
suggested. Globals, as conventionally understood, are frowned upon by
the Python hierarchy, much to the annoyance of those from just about
every other programming environment who work with involved projects. C/
C++ programmers can conventionally tuck away a global namespace with
preprocessor #include statements and files. Python equivalents are not
as straightforward since an import always involves executing a file
(the first time an import on a file is used).

Web2py favours exec over import. The global class instance, cache, is
placed in a dictionary that becomes the environment during an exec.

The line 'environment['cache'] = Cache(request)' appears in the file
compileapp.py.

Hence there is no import.

Ultimately this style leads to more elegance and productivity and
leads to less bugs. How much time is wasted wondering what has been
forgotten to import when coding with Django and irritating compile
errors appear?

John Heenan

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Haiti: Proxy required - Django port? CGI port?

2010-02-21 Thread Richard
did you get anywhere with your proxy? I am after a web2py proxy that
supports redirects, authentication, and passing headers.

The above snippet seems to proxy internal content rather than fetch
external content like the Django example.



On Jan 24, 11:45 am, Fran  wrote:
> On Jan 23, 8:55 pm, mdipierro  wrote:
>
> > It is a bit clunky to configure because you have to use routes. You
> > can have multiple controllers toproxydifferent servers. Similarly to
> > the original Django code it does not carry forward headers from the
> > request. This means range requests, if modified since, streaming, does
> > not work. It is a bit slow.
>
> Well, thanks anyway :)
>
> Seems like this doesn't really do what we wanted anyway...this allows
> us toproxyrequests via aproxyserver.
> What we wanted was an actualproxyserver.
> I must have read the Django app's docs wrong!
>
> Luckily we have a working port of the CGI version...currently very
> basic, but we can build on it :)
>
> Many thanks,
> Fran.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Haiti: Proxy required - Django port? CGI port?

2010-02-22 Thread Richard
> The above snippet seems to proxy internal content rather than fetch
> external content like the Django example.

whoops, the Django snippet also does this.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Haiti: Proxy required - Django port? CGI port?

2010-02-22 Thread mdipierro
I just rewrote the Django on th web2py. It should be easy to change
it.

On Feb 22, 6:31 am, Richard  wrote:
> > The above snippet seems to proxy internal content rather than fetch
> > external content like the Django example.
>
> whoops, the Django snippet also does this.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.