Fixes and cleanups

bzr-revno: 915
This commit is contained in:
Jon Tibble 2010-07-05 13:03:27 +01:00
commit 21a617aedb
5 changed files with 9 additions and 14 deletions

View File

@ -189,7 +189,7 @@ class Manager(object):
Any parameters to order the returned objects by. Defaults to None.
"""
query = self.session.query(object_class)
if order_by_ref:
if order_by_ref is not None:
return query.order_by(order_by_ref).all()
return query.all()
@ -208,7 +208,7 @@ class Manager(object):
Any parameters to order the returned objects by. Defaults to None.
"""
query = self.session.query(object_class).filter(filter_clause)
if order_by_ref:
if order_by_ref is not None:
return query.order_by(order_by_ref).all()
return query.all()

View File

@ -29,6 +29,7 @@ format it for the output display.
import logging
from PyQt4 import QtGui, QtCore
from openlp.core.lib import resize_image
log = logging.getLogger(__name__)

View File

@ -27,8 +27,7 @@ import logging
from PyQt4 import QtCore
from renderer import Renderer
from openlp.core.lib import ThemeLevel
from openlp.core.lib import Renderer, ThemeLevel
log = logging.getLogger(__name__)

View File

@ -358,14 +358,8 @@ class ThemeXML(object):
``xml``
The XML string to parse.
"""
self.base_parse_xml()
self.parse_xml(xml)
def base_parse_xml(self):
"""
Pull in the blank theme XML as a starting point.
"""
self.parse_xml(BLANK_THEME_XML)
self.parse_xml(xml)
def parse_xml(self, xml):
"""

View File

@ -109,8 +109,10 @@ class SongXMLParser(object):
The XML of the song to be parsed.
"""
self.song_xml = None
if xml[:5] == u'<?xml':
xml = xml[38:]
try:
self.song_xml = objectify.fromstring(str(xml))
self.song_xml = objectify.fromstring(xml)
except etree.XMLSyntaxError:
log.exception(u'Invalid xml %s', xml)
@ -125,8 +127,7 @@ class SongXMLParser(object):
if element.tag == u'verse':
if element.text is None:
element.text = u''
verse_list.append([element.attrib,
unicode(element.text).decode('unicode-escape')])
verse_list.append([element.attrib, unicode(element.text)])
return verse_list
def dump_xml(self):