cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1561
Views
1
Helpful
1
Replies

Check for tenant name

Trinh Nguyen
Level 1
Level 1

I have this code that when execute all tenants print out line by line including 'Production' but when check for t == 'Production' it is not true

tenants = Tenant.get(session)

    for t in tenants:

        print t

        if t == 'Production': #why this line is never true?

                print "TRUE"

1 Accepted Solution

Accepted Solutions

guruprassadn
Level 1
Level 1

The instance tenant has an object called name.

So, your code should basically be like this.

tenants = Tenant.get(session)

    for t in tenants:

        print t

        if t.name == 'Production':

                print "TRUE"

I hope this helps.

View solution in original post

1 Reply 1

guruprassadn
Level 1
Level 1

The instance tenant has an object called name.

So, your code should basically be like this.

tenants = Tenant.get(session)

    for t in tenants:

        print t

        if t.name == 'Production':

                print "TRUE"

I hope this helps.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:


This community is intended for developer topics around Data Center technology and products. If you are looking for a non-developer topic about Data Center, you might find additional information in the Data Center and Cloud community