This repository has been archived by the owner. It is now read-only.

fixed a bug where links['self'] raises AttributeError #3

Open
wants to merge 4 commits into
from

Conversation

Projects
None yet
1 participant
Contributor

fcurella commented Jun 1, 2011

Signed-off-by: Flavio Curella flavio.curella@gmail.com

I've found this nasty bug:

In [1]: import storymarket

In [2]: api = storymarket.Storymarket('API_KEY')

In [3]: c = api.categories.all()[0]

In [4]: c.links
Out[4]: {u'self': <Link rel=u'self' href=u'/api/v1/content/category/5/'>}

In [5]: c.links['self']
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)

/Users/flavio/working_copies/python-storymarket/src/python-storymarket/<ipython console> in <module>()

KeyError: 'self'

The problem is that the self.links get overwritten by _add_details(), which is called on __get__()

fixed a bug where links['self'] raises AttributeError
Signed-off-by: Flavio Curella <flavio.curella@gmail.com>
Contributor

fcurella commented Jun 1, 2011

for some reason the bug only appears on ipython. Any idea why?

fcurella added some commits Jun 3, 2011

added filename attribute to the multipart form
Signed-off-by: Flavio Curella <flavio.curella@gmail.com>
added a shortcut method to retrieve a type's default sub type
Signed-off-by: Flavio Curella <flavio.curella@gmail.com>
removed a spurious print statement in tests
Signed-off-by: Flavio Curella <flavio.curella@gmail.com>
Contributor

fcurella commented Jun 3, 2011

2d1a664 was preventing StoryMarket to see the uploaded file in request.FILES

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.