Re: GSoC 2007 Status Update VII: Django REST interface

2007-08-19 Thread David Larlet

2007/8/19, Andreas Stuhlmüller <[EMAIL PROTECTED]>:
>
> On 8/17/07, David Larlet <[EMAIL PROTECTED]> wrote:
> > Just one (latest?) thought, it's a bit hard to debug because
> > 400 errors are not really verbose, is it possible to find a
> > way to make debug easier? For the moment, I have: if
> > settings.DEBUG: print i.errors but I'm sure it can be better.
>
> I made the 400 error template a bit more verbose. The responder
> classes that use serializers include the model errors in their
> responses anyway. Is this what you were looking for?

Exactly, thanks for your pointer.

>
> > In fact, the problem is that you use ResourceForm in
> > model_resource and it could be interesting to use the given
> > form_class instead.
>
> You're right, it might be nice to be able to change the validation and
> data cleanup behavior of resources. Check out the latest revision and
> tell me if this is along the lines you were thinking.
>

That's what I had in mind, thanks for your reactivity.

Two little "issues" (maybe issues should be submitted to the google project?):

* in TemplateResponder.update_form(), the 'update' var allow to deal
with different forms in the same template (add the hidden fake PUT
field for instance) but given the fact that there is no 'update' var
in the create_form() function, you can't simply use {% if update %},
simple patch: add 'update': False.

* in update_form(), you test if request.PUT: but AFAIK with the
middleware you can't do that, you should test with if request.method
== 'PUT':

David

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: GSoC 2007 Status Update VII: Django REST interface

2007-08-19 Thread Andreas Stuhlmüller

On 8/17/07, David Larlet <[EMAIL PROTECTED]> wrote:
> Just one (latest?) thought, it's a bit hard to debug because
> 400 errors are not really verbose, is it possible to find a
> way to make debug easier? For the moment, I have: if
> settings.DEBUG: print i.errors but I'm sure it can be better.

I made the 400 error template a bit more verbose. The responder
classes that use serializers include the model errors in their
responses anyway. Is this what you were looking for?

> In fact, the problem is that you use ResourceForm in
> model_resource and it could be interesting to use the given
> form_class instead.

You're right, it might be nice to be able to change the validation and
data cleanup behavior of resources. Check out the latest revision and
tell me if this is along the lines you were thinking.

Regards,
Andreas

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: GSoC 2007 Status Update VII: Django REST interface

2007-08-17 Thread David Larlet

2007/8/13, Andreas Stuhlmüller <[EMAIL PROTECTED]>:
> I added code for forms to TemplateResponder (create_form,
> update_form), an example that shows how to use this code and another
> example that shows how to specify the data format at the end of your
> URLs.

I didn't know the curry function, very interesting!

> A few days ago, I started writing a short tutorial [2] that describes
> how to provide an API for an existing Django application using the
> REST interface. If you have any questions, ideas, can't get the
> interface to work or want to contribute bugfixes and other
> enhancements, please go ahead.
>

Just one (latest?) thought, it's a bit hard to debug because 400
errors are not really verbose, is it possible to find a way to make
debug easier? For the moment, I have: if settings.DEBUG: print
i.errors but I'm sure it can be better.

Regards,
David

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



GSoC 2007 Status Update VII: Django REST interface

2007-08-13 Thread Andreas Stuhlmüller

This is the seventh status update for my Summer of Code project, the
Django REST interface [1].

Last week, I extracted code from the ModelResource class that is not
directly related to models but useful for resources in general, moved
it to Resource and made ModelResource inherit from Resource. I added
an example of a non-model-based resource and corresponding tests. The
generic resource class now uses the same kind of authentication that
ModelResource uses.

You can now run "python manage.py syncdb; python manage.py runserver"
in the django_restapi_tests folder and get a testable environment that
includes some initial data.

I added code for forms to TemplateResponder (create_form,
update_form), an example that shows how to use this code and another
example that shows how to specify the data format at the end of your
URLs.

A few days ago, I started writing a short tutorial [2] that describes
how to provide an API for an existing Django application using the
REST interface. If you have any questions, ideas, can't get the
interface to work or want to contribute bugfixes and other
enhancements, please go ahead.

Regards,
Andreas Stuhlmüller

[1] http://code.google.com/p/django-rest-interface/
[2] http://code.google.com/p/django-rest-interface/wiki/RestifyDjango

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---