On Tuesday, January 3, 2017 at 5:01:31 PM UTC-8, Alex Glaros wrote:
>
> is this correct way to make a set object from a list object?
>
> all_roles = db(db.Role.id.belongs(aggregateRoleData)).select(db.Role.ALL)
>
> here is the list aggregateRoleData: [22L, 23L, 24L, 25L, 26L, 320L, 321L, 
> 230L, 138L, 139L, 140L, 141L, 213L, 143L, 144L, 145L, 147L, 148L, 12L, 13L, 
> 14L, 15L, 11L]
>
> If put in brackets, recieve "<type 'exceptions.TypeError'> int() argument 
> must be a string or a number, not 'NoneType'"  all_roles = 
> db(db.Role.id.belongs([aggregateRoleData])).select(db.Role.ALL)
>

Try  ....belongs(set(aggregateRoleData))....

<URL:https://docs.python.org/2/tutorial/datastructures.html?highlight=comprehension#sets>

The (curly)bracket version may be being mistaken for a dict.  Just a guess.


/dps
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to