remove duplicate css file (onelab_marko) and group all common stuff in base.html
[myslice.git] / manifold / metadata.py
index 90a09ea..f7a5968 100644 (file)
@@ -4,28 +4,18 @@ import os.path
 from manifold.manifoldresult import ManifoldResult
 from manifold.manifoldapi import ManifoldAPI
 
+from django.contrib                     import messages
+
 debug=False
 debug=True
 
-# turn this on if you want to work offline
-work_offline=False
-#work_offline=True
-
 class MetaData:
 
     def __init__ (self, auth):
         self.auth=auth
         self.hash_by_object={}
 
-    def fetch (self):
-        offline_filename="%s/../offline-metadata.json"%os.path.dirname(__file__)
-        if work_offline:
-            try:
-                with file(offline_metadata) as f:
-                    self.hash_by_object=json.loads(f.read())
-                return
-            except:
-                print "metadata.work_offline: failed to decode %s"%offline_filename
+    def fetch (self, request):
         manifold_api = ManifoldAPI(self.auth)
         fields = ['table', 'column.name', 'column.qualifier', 'column.type', 
                   'column.is_array', 'column.description', 'column.default', 'key', 'capability']
@@ -57,10 +47,6 @@ class MetaData:
 #            print "Failed to retrieve metadata",rows_result.error()
 #            rows=[]
         self.hash_by_object = dict ( [ (row['table'], row) for row in rows ] )
-        # save for next time we use offline mode
-        if debug and rows:
-            with file(offline_filename,'w') as f:
-                f.write(json.dumps(self.hash_by_object))
 
     def to_json(self):
         return json.dumps(self.hash_by_object)