On Mar 20, 5:16 pm, Alex Popescu <[email protected]>
wrote:
> Hi all,
>
> I've spent some time reading the available documentation on web2py
> (plus some more). I'll start by saying that I like a lot of things I'm
> seeing. Still, there are a couple of weird questions that I'd like to
> ask:
>
> 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()
> 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
> So far these are the only 2 reasons that I haven't signed yet for
> web2py. I also believe that 1st idea would be helpful to other web2py
> users looking for RESTful apps, while the 2nd one can be seen just as
> 'syntactic sugar' (there may be other small benefit like intellisense
> support in IDEs, readability, refactoring, etc.)
>
> Looking forward to your answer(s),
>
> ./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
-~----------~----~----~----~------~----~------~--~---