"If you have any advice".  :-)
I most certainly don't!  I wish I had enough experience to really get in on 
this conversation.

Your ajax solution seems pretty doable, but you're absolutely correct that 
it would require javascript at all times.


For what it's worth, the suggestions from the flask team seem to be 
similar.  So...  I think I'll just have to live with the 
two independent code streams.

That said, I really like web2py thus far.  There's still a bunch of magic 
I'm trying to unlock, but damn is this an easy to learn platform!


On Saturday, July 28, 2012 9:32:35 PM UTC-6, Massimo Di Pierro wrote:
>
> This is an excellent point.
>
> The closest we came to what you asked is the crud object. If a page 
> contains a single crud form and if the page is called with the json 
> extension, it reads the form variable from ?json. This allows one to 
> interact with the Crud object (create,read, update, delete) using html and 
> or rest-like approach.
> I say rest-like because it is not really restful. This is because we do 
> not use PUT and DELETE for Crud.
>
> Anyway, we are considering deprecating Crud because nobody used it this 
> way.
>
> The problem is that html forms and rest services are very different. html 
> forms assume a state (for preventing crsf, for checking permissions, etc.) 
> while rest services are not supposed to. One html page (one url) can 
> contain more crud elements while a restful URL deals with only one service 
> at the time. Html pages do not use PUT and DELETE (unless doing ajax) while 
> rest services do. Usually information in html and rest services is filtered 
> differently.
>
> Therefore we have developed different APIs for forms (SQLFORM, FORM) and 
> rest (@request.restful()).
>
> The only way to build a uniform APIs would be to have html forms and pages 
> get all their data via Ajax restful calls. Yet many users do not 
> want functional parts of their web site depending on JavaScript.
>
> In my view there is no simple solution to this problem and it is easier to 
> actually implement html forms and rest services separately. If you have any 
> advice on how to built a better system, I would like to hear your ideas. It 
> could help make web2py better.
>
> massimo
>
>
>
>
>
>
>
> On Saturday, 28 July 2012 21:41:34 UTC-5, Matthew Wood wrote:
>>
>> A quick question about basic CRUD for both humans (basic HTML) and 
>> computers
>> (REST)
>>
>> I'm trying to pick a solid python framework for a project at work.  We 
>> have a
>> lot of situations where we need to expose datbase tables for data CRUD.
>>
>> I'm trying to pick between Flask and Web2py at this time, but I've got a
>> specific need that I'm not sure is solved by either framework.
>>
>> Obviously for human consumption, I'll be using some sort of form-library 
>> that
>> will read the table-schema auto-create the form for me.  (Built in with 
>> Web2py,
>> WTForms + SQL-Alchemy for Flask.)  For the REST interfaces, I'll use a 
>> similar
>> library (Built in with Web2py, flask-rest for flask).
>>
>> What I'd REALLY like, is to have both the REST interfaces and html-forms 
>> use as
>> much of a common code-path as possible.  It's really frustrating when 
>> things
>> like data-validation work differently between one's REST interfaces and 
>> one's
>> html forms.
>>
>> Thusfar, in my investigations with both frameworks, I've felt that both
>> mechanisms appear quite different, and/or I have to do a lot of manual 
>> parsing
>> of XML in the Post/Put REST case.
>>
>> HOWEVER...  I've really only spent a little time investigating either one.
>> It's extremely likely that I'm just completely missing the best way to 
>> solve
>> the issue I'm describing.
>>
>> Can anyone point me to an example that works the way I'm describing?
>>
>> Hopefully, I have asked my question well enough.  :-) I'm feeling horribly
>> inelequent right now.
>>
>

-- 



Reply via email to