cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
701
Views
0
Helpful
1
Replies
Trinh Nguyen
Beginner

Check for tenant name

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
Beginner

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
Beginner

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

Content for Community-Ad

This widget could not be displayed.