I create an empty app test2 and moved your models in there. I commented the 
Ajax plugin lines since I do not have it. Than I tried:


$ python web2py.py -S test2 -M -N

>>> db.import_from_csv_file(open('test_fixture.csv','rb'))


The first time it failed because there are records which violate your 
unique constraints. So I replace unique=True with unique=False everywhere 
in models/paideia.py and the import worked. I suggest you try the same and 
one by one you remove only those unique=True that cause problems.

I did not try run the testrunner.py but I do not see anything  wrong with 
it.

Make sure your are using the latest trunk as yesterday code had some issue 
that may be the cause of your problem.

Hope this help.




On Thursday, 4 October 2012 09:12:58 UTC-5, monotasker wrote:
>
> Thanks very much. I just sent the files to you by email.
>
> Ian
>
> On Thursday, October 4, 2012 8:11:23 AM UTC-4, Massimo Di Pierro wrote:
>>
>> If you send me the file and the models I will try it.
>>
>> On Thursday, 4 October 2012 01:16:17 UTC-5, monotasker wrote:
>>>
>>> I'm trying to set up unit tests and run into this error during the 
>>> creation of the test db (using testrunner.py). I've looked at the code of 
>>> this method in gluon.dal, but I really don't know enough about csv 
>>> importing to know how to debug the error. So any help would be much 
>>> appreciated.
>>>
>>> Here is the traceback:
>>>
>>> Traceback (most recent call last):
>>>   File "/home/ian/web/web2py/gluon/shell.py", line 206, in run
>>>     execfile(startfile, _env)
>>>   File "/home/ian/web/web2py/bin/test_runner.py", line 146, in <module>
>>>     test_db.import_from_csv_file(open(csv_file, 'r'))
>>>   File "/home/ian/web/web2py/gluon/dal.py", line 5226, 
>>> inimport_from_csv_file
>>>     unique, *args, **kwargs)
>>>   File "/home/ian/web/web2py/gluon/dal.py", line 5719, 
>>> inimport_from_csv_file
>>>     for i in cols if colnames[i] in self.fields]
>>>   File "/home/ian/web/web2py/gluon/dal.py", line 5688, in fix
>>>     for v in bar_decode_string(value)]
>>> KeyError: 'plugin_slider_decks'
>>>
>>>
>>> Here is the section of the csv file that seems to be the problem:
>>>
>>> TABLE plugin_slider_decks
>>> plugin_slider_decks.id,plugin_slider_decks.deck_name,plugin_slider_decks
>>> .deck_slides,plugin_slider_decks.theme,plugin_slider_decks.position
>>> 1,Introduction,|1|2|59|60|61|58|,|1|,1
>>> 2,The Alphabet,|3|4|5|6|7|8|9|10|11|12|13|14|15|27|62|31|63|,|1|,2
>>> 3,The Alphabet II,|16|17|18|19|20|21|22|23|24|25|26|,|1|,5
>>> 4,The Alphabet III,|55|,|1|,8
>>> 5,The Alphabet IV,|49|72|73|,|1|,12
>>> 6,Noun Basics,|28|29|30|64|,|1|,3
>>> 7,Greek Words I,|32|35|34|,|1|,4
>>> 8,Greek Words II,|26|36|,|1|,7
>>> 9,Case Basics,|37|38|39|40|41|42|43|,|1|,9
>>> 10,The Definite Article,|50|,|1|,10
>>> 11,Noun Gender,|44|45|47|48|,|1|,6
>>> 12,Greek Words III,|51|65|66|67|68|70|71|,|1|,11
>>> 13,Personal Pronouns,|52|74|75|76|,|1|,13
>>> 14,Clause Basics,|53|77|78|79|,|1|,14
>>> 15,Greek Words IV,|54|,|1|,15
>>> 16,Greetings and Learning Names,|56|80|81|,|1|,15
>>> 17,Possessive Pronouns,|57|,|1|,20
>>>
>>> This is the last table in the csv file. The only thing after this is two 
>>> blank lines and END.
>>>
>>

-- 



Reply via email to