Anthony, I am going to reply to one specific part of your last post, the 
one with "I don't think the concept of wrapper application is well 
defined.": 

I don't think the concept of "wrapper application" is well defined. In any 
case, we should probably drop that idea, as your ultimate goal is not to 
have a "wrapper application" but instead to have some configuration data 
made available to your application -- so let's focus on that.

I should not be here to defend the usefulness of a wrapper application or 
even rigorously define it. I believe that the notion of a wrapper is 
sufficiently general that I should not need to define it. I don't think it 
would be easy to define it rigorously, anyway. A wrapper function over f is 
a function that receives some input, does little preparation, calls f, 
receives the value returned by f and then returns the value, possibly after 
with some little modifications.   It is not a formal definition, because it 
does not define "little preparation" and "little modifications" and it does 
not say that the function f must have been adapted to take advantage of the 
preparation, but we have the idea.  This is not a formal paper, so do not 
expect formal definitions. We can further say that the purpose of a wrapper 
is to replace the wrapped object, which cannot do the job itself because it 
needs this little preparation.  I think the concept is easy to generalize 
to an application, to a script, etc.  

I understand that the normal way to call a web2py application is through an 
HTTP request, because this is the way a web application is called. I could 
easily have a wrapper application in web2py. The wrapper application will 
receive the HTTP request in the same way as the wrapped application would, 
because this is what we expect from a wrapper.  Then, it will do some 
preparation, in our case, set the location of the configuration file into a 
post string which it will post to the wrapped application through some 
internal HTTP request. It will receive the HTML response and return it to 
the client of the original HTTP request. I don't care and we  should not 
care if we call the wrapped application without an HTTP request, as long as 
it does the same thing for our purpose.  In the case of PHP, we can do that 
with a simple include of the script that would have been called by the 
original HTTP request. As in any wrapping process, the wrapped application 
must be adapted to use the little preparation. I never used this in a PHP 
framework, but I suspect that it can be done. The wrapper application (in 
the framework) would simply include the wrapped application (in the same or 
even a different framework). It could be that the wrapped application must 
be designed to avoid some pitfalls, but that is OK - it is still possible. 
I never tried that with a PHP framework, but I don't see any fundamental 
issue. If you know PHP and see a fundamental problem with this, let me know 
concretely what it is.

My question was do we have the equivalent within web2py, that is, can we 
wrap an application without having to do an HTTP request?   I was not 
expecting to have to motivate the usefulness of this, but just wanted to 
know if it is possible.  I am not saying that I do not find useful your 
suggestions how to pass configuration values in web2py, but you forget that 
I mentioned in the question "never mind this specific use case, because the 
objective here is very standard and general."  The question was directly in 
terms of the general concept of wrappers. There could be other use cases 
where these wrappers could be useful.  In fact, even for that specific use 
case, I don't think that any of your suggestion totally replace what a 
wrapper can do.  I would have to analyze each of your suggestion, but most 
likely, in each case, there will be some things possible with a wrapper 
that we don't have with the alternative approach.  In any case, even if we 
could always do without it, it does not mean that it will not be nice to 
have this. 

I am sorry that you put me on the defensive, but perhaps you are also on 
the defensive regarding the capabilities of web2py.   If I did not think 
that web2py is great, I would not be here. It was just a question regarding 
wrappers. Now, if the feeling is that I am trying to prove that web2py is 
limited and you try to prove that I am wrong, then you will never address 
the question for what it is. I want to learn the different ways to pass 
configuration values in web2py and the pros and cons of each methods, but 
in a different context.  Now, the context is wrappers and what is possible 
in that direction.   

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to