Skip to content

Commit

Permalink
(Hopefully) fixed a unicode issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
debrouwere committed Nov 30, 2010
1 parent 9e436df commit 2355e88
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions Flask_API_Server.egg-info/SOURCES.txt
Expand Up @@ -6,6 +6,7 @@ Flask_API_Server.egg-info/dependency_links.txt
Flask_API_Server.egg-info/requires.txt
Flask_API_Server.egg-info/top_level.txt
apiserver/__init__.py
apiserver/authentication.py
apiserver/controllers.py
apiserver/dispatch.py
apiserver/serializers.py
Expand Down
7 changes: 5 additions & 2 deletions apiserver/serializers.py
Expand Up @@ -39,7 +39,10 @@ def simplify_tuple(self, obj):
return list(obj)

def simplify_string(self, obj):
return unicode(obj)
try:
return unicode(obj)
except UnicodeDecodeError:
return obj

def simplify_object(self, obj):
if hasattr(obj, 'facade'):
Expand Down Expand Up @@ -165,4 +168,4 @@ def facade(self):
pprint(simple_f)
print simplejson.dumps(simple_f, indent=4)
print(resource.to_yaml())
"""
"""
8 changes: 6 additions & 2 deletions apiserver/tests/controllers.py
Expand Up @@ -33,7 +33,11 @@ def show(self, name):
output.sisters = [Person('Suzanne'), Person('Joanne')]
output.sisters[1].age = 33
output.classes = ['Anthropology', 'Econ 101']
return api.formatted_response(output, html_template='people/person.html', formats=['json', 'yaml', 'html', 'xml'])
return api.formatted_response(
output,
html_template='people/person.html',
formats=['json', 'yaml', 'html', 'xml']
)

def destroy(self):
return 'Goodbye world'
Expand All @@ -44,4 +48,4 @@ class PeopleController(api.RESTController):

@api.requires(realm, "unrestricted")
def show(self):
return api.formatted_response({})
return api.formatted_response({})

0 comments on commit 2355e88

Please sign in to comment.