def get_plot_list(self, dbName='', acc='', tag='', since='', fileType='png', test=None):
        self.check_dbName_acc(dbName, acc, since);
        if fileType != "png":
            cherrypy.HTTPError(405, "Bad file type !!!!!")
        #try:
        #ArgumentValidator.validateArgs(dbName = dbName, tag = tag, since = since, onesince = False)
        #db = self.masker.unmask_dbname(dbName)
        #db = av.get_validated_dbname(value = db, acc = self.masker.unmask_schema(db, acc))
        #vtag = av.get_validated_tag(dbName = db, value = tag)
        connectionString = getFrontierConnectionString(acc, dbName)
        shortConnectionString = getFrontierConnectionString(acc, dbName, short = True)
	#c = readXML()
	#db	=	str(c.dbMap_reverse[dbName]+"/CMS_COND_"+acc)
	vtag	=	str(tag)
        #sinces = av.get_validated_since(value = since, db = db, tag = vtag).split(';')
        sinces = av.get_validated_since(value = since.strip(), db = connectionString, tag = vtag).split(';')
        dict = {}
	print self.__plotsdir
        for i in sinces:
            if i != '' or i != None:
                plot = SubdetectorFactory.getPlotInstance(dbName = connectionString, tag = vtag, since = i, 
                                                          fileType = fileType, directory = self.__plotsdir,
                                                          shortName = shortConnectionString)
                dict[i] = plot.get_names()            
        cherrypy.response.headers['Content-Type'] = 'text/plain'
        #start returning json when frontend is able do decode it
        #return json.dumps(dict)
        #outer for-comprehension calls inner for-c for every key in dictionary
        #inner for-c creates a list of strings that llok like 1:a
        #{1:[a,b], 2:[b,c]} -> 1:a;1:b;2:b;2:c
        return ';'.join([';'.join(['%s:%s' % (i, x) for x in dict[i]]) for i in dict.keys()])
        '''except ValueError, e:
    def get_histo(self, dbName='', acc='', tag='', since=''):
        self.check_dbName_acc(dbName, acc, since)
        '''Returns histo. 
        All arguments in get_histo method have default value equal to '' just
        for avoiding exception if some parameter is missing.

        For testing:
        http://HOSTNAME:PORT/get_histo?dbName=oracle://cms_orcoff_prod/CMS_COND_31X_ECAL&tag=EcalIntercalibConstants_EBg50_EEnoB&since=1
        '''

        try:
            tmpdb = self.masker.unmask_dbname(dbName)
            db = av.get_validated_dbname(value=tmpdb,
                                         acc=self.masker.unmask_schema(
                                             tmpdb, acc))
            vtag = av.get_validated_tag(dbName=db, value=tag)
            vsince = av.get_validated_since(value=since.strip(),
                                            db=db,
                                            tag=vtag,
                                            onlyone=True)
            directory = self.__histodir
            histo = SubdetectorFactory.getHistoInstance(dbName=db,
                                                        tag=vtag,
                                                        since=vsince,
                                                        fileType='png',
                                                        directory=directory)
            histoData = histo.get()
        except:
            return 'Tag doesn\'t exist'
        else:
            cherrypy.response.headers['Content-Type'] = 'image/png'
            return histoData
 def get_summary(self,
                 dbName='Offline Production',
                 acc='31X_ECAL',
                 tag='EcalIntercalibConstants_EBg50_EEnoB',
                 since='1'):
     self.check_dbName_acc(dbName, acc, since)
     '''Return payload summary.
     For testing:
     http://HOSTNAME:PORT/get_summary?dbName=oracle://cms_orcoff_prod/CMS_COND_31X_ECAL&tag=EcalIntercalibConstants_EBg50_EEnoB&since=1
     '''
     #c = readXML()
     #db	=	str(c.dbMap_reverse[dbName]+"/CMS_COND_"+acc)
     connectionString = getFrontierConnectionString(acc, dbName)
     vtag = str(tag)
     sinces = av.get_validated_since(value=since,
                                     db=connectionString,
                                     tag=vtag).split(';')
     rez = []
     for i in sinces:
         inst = SubdetectorFactory.getSummaryInstance(
             dbName=connectionString, tag=vtag, since=str(i))
         rez.append({
             self.get_decorated_since(db=dbName, acc=acc, tag=tag, since=i):
             inst.summary()
         })
     return json.dumps({'summary': rez})
 def get_trend_plot(self,
                    dbName='',
                    acc='',
                    tag='',
                    since='',
                    fileType='png'):
     self.check_dbName_acc(dbName, acc, since)
     if fileType != "png":
         cherrypy.HTTPError(405, "Bad file type !!!!!")
     c = readXML()
     db = str(c.dbMap_reverse[dbName] + "/CMS_COND_" + acc)
     vtag = str(tag)
     return "ciao"
     vsince = av.get_validated_since(value=since.strip(),
                                     db=db,
                                     tag=vtag,
                                     onlyone=False)
     plot = SubdetectorFactory.getTrendPlotInstance(
         dbName=db,
         tag=vtag,
         since=vsince,
         fileType=fileType,
         directory=self.__trendplotsdir)
     data = plot.get()
     cherrypy.response.headers['Content-Type'] = 'image/' + fileType
     return data
 def get_plot_cmp(self, dbName1 = '', acc1='',tag1 = '', since1 = '1', fileType1 = 'png', png1 = '',
                 dbName2 = '', acc2='',tag2 = '', since2 = '1', fileType2 = 'png', png2 = '', type='3', istkmap = '1'):
     self.check_dbName_acc(dbName1, acc1, since1);
     self.check_dbName_acc(dbName2, acc2, since2);
     if fileType1 != "png" and fileType2 != "png":
         cherrypy.HTTPError(405, "Bad file type !!!!!")
     tmpdb = self.masker.unmask_dbname(dbName1)
     db = av.get_validated_dbname(value = tmpdb, acc = self.masker.unmask_schema(tmpdb, acc1))
     vtag = av.get_validated_tag(dbName = db, value = tag1)
     vsince = av.get_validated_since(value = since1.strip(), db = db, tag = vtag, onlyone = True)
     plot = SubdetectorFactory.getPlotInstance(dbName = db, tag = vtag, since = vsince, 
                                             fileType = fileType1, directory = self.__plotsdir, image = png1)
     img1 = plot.get(get_fname = True)
     tmpdb = self.masker.unmask_dbname(dbName2)
     db = av.get_validated_dbname(value = tmpdb, acc = self.masker.unmask_schema(tmpdb, acc2))
     vtag = av.get_validated_tag(dbName = db, value = tag2)
     vsince = av.get_validated_since(value = since2.strip(), db = db, tag = vtag, onlyone = True)
     plot = SubdetectorFactory.getPlotInstance(dbName = db, tag = vtag, since = vsince, 
                                             fileType = fileType2, directory = self.__plotsdir, image = png2)
     img2 = plot.get(get_fname = True)
     #raise Exception('asdasd'+img2)
     '''if type == '1':
         img3 = ImageChops.subtract(img1, img2, scale=1, offset=128)
     elif type == '2':
         img3 = ImageChops.subtract(img2, img1, scale=1, offset=128)
     elif type == '3':
         img3 =  ImageChops.difference(img1, img2)
     elif type == '4':
         img3 = ImageChops.subtract(img1, img2, scale=1, offset=0)
     else:
         img3 = ImageChops.subtract(img2, img1, scale=1, offset=0)
     '''
     if not os.path.isdir(self.__tmpdir):
         os.makedirs(self.__tmpdir)
     temp = tempfile.TemporaryFile(dir = self.__tmpdir)
     plotTxt = ""
     if re.search('strip', vtag.lower()):
         plotTxt = 'ABSOLUTE DIFFERENCE  (The more lighter colors, the higher the difference.)'
     cmpPNG.CmpTrackerDiff(fileName1 = img1, fileName2 = img2, result = temp,
                txt = plotTxt,
                debug = False)
     #img3.save(temp, 'png')
     temp.seek(0)
     cherrypy.response.headers['Content-Type'] = 'image/' + fileType1
     data = temp.read()
     temp.close()
     return data
    def get_xml(self, dbName='', acc='', tag='', since=''):
        self.check_dbName_acc(dbName, acc, since)
        '''Returns gzipped XML payload. 
        All arguments in get_xml method have default value equal to '' just
        for avoiding exception if some parameter is missing.

        For testing:
	http://webcondvm2:8083/get_xml?dbName=oracle://cms_orcoff_prod/CMS_COND_31X_ECAL&tag=EcalIntercalibConstants_EBg50_EEnoB&since=1;
        '''
        #try:
        #c = readXML()
        #db	=	str(c.dbMap_reverse[dbName]+"/CMS_COND_"+acc)
        connectionString = getFrontierConnectionString(acc, dbName)
        shortConnectionString = getFrontierConnectionString(acc,
                                                            dbName,
                                                            short=True)
        vtag = str(tag)
        vsince = av.get_validated_since(value=since,
                                        db=connectionString,
                                        tag=vtag,
                                        onlyone=False)

        if len(vsince.split(';')) == 1:
            xml = SubdetectorFactory.getXMLInstance(
                dbName=connectionString,
                tag=vtag,
                since=vsince,
                fileType='tar.gz',
                directory=self.__xmldir,
                shortName=shortConnectionString)
            data = xml.get()
        else:
            temp = tempfile.TemporaryFile(dir=self.__tmpdir)
            tar = tarfile.open(mode="w|gz", fileobj=temp)
            for i in vsince.split(';'):
                xml = SubdetectorFactory.getXMLInstance(
                    dbName=connectionString,
                    tag=vtag,
                    since=i,
                    fileType='xml',
                    directory=self.__xmldir,
                    shortName=shortConnectionString)
                name = xml.dump()
                tar.add(name, arcname=os.path.basename(name), recursive=False)

            tar.close()
            temp.seek(0)
            data = temp.read()

        cherrypy.response.headers['Content-Disposition'] = \
                'attachment;filename=' + '_'.join([vtag, vsince.replace(';', '_'), '.tar.gz'])
        #cherrypy.response.headers['Content-Type'] = 'application/x-gzip'
        cherrypy.response.headers['Content-Encoding'] = 'gzip'
        return data
    def get_trend_plot(self, dbName = '', acc = '', tag = '', since = '', fileType = 'png'):
        self.check_dbName_acc(dbName, acc, since);
        if fileType != "png" :
            cherrypy.HTTPError(405, "Bad file type !!!!!")
	c = readXML()
	db	=	str(c.dbMap_reverse[dbName]+"/CMS_COND_"+acc)
	vtag	=	str(tag)
        return "ciao"
        vsince = av.get_validated_since(value = since.strip(), db = db, tag = vtag, onlyone = False)
        plot = SubdetectorFactory.getTrendPlotInstance(dbName = db, tag = vtag, since = vsince, 
                                                fileType = fileType, directory = self.__trendplotsdir)
        data = plot.get()
        cherrypy.response.headers['Content-Type'] = 'image/' + fileType
        return data
 def get_plot_list(self,
                   dbName='',
                   acc='',
                   tag='',
                   since='',
                   fileType='png',
                   test=None):
     self.check_dbName_acc(dbName, acc, since)
     if fileType != "png":
         cherrypy.HTTPError(405, "Bad file type !!!!!")
     #try:
     #ArgumentValidator.validateArgs(dbName = dbName, tag = tag, since = since, onesince = False)
     #db = self.masker.unmask_dbname(dbName)
     #db = av.get_validated_dbname(value = db, acc = self.masker.unmask_schema(db, acc))
     #vtag = av.get_validated_tag(dbName = db, value = tag)
     connectionString = getFrontierConnectionString(acc, dbName)
     shortConnectionString = getFrontierConnectionString(acc,
                                                         dbName,
                                                         short=True)
     #c = readXML()
     #db	=	str(c.dbMap_reverse[dbName]+"/CMS_COND_"+acc)
     vtag = str(tag)
     #sinces = av.get_validated_since(value = since, db = db, tag = vtag).split(';')
     sinces = av.get_validated_since(value=since.strip(),
                                     db=connectionString,
                                     tag=vtag).split(';')
     dict = {}
     print self.__plotsdir
     for i in sinces:
         if i != '' or i != None:
             plot = SubdetectorFactory.getPlotInstance(
                 dbName=connectionString,
                 tag=vtag,
                 since=i,
                 fileType=fileType,
                 directory=self.__plotsdir,
                 shortName=shortConnectionString)
             dict[i] = plot.get_names()
     cherrypy.response.headers['Content-Type'] = 'text/plain'
     #start returning json when frontend is able do decode it
     #return json.dumps(dict)
     #outer for-comprehension calls inner for-c for every key in dictionary
     #inner for-c creates a list of strings that llok like 1:a
     #{1:[a,b], 2:[b,c]} -> 1:a;1:b;2:b;2:c
     return ';'.join([
         ';'.join(['%s:%s' % (i, x) for x in dict[i]]) for i in dict.keys()
     ])
     '''except ValueError, e:
    def get_summary(self, dbName='Offline Production', acc='31X_ECAL',tag='EcalIntercalibConstants_EBg50_EEnoB', since='1'):
        self.check_dbName_acc(dbName, acc, since);
        '''Return payload summary.
        For testing:
        http://HOSTNAME:PORT/get_summary?dbName=oracle://cms_orcoff_prod/CMS_COND_31X_ECAL&tag=EcalIntercalibConstants_EBg50_EEnoB&since=1
        '''
	#c = readXML()
	#db	=	str(c.dbMap_reverse[dbName]+"/CMS_COND_"+acc)
        connectionString = getFrontierConnectionString(acc, dbName)
	vtag	=	str(tag)
        sinces = av.get_validated_since(value = since, db = connectionString, tag = vtag).split(';')
        rez = []
        for i in sinces:
            inst = SubdetectorFactory.getSummaryInstance(dbName = connectionString, tag = vtag, since = str(i))
            rez.append({self.get_decorated_since(db = dbName, acc = acc, tag = tag, since = i):inst.summary()})
        return json.dumps({'summary':rez})
    def get_plot(self, dbName='', acc='',tag='', since='1', fileType='png', png='',test=None):
        self.check_dbName_acc(dbName, acc, since);
        if fileType != "png" :
            cherrypy.HTTPError(405, "Bad file type !!!!!")
        '''Returns plot image (changes response header content-type)
        All arguments in get_plot method have default value equal to '' just
        for avoiding exception if some parameter is missing.

        For testing:
        http://HOSTNAME:PORT/get_plot?dbName=oracle://cms_orcoff_prod/CMS_COND_31X_ECAL&tag=EcalIntercalibConstants_EBg50_EEnoB&since=1&fileType=root
        '''
        #try:
        #ArgumentValidator.validateArgs(dbName = dbName, tag = tag, since = since, onesince = True)
	#c = readXML()
	#db	=	str(c.dbMap_reverse[dbName]+"/CMS_COND_"+acc)
        connectionString = getFrontierConnectionString(acc, dbName)
        shortConnectionString = getFrontierConnectionString(acc, dbName, short = True)
	vtag	=	str(tag)
        vsince = av.get_validated_since(value = since.strip(), db = connectionString, tag = vtag, onlyone = True)
        plot = SubdetectorFactory.getPlotInstance(dbName = connectionString, tag = vtag, since = vsince, 
                                                fileType = fileType, directory = self.__plotsdir, image = png,
                                                shortName = shortConnectionString)
        plotData = plot.get()
            #return plotData
        '''except ValueError, e:
            return 'Wrong parameter value. ERROR returned: %s' % str(e)
        except TypeError, e:
            return 'Wrong parameter type. ERROR returned: %s' % str(e)       
        except IOError, e:
            return 'Could not access file %s. ERROR returned: %s' % (self.__plotsdir, e)
        except AttributeError, e:
            return 'Couldn\t generate plot instance. ERROR returned: %s' % str(e)
        except RuntimeError,e:
            return 'Error connecting to DB. ERROR returned: %s' % str(e)   
        except Exception, e:
            return 'Plot is not implemented for this tag. ERROR returned: %s ' % str(e)
        else:
            if (fileType == 'root'):
                cherrypy.response.headers['Content-Disposition'] = \
                'attachment;filename=' + plot.get_name()
                cherrypy.response.headers['Content-Type'] = 'text/plain'
            else:'''
        cherrypy.response.headers['Content-Type'] = 'image/' + fileType
        return plotData
    def get_xml(self, dbName='', acc='',tag='', since=''):
        self.check_dbName_acc(dbName, acc, since);
        '''Returns gzipped XML payload. 
        All arguments in get_xml method have default value equal to '' just
        for avoiding exception if some parameter is missing.

        For testing:
	http://webcondvm2:8083/get_xml?dbName=oracle://cms_orcoff_prod/CMS_COND_31X_ECAL&tag=EcalIntercalibConstants_EBg50_EEnoB&since=1;
        '''
        #try:
	#c = readXML()
	#db	=	str(c.dbMap_reverse[dbName]+"/CMS_COND_"+acc)
        connectionString = getFrontierConnectionString(acc, dbName)
        shortConnectionString = getFrontierConnectionString(acc, dbName, short = True)
	vtag	=	str(tag)
        vsince = av.get_validated_since(value = since, db = connectionString, tag = vtag, onlyone = False)
        
        if len(vsince.split(';')) == 1:
            xml = SubdetectorFactory.getXMLInstance(dbName = connectionString, tag = vtag, 
                                    since = vsince, fileType = 'tar.gz', directory = self.__xmldir, shortName = shortConnectionString)
            data = xml.get()
        else:
            temp = tempfile.TemporaryFile(dir = self.__tmpdir)
            tar = tarfile.open(mode = "w|gz", fileobj = temp)
            for i in vsince.split(';'):
                xml = SubdetectorFactory.getXMLInstance(dbName = connectionString, tag = vtag, 
                                        since = i, fileType = 'xml', directory = self.__xmldir, shortName = shortConnectionString)
                name = xml.dump()
                tar.add(name, arcname = os.path.basename(name), recursive = False)

            tar.close()
            temp.seek(0)
            data = temp.read()
        
        cherrypy.response.headers['Content-Disposition'] = \
                'attachment;filename=' + '_'.join([vtag, vsince.replace(';', '_'), '.tar.gz'])
        #cherrypy.response.headers['Content-Type'] = 'application/x-gzip'
        cherrypy.response.headers['Content-Encoding'] = 'gzip'
        return data
    def get_histo(self, dbName='', acc='',tag='', since=''):
        self.check_dbName_acc(dbName, acc, since);
        '''Returns histo. 
        All arguments in get_histo method have default value equal to '' just
        for avoiding exception if some parameter is missing.

        For testing:
        http://HOSTNAME:PORT/get_histo?dbName=oracle://cms_orcoff_prod/CMS_COND_31X_ECAL&tag=EcalIntercalibConstants_EBg50_EEnoB&since=1
        '''
        
        try:
            tmpdb = self.masker.unmask_dbname(dbName)
            db = av.get_validated_dbname(value = tmpdb, acc = self.masker.unmask_schema(tmpdb, acc))
            vtag = av.get_validated_tag(dbName = db, value = tag)
            vsince = av.get_validated_since(value = since.strip(), db = db, tag = vtag, onlyone = True)
            directory = self.__histodir
            histo = SubdetectorFactory.getHistoInstance(dbName = db, tag = vtag, 
                                                    since = vsince, fileType = 'png', directory = directory)
            histoData = histo.get()
        except:
            return 'Tag doesn\'t exist'
        else:
            cherrypy.response.headers['Content-Type'] = 'image/png'
            return histoData
 def get_plot_cmp(self,
                  dbName1='',
                  acc1='',
                  tag1='',
                  since1='1',
                  fileType1='png',
                  png1='',
                  dbName2='',
                  acc2='',
                  tag2='',
                  since2='1',
                  fileType2='png',
                  png2='',
                  type='3',
                  istkmap='1'):
     self.check_dbName_acc(dbName1, acc1, since1)
     self.check_dbName_acc(dbName2, acc2, since2)
     if fileType1 != "png" and fileType2 != "png":
         cherrypy.HTTPError(405, "Bad file type !!!!!")
     tmpdb = self.masker.unmask_dbname(dbName1)
     db = av.get_validated_dbname(value=tmpdb,
                                  acc=self.masker.unmask_schema(
                                      tmpdb, acc1))
     vtag = av.get_validated_tag(dbName=db, value=tag1)
     vsince = av.get_validated_since(value=since1.strip(),
                                     db=db,
                                     tag=vtag,
                                     onlyone=True)
     plot = SubdetectorFactory.getPlotInstance(dbName=db,
                                               tag=vtag,
                                               since=vsince,
                                               fileType=fileType1,
                                               directory=self.__plotsdir,
                                               image=png1)
     img1 = plot.get(get_fname=True)
     tmpdb = self.masker.unmask_dbname(dbName2)
     db = av.get_validated_dbname(value=tmpdb,
                                  acc=self.masker.unmask_schema(
                                      tmpdb, acc2))
     vtag = av.get_validated_tag(dbName=db, value=tag2)
     vsince = av.get_validated_since(value=since2.strip(),
                                     db=db,
                                     tag=vtag,
                                     onlyone=True)
     plot = SubdetectorFactory.getPlotInstance(dbName=db,
                                               tag=vtag,
                                               since=vsince,
                                               fileType=fileType2,
                                               directory=self.__plotsdir,
                                               image=png2)
     img2 = plot.get(get_fname=True)
     #raise Exception('asdasd'+img2)
     '''if type == '1':
         img3 = ImageChops.subtract(img1, img2, scale=1, offset=128)
     elif type == '2':
         img3 = ImageChops.subtract(img2, img1, scale=1, offset=128)
     elif type == '3':
         img3 =  ImageChops.difference(img1, img2)
     elif type == '4':
         img3 = ImageChops.subtract(img1, img2, scale=1, offset=0)
     else:
         img3 = ImageChops.subtract(img2, img1, scale=1, offset=0)
     '''
     if not os.path.isdir(self.__tmpdir):
         os.makedirs(self.__tmpdir)
     temp = tempfile.TemporaryFile(dir=self.__tmpdir)
     plotTxt = ""
     if re.search('strip', vtag.lower()):
         plotTxt = 'ABSOLUTE DIFFERENCE  (The more lighter colors, the higher the difference.)'
     cmpPNG.CmpTrackerDiff(fileName1=img1,
                           fileName2=img2,
                           result=temp,
                           txt=plotTxt,
                           debug=False)
     #img3.save(temp, 'png')
     temp.seek(0)
     cherrypy.response.headers['Content-Type'] = 'image/' + fileType1
     data = temp.read()
     temp.close()
     return data
    def get_plot(self,
                 dbName='',
                 acc='',
                 tag='',
                 since='1',
                 fileType='png',
                 png='',
                 test=None):
        self.check_dbName_acc(dbName, acc, since)
        if fileType != "png":
            cherrypy.HTTPError(405, "Bad file type !!!!!")
        '''Returns plot image (changes response header content-type)
        All arguments in get_plot method have default value equal to '' just
        for avoiding exception if some parameter is missing.

        For testing:
        http://HOSTNAME:PORT/get_plot?dbName=oracle://cms_orcoff_prod/CMS_COND_31X_ECAL&tag=EcalIntercalibConstants_EBg50_EEnoB&since=1&fileType=root
        '''
        #try:
        #ArgumentValidator.validateArgs(dbName = dbName, tag = tag, since = since, onesince = True)
        #c = readXML()
        #db	=	str(c.dbMap_reverse[dbName]+"/CMS_COND_"+acc)
        connectionString = getFrontierConnectionString(acc, dbName)
        shortConnectionString = getFrontierConnectionString(acc,
                                                            dbName,
                                                            short=True)
        vtag = str(tag)
        vsince = av.get_validated_since(value=since.strip(),
                                        db=connectionString,
                                        tag=vtag,
                                        onlyone=True)
        plot = SubdetectorFactory.getPlotInstance(
            dbName=connectionString,
            tag=vtag,
            since=vsince,
            fileType=fileType,
            directory=self.__plotsdir,
            image=png,
            shortName=shortConnectionString)
        plotData = plot.get()
        #return plotData
        '''except ValueError, e:
            return 'Wrong parameter value. ERROR returned: %s' % str(e)
        except TypeError, e:
            return 'Wrong parameter type. ERROR returned: %s' % str(e)       
        except IOError, e:
            return 'Could not access file %s. ERROR returned: %s' % (self.__plotsdir, e)
        except AttributeError, e:
            return 'Couldn\t generate plot instance. ERROR returned: %s' % str(e)
        except RuntimeError,e:
            return 'Error connecting to DB. ERROR returned: %s' % str(e)   
        except Exception, e:
            return 'Plot is not implemented for this tag. ERROR returned: %s ' % str(e)
        else:
            if (fileType == 'root'):
                cherrypy.response.headers['Content-Disposition'] = \
                'attachment;filename=' + plot.get_name()
                cherrypy.response.headers['Content-Type'] = 'text/plain'
            else:'''
        cherrypy.response.headers['Content-Type'] = 'image/' + fileType
        return plotData