def generate_exportcontent(connection_data, options, staticbase):
    #TODO change this we should be able to add options on the global model
#     print "Generate PDF"
    model = nep_model.nepModel(rawData = connection_data, options=options)
    model.buildTrees()
    model.printLogicalTree()
    model.printGraphicalTree()
    model.buildPrintGrid()
    
    tmpDir = tempfile.mkdtemp()  
    tmpName = str(uuid.uuid1())+'.pdf'
    endPath =  os.path.join(tmpDir, tmpName);

    renderer = nep_renderer_pdf.PDFRenderer(model, options, endPath)
    renderer.render()
    return endPath

#es = elasticsearch.Elasticsearch()    
# #AKIAJ72ERMT77ZQ7F67Q
# #AKIAJ5NJGWEGSXQDCLHA
# candidates = es.search(index="nephorider", body={"query": {"match": {"key":'AKIAJ5NJGWEGSXQDCLHA'}}})
# if 0 != candidates[u'hits'][u'total']:
#     options={u'papersize': u'A4', u'onepagefit': True, u'vpcid': u'VPC1', u'filter': u'Regions'}
#     endPath = generate_exportcontent(candidates[u'hits'][u'hits'][0][u'_source'], options, '/Users/lcerveau/Documents/nepho_platform/webapp/static/imgs')             
# else:
#     print 'not anymore in elastic search'

# mmawsKey = 'AKIAJ5NJGWEGSXQDCLHA'
# mmawsSecret = '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'

# grawsKey = 'AKIAJ72ERMT77ZQ7F67Q'
# grawsSecret = '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'
# 
#gr_dict = fetch_base_data(grawsKey, grawsSecret,'Gromulus')
# print gr_dict