Code review comment for lp:~raoul-snyman/openlp/bug-714510

Revision history for this message
Jonathan Corwin (j-corwin) wrote :

Part way there, I was able to start OpenLP and create a new song.
Then I loaded an existing service file which contained songs that weren't in the database, and I got:

Traceback (most recent call last):
  File "C:\Users\jonathan\Documents\projects\openlp\bug-714510\openlp\plugins\songs\lib\mediaitem.py", line 480, in serviceLoad
    editId = self.openLyrics.xml_to_song(item.xml_version)
  File "C:\Users\jonathan\Documents\projects\openlp\bug-714510\openlp\plugins\songs\lib\xml.py", line 343, in xml_to_song
    self.manager.save_object(song)
  File "C:\Users\jonathan\Documents\projects\openlp\bug-714510\openlp\core\lib\db.py", line 152, in save_object
    self.session.commit()
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\orm\scoping.py", line 139, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\orm\session.py", line 614, in commit
    self.transaction.commit()
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\orm\session.py", line 385, in commit
    self._prepare_impl()
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\orm\session.py", line 369, in _prepare_impl
    self.session.flush()
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\orm\session.py", line 1388, in flush
    self._flush(objects)
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\orm\session.py", line 1469, in _flush
    flush_context.execute()
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\orm\unitofwork.py", line 302, in execute
    rec.execute(self)
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\orm\unitofwork.py", line 446, in execute
    uow
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\orm\mapper.py", line 1878, in _save_obj
    execute(statement, params)
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\engine\base.py", line 1191, in execute
    params)
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\engine\base.py", line 1271, in _execute_clauseelement
    return self.__execute_context(context)
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\engine\base.py", line 1302, in __execute_context
    context.parameters[0], context=context)
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\engine\base.py", line 1401, in _cursor_execute
    context)
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\engine\base.py", line 1394, in _cursor_execute
    context)
  File "C:\Python27\lib\site-packages\sqlalchemy-0.6.6-py2.7.egg\sqlalchemy\engine\default.py", line 299, in do_execute
    cursor.execute(statement, parameters)
  File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
IntegrityError: (IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`openlp`.`songs`, CONSTRAINT `songs_ibfk_1` FOREIGN KEY (`song_book_id`) REFERENCES `song_books` (`id`))') 'INSERT INTO songs (song_book_id, title, alternate_title, lyrics, verse_order, copyright, comments, ccli_number, song_number, theme_name, search_title, search_lyrics) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' (0, 'Catch the fire 684', '', '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<song version="1.0"><lyrics><verse type="v" label="1"><![CDATA[Catch the fire,\nSwim through the waters,\nFly on the wings of the Spirit.\n(Repeat)]]></verse><verse type="v" label="2"><![CDATA[Hear the sound that fills heaven,\nHear the beat of my heart.\n(Repeat)]]></verse><verse type="v" label="3"><![CDATA[As a Lover, gazing on His bride;\nAs a Father looking for His child;\nAs the Shepherd,\nSearching for the one that\'s lost;\nAs the Saviour, weeping for the world.]]></verse></lyrics></song>', 'v1 v2 v1 v3 v1', 'Copyright \xc2\xa9 1996 Sovereign Lifestyle Music. ', None, None, '', None, 'catch the fire 684@', '')

« Back to merge proposal