Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Commit

Permalink
log instead of fail
Browse files Browse the repository at this point in the history
  • Loading branch information
zalun committed Jan 4, 2011
1 parent b755bf4 commit 5599ffd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions apps/api/views.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import os
import commonware.log

from cuddlefish import apiparser

from django.shortcuts import render_to_response
from django.template import RequestContext
from django.conf import settings
from django.http import Http404

from jetpack.models import SDK

log = commonware.log.getLogger('f.api')

sdks = SDK.objects.all()
if sdks.count() > 0:
MAIN_SDK = sdks[0]
Expand Down Expand Up @@ -115,11 +119,21 @@ def module(r, package_name, module_name):

sdk_version = SDKVERSION
doc_file = '.'.join((module_name, 'md'))
text = open(
os.path.join(SDKPACKAGESDIR,
package_name, 'docs', doc_file)).read()
doc_path = os.path.join(SDKPACKAGESDIR,
package_name, 'docs', doc_file)
try:
text = open(doc_path).read()
except Exception, err:
log.error(str(err))
raise Http404

# changing the tuples to dictionaries
hunks = list(apiparser.parse_hunks(text))
try:
hunks = list(apiparser.parse_hunks(text))
except Exception, err:
log.error(str(err))
hunks = [[None,'Sorry. Error in reading the doc']]

entities = []
for h in hunks:
# convert JSON to a nice list
Expand Down
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
site.addsitedir(path('vendor/lib/python'))
site.addsitedir(path('apps'))
site.addsitedir(path('lib'))
site.addsitedir(path('lib/jetpack-sdk-0.8/python-lib')) # weak sauce
site.addsitedir(path('lib/addon-sdk-0.9/python-lib')) # weak sauce

# Move the new items to the front of sys.path. (via virtualenv)
new_sys_path = []
Expand Down

0 comments on commit 5599ffd

Please sign in to comment.