don't get it. you are doing str(request.args(0)) . If request.args(0) is 
None (i.e. there is no request.args[0]), str(None) returns 'None' as a 
string.
'None' as a string is True, so it doesn't get to be "ORed" with 'Both'.

>>> None or 'Both'
'Both'
>>> str(None) or 'Both'
'None'
>>> None and str(None) or 'Both'
'Both'


You need to do somefield == request.args(0) or 'Both' if you want that to 
work.
If you need to turn whatever request.args(0) to a string, then simply
somefield == request.args(0) and str(request.args(0)) or 'Both'

On Tuesday, November 6, 2012 7:46:42 PM UTC+1, Hassan Alnatour wrote:
>
> How Can i do : 
>
>  (query) & (db.table.Field == i or s)  ???
>
> regards
>
>
>
> On Tuesday, November 6, 2012 7:33:09 PM UTC+2, Hassan Alnatour wrote:
>>
>> Dear ALL , 
>>
>> i am trying to do this :
>>
>> sup = db(
>> (db.Supplements.Category == (request.args(1)).replace('_',' ')) & (db.
>> Supplements.Users == str(request.args(0)) or 'Both') 
>> ).select(db.Supplements.ALL)
>>
>> But its not working , any help ???
>>
>> REgards,
>>
>

-- 



Reply via email to