Jai:
Sorry, the Python/DB interface wasn't intended for general use
and we don't support it.
If you can figure out the problem, please send the patch.
We do support the PHP DB interface (html/inc/boinc_db.inc).
-- David
On 06-Aug-2012 8:53 AM, Jai wrote:
>
> I changed ID to 1, but still got the same exception. I think the exception
> is raised because of the spcecial key ( not value)"workunitid". Please read
> the following code in file py/Boinc/db_base, and we can see that the
> exception is caused by the non-zero length of 'indict' after some 'del'
> operations on the dictionary.
>
> 376 def dict2database_fields(self, indict):
> 377 indict = indict.copy()
> 378 dict = {}
> 379 if 'id' in indict:
> 380 dict['id'] = indict['id']
> 381 del indict['id']
> 382 for key in self._valid_query_keys():
> 383 if key.endswith('id'):
> 384 xkey = key[:-2]
> 385 if xkey in indict:
> 386 obj = indict[xkey]
> 387 dict[key] = obj and obj.id
> 388 del indict[xkey]
> 389 else:
> 390 if key in indict:
> 391 dict[key] = indict[key]
> 392 del indict[key]
> 393 if len(indict):
> 394 raise ValueError('Invalid key(s): %s'%indict)
> 395 return dict
>
> Cheers,
> Jie
>
>
> At 2012-08-06 09:14:51,"David Anderson" <[email protected]> wrote:
>> 0 is not a valid database ID.
>> There will never be a workunit with ID=0.
>> -- David
>>
>> On 05-Aug-2012 3:53 PM, Jai wrote:
>>> hi,
>>>
>>> I am using BOINC python API in the server to do some databse operations,
>>> but got an exception. I think it is a bug, I ran python like the following:
>>>
>>> >>> sys.path.insert(0,'/home/boinc/projects/cppmce/py/Boinc')
>>> >>> import database
>>> >>> database.Results.find(workunitid=0)
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> File "/home/boinc/projects/cppmce/py/Boinc/db_base.py", line 294, in
>>> find
>>> kwargs = self.dict2database_fields(kwargs)
>>> File "/home/boinc/projects/cppmce/py/Boinc/db_base.py", line 394, in
>>> dict2database_fields
>>> raise ValueError('Invalid key(s): %s'%indict)
>>> ValueError: Invalid key(s): {'workunitid': 0}
>>>
>>> Cheers,
>>>
>>> Jie
>>>
>>>
>>>
>>> _______________________________________________
>>> boinc_dev mailing list
>>> [email protected]
>>> http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
>>> To unsubscribe, visit the above URL and
>>> (near bottom of page) enter your email address.
>>>
>> _______________________________________________
>> boinc_dev mailing list
>> [email protected]
>> http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
>> To unsubscribe, visit the above URL and
>> (near bottom of page) enter your email address.
>>
>>
>> _______________________________________________
>> boinc_dev mailing list
>> [email protected]
>> http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
>> To unsubscribe, visit the above URL and
>> (near bottom of page) enter your email address.
_______________________________________________
boinc_dev mailing list
[email protected]
http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
To unsubscribe, visit the above URL and
(near bottom of page) enter your email address.