cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1600
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.