Fixed a couple bugs on rest when running under apache

This commit is contained in:
Adolfo Gómez 2014-01-21 09:19:59 +00:00
parent 8ed7bd1cc0
commit ba1927b0fc
2 changed files with 7 additions and 3 deletions

View File

@ -86,12 +86,13 @@ class Dispatcher(View):
return http.HttpResponseNotFound('method not found')
# Guess content type from content type header or ".xxx" to method
# Guess content type from content type header (post) or ".xxx" to method
try:
p = full_path.split('.')
processor = processors.available_processors_ext_dict[p[1]](request)
except:
processor = processors.available_processors_mime_dict.get(request.META['CONTENT_TYPE'], processors.default_processor)(request)
# TODO: Extract processor from accept and/or content type?
processor = processors.available_processors_mime_dict.get(request.META.get('CONTENT_TYPE', 'json'), processors.default_processor)(request)
# Obtain method to be invoked

View File

@ -99,4 +99,7 @@ class Providers(ModelHandler):
def allservices(self):
for s in Service.objects.all():
yield DetailServices.serviceToDict(s, True)
try:
yield DetailServices.serviceToDict(s, True)
except:
logger.exception('Passed service cause type is unknown')