Indeed. Knew about the & and should have remembered/thought about it...
Apologies for the incongruous assumptions...


On 1/12/13, Anthony <abasta...@gmail.com> wrote:
> This is the wrong syntax for a query:
>
> db(db.user_atom.user == self._user.id and db.user_atom.top_atom == self.
> _top_atom.id)
>
> Instead of using "and", you must use "&" (see this
> section<http://web2py.com/books/default/chapter/29/06#Logical-operators>in
> the book):
>
> db((db.user_atom.user == self._user.id) & (db.user_atom.top_atom == self.
> _top_atom.id))
>
> Your version is equivalent to Query1 and Query2, which in Python simply
> evaluates to Query2. So, your query amounts to:
>
> db(db.user_atom.top_atom == self._top_atom.id)
>
> Assuming more than one user has top_atom equal to self._top_atom.id, your
> query will return multiple records, and res[0] will simply select the first
>
> such record (presumably the record of user 454 in this case).
>
> Anthony
>
> On Saturday, January 12, 2013 10:26:45 AM UTC-5, molhokwai wrote:
>>
>> Hi,
>>
>> The title is my best guess for what the issue is most likely linked to...
>>
>> although in this case, it's... *weirder*...
>> The code:
>>
>>         logging.info('-------------------------------------------| %i ' %
>>
>> self._user.id)
>>         logging.info('-------------------------------------------| %s ' %
>>
>> self._user.email)
>>         res = db(db.user_atom.user == self._user.id
>>                 and db.user_atom.top_atom == self._top_atom.id).select()
>>         logging.info('-------------------------------------------| %i '
>> %res
>> [0].user.id)
>>         logging.info('-------------------------------------------| %s '
>> %res
>> [0].user.email)
>>
>>
>> ...puts out:
>>
>> INFO     2013-01-12 11:06:29,201 9_signup_forms.py:131]
>> -------------------------------------------| 505
>> INFO     2013-01-12 11:06:29,202 9_signup_forms.py:132]
>> -------------------------------------------| herve.may...@ymail.com
>> INFO     2013-01-12 11:06:29,225 9_signup_forms.py:135]
>> -------------------------------------------| 454
>> INFO     2013-01-12 11:06:29,271 9_signup_forms.py:136]
>> -------------------------------------------| molhok...@gmail.com
>>
>> That is, selecting with the user with id 505 returns the record value for
>>
>> user with id 454... knowing that user with id 454 is the previously
>> created
>> user in the same process...
>> Saying this is a class reference issue is a wild guess, since this is a
>> variable assignment call within a method of a class instance, and not the
>>
>> return of a class property for example...
>>
>> I would be grateful for a logical explanation of what is happening, and
>> can provide more context/code, if ncessary...
>>
>> In any case, thanks for the great framework...
>>
>> ---------------
>> molhokwai
>>
>>
>
> --
>
>
>
>


-- 
-------------------------------------------------------------------------------------------------------------
*M*T, *M*olhokwai
*+32 489 33 71 51, molhok...@gmail.com, chat/voip(gtalk):molhokwai*
*
*
Don DeLillo: Underworld |  Don DeLillo: Cosmopolis | The Matrix: The
Architect | Brandford Marsalis: Mr J.C.
(Live) | Ursula K. LeGuin: The Dispossessed | Annares | Robert Zemeckis:
Contact |  What the *bleep* do we
know... | E.J. Strickland: In this Day | Jeff Buckley: Grace | Qawalis
| Genesis: FoxTrot | XXX | Artémise &
Mausole | XXX | Le Taj Mahal | Slow | Infinity | Khalasa | Google
| Coltrane | X-Men III: The Phoenix | RATM |
Jean D'ormesson: Le Juif Errant | Les Quatre Incommensurables | Edgar Allan
Poe: Ms found in a bottle | 7 |
Georges Clooney: Confession of a dangerous Mind | The hand of God |
Dreaming Bear Kanaan |
Implementing change | Amin Maalouf: Le Rocher de Tanios | 9 | The Grand
Cycle | The Beyonder | The
Venus Project | Patrick Suskind: Le Parfum | Ethan & Lucas Vorly | Khaili
Gibran: On Love |
Urbanfarming.org | Planck's Constant | Gemineye: Poetic bloodline |
Moving-planet.org | 350.org | Bree
Olson | Jacques Audiard: Sur mes lèvres | Raymond Devos | Terrence Mc Kenna
| Alan Watts | Mindwalk:
 Liv Ullman's Sophia Hoffman | ...

*Let's talk*

-- 



Reply via email to