Paul McNett wrote:
> Ricardo Aráoz wrote:
>   
>> Paul McNett wrote:
>>     
>>> [email protected] wrote:
>>>   
>>>       
>>>> One of the main tasks our applications have is to import testing results 
>>>> from data files in a variety of formats. 
>>>>
>>>>
>>>>
>>>> In VFP, the basic operation is:
>>>>
>>>>
>>>>
>>>> 1. read data file and append or insert data into a VFP cursor.
>>>>
>>>> 2. validate/massage/interpret data contained in cursor.
>>>>
>>>> 3. scan cursor and insert validated data into VFP tables .
>>>>     
>>>>         
>>> If it were me, I'd use basic Python to get the data from the text files 
>>> into a python 
>>> list of dictionaries, and then I'd instantiate a dabo bizobj and iterate 
>>> that list, like:
>>>
>>> {{{
>>> # assume rows is the list of dicts
>>> # assume every key in the row dict matches field names in the bizobj exactly
>>>
>>> for row_num, row_dict in enumerate(rows):
>>>    print "Processing row %s" % row_num
>>>    biz.new()
>>>    biz.setFieldVals(**myRowDict)
>>> print "attempting to save":
>>> biz.saveAll()
>>> if biz.isAnyChanged():
>>>    print "something went wrong in biz.saveAll()"
>>> }}}
>>>   
>>>       
>> Just a silly preference, but shouldn't the saveAll() method return
>> True/False indicating success? The way you do it (through
>> isAnyChanged()) seems to me.... complicated(?). Shouldn't there be a
>> clear and straight indicator that the save was performed ok?
>>     
>
> Actually, what will happen if something goes wrong is that an exception will 
> be 
> raised after the transaction is rolled back. So whether it is a 
> DBQueryException, a 
> BusinessRuleViolation, or any dabo exception, the transaction gets rolled 
> back and 
> your code receives the exception.
>   
Nice.
Where can I get some info about the exceptions these methods may raise?
Particularly save(), saveAll() etc..
Or is it better that I look at the source code?



--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to