Problem occured 'resource_uri' in Example 'Blogpost'

Issue #59 new
created an issue

<<issue 54>> It's about 'resource_uri' problem, when you trying to connect to server. It always make a error and show me some message as below.

but if I remove this request_uri code in, it's fine. And I also tried what you said, I mean adding request parameter in 'read' method. but it's not work..

is anyone who through this?


Request Method: GET Request URL: Django Version: 1.0.2 final Python Version: 2.5.4 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'django.contrib.markup', '', 'blogserver.api'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware')

Traceback: File "C:\Python25\lib\site-packages\django\core\handlers\" in get_response 86. response = callback(request, callback_args, callback_kwargs) File "C:\Python25\lib\site-packages\django\views\decorators\" in inner_func 21. response = func(*args, kwargs) File "build\bdist.win32\egg\piston\" in call 172. else: stream = srl.render(request) File "build\bdist.win32\egg\piston\" in render 367. seria = simplejson.dumps(self.construct(), cls=DateTimeAwareJSONEncoder, ensure_ascii=False, indent=4) File "build\bdist.win32\egg\piston\" in construct 276. return _any(, self.fields) File "build\bdist.win32\egg\piston\" in _any 91. ret = _qs(thing, fields=fields) File "build\bdist.win32\egg\piston\" in _qs 261. return [ _any(v, fields) for v in data ] File "build\bdist.win32\egg\piston\" in _any 99. ret = _model(thing, fields=fields) File "build\bdist.win32\egg\piston\" in _model 243. ret['resource_uri'] = permalink( lambda: (url_id, File "C:\Python25\lib\site-packages\django\db\" in inner 30. return reverse(bits[0], None, bits[1:3]) File "C:\Python25\lib\site-packages\django\core\" in reverse 254. args, *kwargs))) File "build\bdist.win32\egg\piston\" in <genexpr> 244. (getattr(data, f) for f in fields) ) )()

Exception Type: AttributeError at /api/posts/ Exception Value: 'Blogpost' object has no attribute 'format'

Comments (9)

  1. Anonymous

    I'm having the exact same issue when running the "blogserver" example project from the django-piston bitbucket download. Does anyone know how to resolve this?


  2. Anonymous

    Just replace

    return ('blogposts',  ['format',])


    return ('blogposts',  ['title',])

    and that's all

  3. Anonymous

    Hi, I'm receiving the same error. Has anyone been able to find a fix for this?


    TypeError at /api/posts/

    resource_uri() takes exactly 2 arguments (1 given)

    Request Method: GET

    Request URL: http://localhost:8000/api/posts/

    Django Version: 1.3.1

    Exception Type: TypeError

    Exception Value:

    resource_uri() takes exactly 2 arguments (1 given)

    Exception Location: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site- packages/django_piston-0.2.2-py2.6.egg/piston/ in _model, line 242

  4. Log in to comment