# -*- coding: utf-8 -*-
##
##
## This file is part of CDS Indico.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN.
##
## CDS Indico is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## CDS Indico is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDS Indico; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

# python stdlib imports
import datetime
from operator import itemgetter
from pyatom import AtomFeed

# module imports
from indico.util.metadata.serializer import Serializer


class AtomSerializer(Serializer):

    schemaless = False
    _mime = 'application/atom+xml'

    def __call__(self, fossils):
        results = fossils['results']
        if type(results) != list:
            results = [results]

        feed = AtomFeed(
            title='Indico Feed',
            subtitle=results and results[0]['owner'] or '', # ew
            feed_url=fossils['url']
        )

        now = datetime.datetime.utcnow()
        for fossil in results:
            feed.add(
                title=fossil['title'],
                summary=fossil['description'],
                url=fossil['url'],
                updated=fossil['startDate'] # ugh, but that's better than creationDate
            )
        return feed.to_string()

@@ -1296,73 +1296,8 @@
 d',%0A
-            subtitle=results and results%5B0%5D%5B'owner'%5D or '', # ew%0A
     

Remove feed subtitle