Fix not working docs show view. Document show view wasn't updated when the logic refactor was made.
authorPawel Solyga <Pawel.Solyga@gmail.com>
Wed, 15 Oct 2008 13:54:00 +0000
changeset 336 9d5b8880260f
parent 335 9c1a6e02ebec
child 337 cb7d22b1e7d8
Fix not working docs show view. Document show view wasn't updated when the logic refactor was made. Patch by: Pawel Solyga Review by: to-be-reviewed
app/soc/views/docs/show.py
--- a/app/soc/views/docs/show.py	Wed Oct 15 13:51:31 2008 +0000
+++ b/app/soc/views/docs/show.py	Wed Oct 15 13:54:00 2008 +0000
@@ -24,10 +24,9 @@
   ]
 
 
-from google.appengine.api import users
-
-from soc.logic import document
 from soc.logic import out_of_band
+from soc.logic import path_link_name
+from soc.logic.models import document
 from soc.views import helper
 from soc.views import simple
 
@@ -63,10 +62,17 @@
 
   # TODO: based on the User's Roles, Documents that the User can edit
   #   should display a link to a document edit form
+  
+  doc = None
 
   # try to fetch User entity corresponding to link_name if one exists
+  path = path_link_name.combinePath([partial_path, link_name])
+
+  # try to fetch Document entity corresponding to path if one exists    
   try:
-    doc = document.getDocumentIfPath(partial_path, link_name=link_name)
+    if path:
+      doc = document.logic.getFromFields(partial_path=partial_path,
+                                         link_name=link_name)
   except out_of_band.ErrorResponse, error:
     # show custom 404 page when Document path doesn't exist in Datastore
     return simple.errorResponse(request, error, template, context)