On Mar 21, 1:27 am, mdipierro <[email protected]> wrote:
> On Mar 20, 5:16 pm, Alex Popescu <[email protected]>
> wrote:
>
>
> > 1. Routing
>
> > According to the documentation URLs are solved according to the
> > following rule:
>
> > protocol://netloc/application/controller/function[(/arg)*][?vars]
>
> > My question is: how difficult would be to eliminate the function part
> > and basically route the request to a method defined in the controller
> > corresponding to the HTTP request method name (i.e. GET -> get, POST -
> > post, PUT -> put, etc.)?
>
> You cannot acoomplish soley with routes but you can have a catch all
> action that checks
>
> if request.post_vars: call_post_action()
>
I'm not sure I'm following your answer. While I haven't spent too much
time looking at the code my impression is that it should be as simple
as making some minor changes to the way the Request object is
initialized in gluon.main.wsgibase.
Well, there might be something else needed too, but I haven't found it
yet: generating the URLs.
>
>
> > As far as I can tell, for a WSGI deployment the URL parsing happens in
> > gluon.main.wsgibase, but I am wondering if there are other places I
> > should look for.
>
> > Note: I am looking to build a very RESTful app and I'd like to have
> > this clear convention in my app.
> > 2. Models and Data Access
>
> > This part is a bit more complex to describe, but I hope you'll bare
> > with me for a couple of paragraphs.
>
> > Currently the web2py models are very data centric (please keep in mind
> > that I'm not saying that this is good or bad):
>
> > db.define_table('name', SQLField(...)
>
> > What I'd actually like would be to hide this part behind an object
> > centric approach. I am aware of the fact that basically the approaches
> > are quite different (ORM vs ActiveRecord), but I'm wondering if some
> > metaclass magic would be able to allow me to preserve the current
> > implementation while offering an object oriented perspective. A very
> > basic example would be the data access layer implementation available
> > in Google App Engine:
>
> > Model.gql('query')....
>
> > Simply put the meta-magic will just have to hide the db functions
> > behind some static Model methods.
>
> > Question: do you think that this is possible? how difficult would this
> > be?
>
> This has been done in order to allow web2py to import Django models:
> You can find the code here:http://mdp.cti.depaul.edu/AlterEgo/default/show/189
>
This looks like an excellent start. I think I can take it from there.
While waiting for your comments on my previous questions I've figured
2 more:
3/ Templating
a/ Is template inheritance supported? (I couldn't find any reference,
but it might be caused by being tired)
b/ Is it possible to invoke Python functions from the template that
are enhancing the template dictionary?
Imagine a homepage that has a couple of 'widget' like fragments. These
are not really part of the controller, so I'd like to just say in the
template: invoke a function and place add the returned value to the
dict used for rendering the template.
c/ Is it possible to include in a template an HTML fragment generated
as a result of a function invocation?
It is a similar concept to the above one, the difference being that
the 'widget' template is completely outside the current page (while in
the above scenario the 'widget' template was part of the current
template)
4/ Request/Response cycle interceptors
Basically this is a way to plug in cross-cutting functionality that
will be automatically triggered at specific moment of the request/
response cycle:
- before_request
- before_controller
- after_controller
- before_view
- after_view
- after_request
I think the Django synonym would be middleware classes.
Many thanks in advance,
./alex
--
.w( the_mindstorm )p.
Alexandru Popescu
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---