1. Luke Plant
  2. django-piston

Commits

Joe Stump  committed a84ccc4

- Added Consumer to request object.
- Added INTERNAL_ERROR for 500 errors.

  • Participants
  • Parent commits 0d43837
  • Branches default

Comments (0)

Files changed (3)

File piston/authentication.py

View file
  • Ignore whitespace
 
             if consumer and token:
                 request.user = token.user
+                request.consumer = consumer
                 request.throttle_extra = token.consumer.id
                 return True
             

File piston/signals.py

View file
  • Ignore whitespace
+# Django imports
+import django.dispatch 
+
 # Piston imports
-# from models import Consumer
 from utils import send_consumer_mail
 
 def consumer_post_save(sender, instance, created, **kwargs):
 def consumer_post_delete(sender, instance, **kwargs):
     instance.status = 'canceled'
     send_consumer_mail(instance)
+
+

File piston/utils.py

View file
  • Ignore whitespace
                  NOT_FOUND = ('Not Found', 404),
                  DUPLICATE_ENTRY = ('Conflict/Duplicate', 409),
                  NOT_HERE = ('Gone', 410),
+                 INTERNAL_ERROR = ('Internal Error', 500),
                  NOT_IMPLEMENTED = ('Not Implemented', 501),
                  THROTTLED = ('Throttled', 503))