Commits

austgate  committed dd4cc3b

removed OFS as an import and replaced with db calls.

  • Participants
  • Parent commits 64fe120

Comments (0)

Files changed (2)

File openletters/controllers/data.py

 
 from pylons import request, response, session, tmpl_context as c
 
-from ofs.local import OFS
+#from ofs.local import OFS
 
 from openletters import model
 from openletters.lib.base import BaseController, render
         '''
           Return an endpoint in which ever format is requested
         '''
-        o = OFS()
+        #o = OFS()
         
         if author == "rdf":
             response.headers['Content-Type'] = 'application/rdf+xml'
             #response.headers['Content-Type'] = 'application/rdf+xml
-            for b in o.list_buckets():
-                g = o.get_stream(b, "endpoint")
-                return str(g.read())
+            #for b in o.list_buckets():
+            #    g = o.get_stream(b, "endpoint")
+            #    return str(g.read())
+            rdf = rdf_transform()
+            return rdf.create_rdf_end()
         
         elif author == "json":
             response.headers['Content-Type'] = 'application/json'
-            for b in o.list_buckets():
-                g = o.get_stream(b, "jsonendpoint")
-                return str(g.read())
+            #for b in o.list_buckets():
+            #    g = o.get_stream(b, "jsonendpoint")
+            #    return str(g.read())
+            js = json_transform()
+            return js.to_end_dict()
         
         elif author == "xml":
             xml = xml_transform()
             response.headers['Content-Type'] = 'application/xml'
             if correspondent == "simile":
-                for b in o.list_buckets():
-                    g = o.get_stream(b, "simileend", True)
-                    return str(g.read())
+                #for b in o.list_buckets():
+                #    g = o.get_stream(b, "simileend", True)
+                #    return str(g.read())
+                return xml.endpoint_xml('simile')
 
             else:
-                for b in o.list_buckets():
-                    g = o.get_stream(b, "xmlendpoint", True)
-                    return g.read()
+                #for b in o.list_buckets():
+                #    g = o.get_stream(b, "xmlendpoint", True)
+                #    return g.read()
                 return xml.endpoint_xml()
         else:
             return render("endpoint/index.html")

File openletters/controllers/place.py

 from pylons import request, response, session, tmpl_context as c
 from pylons.controllers.util import abort, redirect_to
 
-from ofs.local import OFS
-
 from openletters.lib.base import BaseController, render
 
 from openletters import model
 class PlaceController(BaseController):
 
     def index(self):
-        # Return a rendered template
-        #return render('/place.mako')
-        # or, return a response
-        #sparql = sparql_funcs()
-        #locations = []
-        #locations = list(sparql.find_places())
-        #c.places = sorted(locations)
-        #print "locations", c.place
+
         c.places =  model.Session.query(model.Location.url).distinct().all()
 
         return render('letters/magazineindex.html')