Commits

Adam Gomaa  committed cc42c1c

Integrate notedir as a flask app

  • Participants
  • Parent commits 6f0c400

Comments (0)

Files changed (2)

File propaneweb/__init__.py

 from django.core.handlers.wsgi import WSGIHandler
+
+# flask apps
+from faf import app as faf_app
+from libakg.logview import app as logview_app
 from libakg.memo import app as memo_app
 from libakg.memo2 import app as memo2_app
-from faf import app as faf_app
-from libakg.logview import app as logview_app
+from notedir import app as notedir_app
 from timeline import app as timeline_app
+from vcms import app as vcms_app
 from webproc import app as proc_app
-from vcms import app as vcms_app
 from werkzeug.wsgi import DispatcherMiddleware
 
+notedir_app.config["NOTEDIR_DIRECTORY"] = "/home/akg/var/notes"
+
 dj_app = WSGIHandler()
 
 app = DispatcherMiddleware(dj_app, {
         "/logview": logview_app,
         "/memo": memo_app,
         "/memo2": memo2_app,
+        "/notes": notedir_app,
         "/proc": proc_app,
         "/timeline": timeline_app,
         "/vcms": vcms_app,

File propaneweb/urls.py

 from django.contrib import admin
 admin.autodiscover()
 
-from notedir import Notedir
-def _notes_pre_callback(request, path):
-    from django.http import HttpResponseNotAllowed as http403
-    if not request.user.is_authenticated():
-        return http403("Go away!")
-    if request.user.username != 'akg':
-        return http403("Go away!")
-
-notes = Notedir(
-    directory="/home/akg/var/notes", pre_callback=_notes_pre_callback)
-
-
 urlpatterns = patterns(
     'propaneweb.views',
     url(r'^accounts/login/', 'login'),
     url(r'^music/(.*)', music, {}),
     url(r'^do/bbping', 'do_bbping', {}),
     url(r'^meta', 'meta', {}),
-    url(r'^notes/(.*)$', notes, {}),
     url(r'^dash/(.*)$', 'dash', {}),
 )