Use table attribute instead of string in database order by (probably fixes #59)

This commit is contained in:
Guillaume Ayoub 2013-09-06 22:09:16 +02:00
parent 7266c8018f
commit 0e5ef007f1

View File

@ -116,7 +116,7 @@ class Collection(ical.Collection):
items = ( items = (
self.session.query(DBItem) self.session.query(DBItem)
.filter_by(collection_path=self.path, tag=item_type.tag) .filter_by(collection_path=self.path, tag=item_type.tag)
.order_by("name").all()) .order_by(DBItem.name).all())
for item in items: for item in items:
text = "\n".join( text = "\n".join(
"%s:%s" % (line.key, line.value) for line in item.lines) "%s:%s" % (line.key, line.value) for line in item.lines)
@ -189,7 +189,7 @@ class Collection(ical.Collection):
headers = ( headers = (
self.session.query(DBHeader) self.session.query(DBHeader)
.filter_by(collection_path=self.path) .filter_by(collection_path=self.path)
.order_by("key").all()) .order_by(DBHeader.key).all())
return [ return [
ical.Header("%s:%s" % (header.key, header.value)) ical.Header("%s:%s" % (header.key, header.value))
for header in headers] for header in headers]