Friday, August 31, 2012

What does this code do? Also, testing decorator via terminal?

Hello,

Silly question, but...

What does this code do:

if isinstance(objects, HttpResponse):
return objects

... full code found here:

<https://github.com/julian-amaya/django-decorators/blob/master/django_decorators/decorators.py#L37-38>

I'd like to add:

if objects.status_code != 200:
return objects

... which is found via this code:

<https://gist.github.com/871954>

In other words, the final code would look like so (untested):

<https://gist.github.com/3563671>

I just don't fully understand what the `isinstance()` bit is doing. :(

Also, how can I test decorators via the python shell?

Sorry if noob questions.

Thanks!
M

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

No comments:

Post a Comment