Hi Sorry for posting again ... more findings and more questions on the * and **.

I am getting same results when i use * or don't use it, what function
does the * and ** really do puzzling a bit...

print SELECT([OPTION(s.name, _value=s.id) for s in
db(db.file_subject).select()]) am getting results

<select>
   <option value="1">Information Technology</option>
   <option value="2">Correspondance</option>
</select>

print SELECT(*[OPTION(s.name, _value=s.id) for s in
db(db.file_subject).select()])

<select>
  <option value="1">Information Technology</option>
  <option value="2">Correspondance</option>
</select>

Quiet confusing.

On 12/3/12, Teddy Nyambe <software....@gmail.com> wrote:
> ...Hi Masimo,
>
> Its working when i remove the one asterisk (*)...with two its giving
> an error, my db is fine...look at the results:
>
>
> In [2] : print SELECT(*[OPTION(s.name, _value=s.id) for s in
> db(db.file_subject).select()])
> <select><option value="1">Information Technology</option><option
> value="2">Correspondance</option></select>
>
> In [3] : print SELECT(**[OPTION(s.name, _value=s.id) for s in
> db(db.file_subject).select()])
> Traceback (most recent call last):
>   File "/home/www-data/web2py/gluon/contrib/shell.py", line 235, in run
>     exec compiled in statement_module.__dict__
>   File "<string>", line 1, in <module>
> TypeError: type object argument after ** must be a mapping, not list
>
>
> Thanks for the help...what do the * and ** mean, in the book its not
> very clear I have failed to understand.
>
> Teddy L.
>
> On 12/3/12, Massimo Di Pierro <massimo.dipie...@gmail.com> wrote:
>> You do not need CAT
>>
>> SELECT(**[OPTION(s.name, _value=s.id) for s
>> in db(db.file_subject).select()])
>>
>> yet I do not think this is the problem. Probably you have duplicated
>> options in database.
>>
>>
>>
>> On Monday, 3 December 2012 01:23:06 UTC-6, software.ted wrote:
>>>
>>> Hi, I have this unusual behavior of my code below, the options are
>>> being duplicated what could be the problem:
>>>
>>> #print SELECT(CAT([OPTION(s.name, _value=s.id) for s in
>>> db(db.file_subject).select()]))
>>>
>>> <select>
>>>     <option value="<option value="1">Information
>>> Technology</option><option value="2">Correspondance</option>">
>>>     <option value="1">Information Technology</option>
>>>     <option value="2">Correspondance</option></option>
>>> </select>
>>>
>>> ...Teddy L.
>>>
>>
>> --
>>
>>
>>
>>
>
>
> --
> .......................................................................................
> Teddy Lubasi Nyambe
> Opensource Zambia
> Lusaka, ZAMBIA
>
> Cell: +260 97 7760473
> website: http://www.opensource.org.zm
>
> ~/
> Human Knowledge belongs to the world! - AntiTrust
>
> Man is a tool-using animal. Without tools he is nothing, with tools he
> is all - Thomas Carlyle 1795-1881
>
> /~
>


-- 
.......................................................................................
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he
is all - Thomas Carlyle 1795-1881

/~

-- 



Reply via email to