Giter Site home page Giter Site logo

django-piston's People

Contributors

aljungberg avatar atilla avatar bpollack avatar davedash avatar davidbgk avatar ema avatar garethr avatar james-emerton avatar jespern avatar jezdez avatar joestump avatar madssj avatar mdorn avatar mtrichardson avatar mwrshl avatar robotadam avatar shanx avatar spreeker avatar teebes avatar zakj avatar zerok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-piston's Issues

http basic auth is broken

When returning the challenge response and the 401 status, an exception is triggered.
Exception is triggered because HttpBasicAuthentication::challenge() is called with two params instead of one.

This small patch solved the issue

diff --git a/piston/authentication.py b/piston/authentication.py
index a11e260..f1b814a 100644
--- a/piston/authentication.py
+++ b/piston/authentication.py
@@ -63,7 +63,7 @@ class HttpBasicAuthentication(object):
 
         return not request.user in (False, None, AnonymousUser())
 
-    def challenge(self):
+    def challenge(self, request=None):
         resp = HttpResponse("Authorization Required")
         resp['WWW-Authenticate'] = 'Basic realm="%s"' % self.realm
         resp.status_code = 401

method signature has been copied from OAuthAuthentication class..

Generic ForeignKey Problem with Django 1.3 ???

When i run my application with api, my comment model is giving error (from piston/emitters.py in _model, line 174), says that :

AttributeError at /api/comments/

'GenericForeignKey' object has no attribute 'attname'

my model is like this:

from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.generic import GenericForeignKey

class CommentManager(models.Manager):
    def get_by_natural_key(self, username):
    return self.get(username)

class Comment(models.Model):
    owner = models.ForeignKey(User)
    comment = models.CharField(max_length=2000)
    target_object  = GenericForeignKey('ctype', 'oid')
    created_at = models.DateTimeField(auto_now_add=True)

    ctype = models.ForeignKey(ContentType)
    oid = models.PositiveIntegerField()

and my handler is like this :

class CommentHandler(BaseHandler):
    allowed_methods = ("GET",)
    model = Comment

    def read(self, request):
        return Comment.objects.all()

if you want, i can give additional information. Thanks for your response...

Wiki changes

FYI: The following changes were made to this repository's wiki:

These were made as the result of a recent automated defacement of publically writeable wikis.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.