X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=manifoldapi%2Fmetadata.py;h=3272241db2ee062cc580e78a410125fdb8213b77;hb=a948414844c79472807c5e66939a912a7b990433;hp=300397cbd9de154da992d68d90e4a54190fe925c;hpb=d5867ebb7c85a07fd5b9dad155c9a82048b3e706;p=myslice.git diff --git a/manifoldapi/metadata.py b/manifoldapi/metadata.py index 300397cb..3272241d 100644 --- a/manifoldapi/metadata.py +++ b/manifoldapi/metadata.py @@ -6,17 +6,20 @@ from manifoldapi import ManifoldAPI from django.contrib import messages +from myslice.settings import logger + debug=False #debug=True class MetaData: - def __init__ (self, auth): + def __init__ (self, url, auth): + self.url = url self.auth=auth self.hash_by_object={} def fetch (self, request): - manifold_api = ManifoldAPI(self.auth) + manifold_api = ManifoldAPI(self.url, self.auth) fields = ['table', 'column.name', 'column.qualifier', 'column.type', 'column.is_array', 'column.description', 'column.default', 'key', 'capability'] #fields = ['table', 'column.column', @@ -34,10 +37,10 @@ class MetaData: # xxx need a way to export error messages to the UI if result['code'] == 1: # warning # messages.warning(request, result['description']) - print ("METADATA WARNING -",request,result['description']) + logger.warning(("METADATA WARNING - {} {}".format(request,result['description']))) elif result['code'] == 2: # messages.error(request, result['description']) - print ("METADATA ERROR -",request,result['description']) + logger.error(("METADATA ERROR - {} {}".format(request,result['description']))) # XXX FAIL HERE XXX return @@ -58,5 +61,6 @@ class MetaData: return self.hash_by_object[object]['column'].sort() def get_field_type(self, object, field): - if debug: print "Temp fix for metadata::get_field_type() -> consider moving to manifold.core.metadata soon" + if debug: + logger.debug("Temp fix for metadata::get_field_type() -> consider moving to manifold.core.metadata soon") return field