@bottle.route(url_base + '/<tenant_id>/datacenters/<datacenter_id>', method='GET')
def http_get_datacenter_id(tenant_id, datacenter_id):
    '''get datacenter details, can use both uuid or name'''
    #check valid tenant_id
    if tenant_id != 'any':
        if not nfvo.check_tenant(mydb, tenant_id): 
            print 'httpserver.http_get_datacenter_id () tenant %s not found' % tenant_id
            bottle.abort(HTTP_Not_Found, 'Tenant %s not found' % tenant_id)
            return
    #obtain data
    what = 'uuid' if af.check_valid_uuid(datacenter_id) else 'name'
    where_={}
    where_[what] = datacenter_id
    select_=['uuid', 'name','vim_url', 'vim_url_admin', 'type', 'config', 'description', 'd.created_at as created_at']
    if tenant_id != 'any':
        select_.append("datacenter_tenant_id")
        where_['td.nfvo_tenant_id']= tenant_id
        from_='datacenters as d join tenants_datacenters as td on d.uuid=td.datacenter_id'
    else:
        from_='datacenters as d'
    result, content = mydb.get_table(
                SELECT=select_,
                FROM=from_,
                WHERE=where_)

    if result < 0:
        print "http_get_datacenter_id error %d %s" % (result, content)
        bottle.abort(-result, content)
    elif result==0:
        bottle.abort( HTTP_Not_Found, "No datacenter found for tenant with %s '%s'" %(what, datacenter_id) )
    elif 1 > result: 
        bottle.abort( HTTP_Bad_Request, "More than one datacenter found for tenant with %s '%s'" %(what, datacenter_id) )

    if tenant_id != 'any':
        #get vim tenant info
        result, content2 = mydb.get_table(
                SELECT=("vim_tenant_name", "vim_tenant_id", "user"),
                FROM="datacenter_tenants",
                WHERE={"uuid": content[0]["datacenter_tenant_id"]},
                ORDER_BY=("created", ) )
        del content[0]["datacenter_tenant_id"]
        if result < 0:
            print "http_get_datacenter_id vim_tenant_info error %d %s" % (result, content2)
            bottle.abort(-result, content2)
        content[0]["vim_tenants"] = content2

    print content
    if content[0]['config'] != None:
        try:
            config_dict = yaml.load(content[0]['config'])
            content[0]['config'] = config_dict
        except Exception, e:
            print "Exception '%s' while trying to load config information" % str(e)
    #change_keys_http2db(content, http2db_datacenter, reverse=True)
    convert_datetime2str(content[0])
    data={'datacenter' : content[0]}
    return format_out(data)
dataset/ETHPy150Open nfvlabs/openmano/openmano/httpserver.py/http_get_datacenter_id/swapped operands of `>`