On Jun 12, 10:46 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Still no comments about the issue below? I consider it an important
> issues and am not sure this is best ways (although it is in trunk
> now):
>
> I have been working on this this morning and YES, there is a bug. But
> there is more than that. The syntax I proposed before was
>
>    http://.../app/controller/function/arg0/arg1/.../argN.extension
>
> The problem is that works only if no args else there is ambiguity on
> whether the extension belongs to the function or to the argN. This of
>
>    http://..../admin/default/edit/filename.xml
>
> Do we want the to edit "filename.xml" or to we want to serialize the
> function edit in xml?
>
> I tentatively made it work on trunk by changing the notation into
>
>    http://.../app/controller/function.extension/arg0/arg1/.../argN
>
> (it is backward compatible since the previous did not work if args
> were present, moreover extension defaults always to html).

OK ! how could I not agree?

>
> This is tentatively in the trunk and you can do (assuming a table
> 'xxx')
>
> def select(): return dict(items=crud.select(request.args(0)))
> #http://127.0.0.1:8000/app/default/select.html/xxx
> #http://127.0.0.1:8000/app/default/select.xml/xxx
>
> def read(): return dict(item=crud.read(request.args(0),request.args
> (1)))
> #http://127.0.0.1:8000/app/default/read.html/xxx/1
> #http://127.0.0.1:8000/app/default/read.xml/xxx/1
>
> def data(): return dict(data=crud())
> #http://127.0.0.1:8000/app/default/data.html/select/xxx
> #http://127.0.0.1:8000/app/default/data.xml/select/xxx
> #http://127.0.0.1:8000/app/default/data.html/read/xxx/1
> #http://127.0.0.1:8000/app/default/data.xml/read/xxx/1
>
> Comments? Pros? Cons?

Nice. Some comments though:

1) /app/default/data defaults to /app/default/data/tables
with select type links for each table.
It is easy to do the same for create for example, where each link
would be a create type link for the respective table, but is it a good
idea?.

2) /app/default/select creates a ticket while
/app/default/data/select returns "404 not found"
more consistent results would be better.
One fix would be to move the 'tables' default response into Crud.select
(), but is it a good idea?.

3) /app/default/data.xml (or json or...) is ignored while
/app/default/data.xml/select/dog gives "invalid view" (no generic?)

4) Should Crud offer default serializers for xml, json, ... ?

That's all for now.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to