From 0d8825f9a8e786f8ddfe328e33c7fe7b6559b9d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= <fpeters@entrouvert.com>
Date: Tue, 26 Nov 2019 14:04:44 +0100
Subject: [PATCH 4/6] remove support for announces (#37967)

---
 auquotidien/auquotidien.py             |    4 -
 auquotidien/modules/admin.py           |   77 +-
 auquotidien/modules/announces.py       |  182 ---
 auquotidien/modules/announces_ui.py    |  459 -------
 auquotidien/modules/myspace.py         |   53 +-
 auquotidien/modules/pyatom/__init__.py |    0
 auquotidien/modules/pyatom/afl-2.1.txt |   54 -
 auquotidien/modules/pyatom/pyatom.py   | 1734 ------------------------
 auquotidien/modules/pyatom/readme.txt  |   64 -
 auquotidien/modules/root.py            |  554 --------
 auquotidien/modules/template.py        |    5 -
 11 files changed, 5 insertions(+), 3181 deletions(-)
 delete mode 100644 auquotidien/modules/announces.py
 delete mode 100644 auquotidien/modules/announces_ui.py
 delete mode 100644 auquotidien/modules/pyatom/__init__.py
 delete mode 100644 auquotidien/modules/pyatom/afl-2.1.txt
 delete mode 100644 auquotidien/modules/pyatom/pyatom.py
 delete mode 100644 auquotidien/modules/pyatom/readme.txt

diff --git a/auquotidien/auquotidien.py b/auquotidien/auquotidien.py
index 81e6486..11fab03 100644
--- a/auquotidien/auquotidien.py
+++ b/auquotidien/auquotidien.py
@@ -6,7 +6,6 @@ from wcs.qommon.misc import get_cfg
 
 from modules import admin
 from modules import backoffice
-from modules import announces_ui
 from modules import categories_admin
 from modules import payments_ui
 from modules import strongbox_ui
@@ -26,9 +25,6 @@ rdb = get_publisher_class().backoffice_directory_class
 
 rdb.items = []
 
-rdb.register_directory('announces', announces_ui.AnnouncesDirectory())
-rdb.register_menu_item('announces/', _('Announces'))
-
 rdb.register_directory('payments', payments_ui.PaymentsDirectory())
 rdb.register_menu_item('payments/', _('Payments'))
 
diff --git a/auquotidien/modules/admin.py b/auquotidien/modules/admin.py
index 65b8ec8..b7ef237 100644
--- a/auquotidien/modules/admin.py
+++ b/auquotidien/modules/admin.py
@@ -22,8 +22,8 @@ from .abelium_domino_ui import AbeliumDominoDirectory
 
 
 class PanelDirectory(Directory):
-    _q_exports = ['', 'update', 'announces', 'permissions',
-            'announce_themes', 'strongbox', 'domino']
+    _q_exports = ['', 'update', 'permissions',
+            'strongbox', 'domino']
     label = N_('Control Panel')
 
     domino = AbeliumDominoDirectory()
@@ -37,49 +37,12 @@ class PanelDirectory(Directory):
                 if string_value:
                     form.get_widget('mobile_mask').value = string_value.upper()
 
-    def announces(self):
-        announces_cfg = get_cfg('announces', {})
-        sms_cfg = get_cfg('sms', {})
-        form = Form(enctype='multipart/form-data')
-        hint = ""
-        if sms_cfg.get('mode','') in ("none",""):
-            hint = htmltext(_('You must also <a href="%s">configure your SMS provider</a>') % "../settings/sms")
-
-        form.add(CheckboxWidget, 'sms_support', title = _('SMS support'),
-                hint = hint, value = announces_cfg.get('sms_support', 0))
-        form.add(StringWidget, 'mobile_mask', title = _('Mask for mobile numbers'),
-                hint = _('example: 06XXXXXXXX'),
-                value = announces_cfg.get('mobile_mask',''))
-        form.add_submit('submit', _('Submit'))
-        form.add_submit('cancel', _('Cancel'))
-
-        self._verify_mask(form)
-
-        if form.get_widget('cancel').parse():
-            return redirect('..')
-
-        if not form.is_submitted() or form.has_errors():
-            get_response().breadcrumb.append(('aq/announces', _('Announces Options')))
-            html_top('settings', _('Announces Options'))
-            r = TemplateIO(html=True)
-            r += htmltext('<h2>%s</h2>') % _('Announces Options')
-            r += form.render()
-            return r.getvalue()
-        else:
-            from wcs.admin.settings import cfg_submit
-            cfg_submit(form, 'announces', ('sms_support','mobile_mask'))
-            return redirect('..')
-
     def permissions(self):
         permissions_cfg = get_cfg('aq-permissions', {})
         form = Form(enctype='multipart/form-data')
         form.add(SingleSelectWidget, 'forms', title = _('Admin role for forms'),
                 value = permissions_cfg.get('forms', None),
                 options = [(None, _('Nobody'), None)] + get_user_roles())
-        if get_publisher().has_site_option('auquotidien-announces'):
-            form.add(SingleSelectWidget, 'announces', title = _('Admin role for announces'),
-                    value = permissions_cfg.get('announces', None),
-                    options = [(None, _('Nobody'), None)] + get_user_roles())
         if get_publisher().has_site_option('auquotidien-payments'):
             form.add(SingleSelectWidget, 'payments', title = _('Admin role for payments'),
                     value = permissions_cfg.get('payments', None),
@@ -104,34 +67,7 @@ class PanelDirectory(Directory):
         else:
             from wcs.admin.settings import cfg_submit
             cfg_submit(form, 'aq-permissions',
-                        ('forms', 'announces', 'payments', 'strongbox'))
-            return redirect('..')
-
-    def announce_themes(self):
-        misc_cfg = get_cfg('misc', {})
-        form = Form(enctype='multipart/form-data')
-        form.add(WidgetList, 'announce_themes', title = _('Announce Themes'),
-                value = misc_cfg.get('announce_themes', []),
-                elemnt_type = StringWidget,
-                add_element_label = _('Add Theme'),
-                element_kwargs = {str('render_br'): False, str('size'): 30})
-
-        form.add_submit('submit', _('Submit'))
-        form.add_submit('cancel', _('Cancel'))
-
-        if form.get_widget('cancel').parse():
-            return redirect('..')
-
-        if not form.is_submitted() or form.has_errors():
-            get_response().breadcrumb.append(('aq/announce_themes', _('Announce Themes')))
-            html_top('settings', _('Announce Themes'))
-            r = TemplateIO(html=True)
-            r += htmltext('<h2>%s</h2>') % _('Announce Themes')
-            r += form.render()
-            return r.getvalue()
-        else:
-            from wcs.admin.settings import cfg_submit
-            cfg_submit(form, 'misc', ('announce_themes',))
+                        ('forms', 'payments', 'strongbox'))
             return redirect('..')
 
     def strongbox(self):
@@ -163,8 +99,7 @@ class PanelDirectory(Directory):
 
 class SettingsDirectory(wcs.admin.settings.SettingsDirectory):
     def _q_index(self):
-        if not (get_publisher().has_site_option('auquotidien-announces') or
-                get_publisher().has_site_option('auquotidien-payments') or
+        if not (get_publisher().has_site_option('auquotidien-payments') or
                 get_publisher().has_site_option('auquotidien-strongvox')):
             return super(SettingsDirectory, self)._q_index()
         r = TemplateIO(html=True)
@@ -173,11 +108,7 @@ class SettingsDirectory(wcs.admin.settings.SettingsDirectory):
         r += htmltext('<div class="bo-block">')
         r += htmltext('<h2>%s</h2>') % _('Extra Options')
         r += htmltext('<ul>')
-        if get_publisher().has_site_option('auquotidien-announces'):
-            r += htmltext('<li><a href="aq/announces">%s</a></li>') % _('Announces Options')
         r += htmltext('<li><a href="aq/permissions">%s</a></li>') % _('Permissions')
-        if get_publisher().has_site_option('auquotidien-announces'):
-            r += htmltext('<li><a href="aq/announce_themes">%s</a></li>') % _('Announce Themes')
         if get_publisher().has_site_option('strongbox'):
             r += htmltext('<li><a href="aq/strongbox">%s</a></li>') % _('Strongbox Support')
         if get_publisher().has_site_option('domino'):
diff --git a/auquotidien/modules/announces.py b/auquotidien/modules/announces.py
deleted file mode 100644
index a849db4..0000000
--- a/auquotidien/modules/announces.py
+++ /dev/null
@@ -1,182 +0,0 @@
-import time
-
-from quixote import get_publisher
-
-from quixote.html import htmlescape
-
-from wcs.qommon import _
-from wcs.qommon.storage import StorableObject
-from wcs.qommon import get_cfg, get_logger
-from wcs.qommon import errors
-from wcs.qommon import misc
-
-from wcs.qommon import emails
-from wcs.qommon.sms import SMS
-from wcs.qommon.admin.emails import EmailsDirectory
-
-class AnnounceSubscription(StorableObject):
-    _names = 'announce-subscriptions'
-    _indexes = ['user_id']
-
-    user_id = None
-    email = None
-    sms = None
-    enabled = True
-    enabled_sms = False
-    enabled_themes = None
-
-    def remove(self, type=None):
-        """ type (string) : email or sms """
-        if type == "email":
-            self.email = None
-        elif type == "sms":
-            self.sms = None
-            self.enabled_sms = False
-        if not type or (not self.sms and not self.email):
-            self.remove_self()
-        else:
-            self.store()
-        
-    def get_user(self):
-        if self.user_id:
-            try:
-                return get_publisher().user_class.get(self.user_id)
-            except KeyError:
-                return None
-        return None
-    user = property(get_user)
-
-
-class Announce(StorableObject):
-    _names = 'announces'
-
-    title = None
-    text = None
-
-    hidden = False
-
-    publication_time = None
-    modification_time = None
-    expiration_time = None
-    sent_by_email_time = None
-    sent_by_sms_time = None
-    theme = None
-
-    position = None
-
-    def sort_by_position(cls, links):
-        def cmp_position(x, y):
-            if x.position == y.position:
-                return 0
-            if x.position is None:
-                return 1
-            if y.position is None:
-                return -1
-            return cmp(x.position, y.position)
-        links.sort(cmp_position)
-    sort_by_position = classmethod(sort_by_position)
-
-    def get_atom_entry(self):
-        from pyatom import pyatom
-        entry = pyatom.Entry()
-        entry.id = self.get_url()
-        entry.title = self.title
-
-        entry.content.attrs['type'] = 'html'
-        entry.content.text = str('<p>' + htmlescape(
-                    unicode(self.text, get_publisher().site_charset).encode('utf-8')) + '</p>')
-
-        link = pyatom.Link(self.get_url())
-        entry.links.append(link)
-
-        if self.publication_time:
-            entry.published = misc.format_time(self.publication_time,
-                    '%(year)s-%(month)02d-%(day)02dT%(hour)02d:%(minute)02d:%(second)02dZ',
-                    gmtime = True)
-
-        if self.modification_time:
-            entry.updated = misc.format_time(self.modification_time,
-                    '%(year)s-%(month)02d-%(day)02dT%(hour)02d:%(minute)02d:%(second)02dZ',
-                    gmtime = True)
-
-        return entry
-
-    def get_url(self):
-        return '%s/announces/%s/' % (get_publisher().get_frontoffice_url(), self.id)
-
-    def store(self):
-        self.modification_time = time.gmtime()
-        StorableObject.store(self)
-
-    def email(self, job=None):
-        self.sent_by_email_time = time.gmtime()
-        StorableObject.store(self)
-
-        data = {
-            'title': self.title,
-            'text': self.text
-        }
-
-        subscribers = AnnounceSubscription.select(lambda x: x.enabled)
-
-        rcpts = []
-        for l in subscribers:
-            if self.theme:
-                if l.enabled_themes is not None:
-                    if self.theme not in l.enabled_themes:
-                        continue
-            if l.user and l.user.email:
-                rcpts.append(l.user.email)
-            elif l.email:
-                rcpts.append(l.email)
-
-        emails.custom_template_email('aq-announce', data, email_rcpt=rcpts, hide_recipients=True)
-
-    def sms(self, job=None):
-        self.sent_by_sms_time = time.gmtime()
-        StorableObject.store(self)
-
-        subscribers = AnnounceSubscription.select(lambda x: x.enabled_sms)
-
-        rcpts = []
-        for sub in subscribers:
-            if self.theme:
-                if sub.enabled_themes is not None:
-                    if self.theme not in sub.enabled_themes:
-                        continue
-            if sub.sms:
-                rcpts.append(sub.sms)
-
-        sms_cfg = get_cfg('sms', {})
-        sender = sms_cfg.get('sender', 'AuQuotidien')[:11]
-        message = "%s: %s" % (self.title, self.text)
-        mode = sms_cfg.get('mode', 'none')
-        sms = SMS.get_sms_class(mode)
-        try:
-            sms.send(sender, rcpts, message[:160])
-        except errors.SMSError, e:
-            get_logger().error(e)
-
-    def get_published_announces(cls):
-        announces = cls.select(lambda x: not x.hidden)
-        announces.sort(lambda x,y: cmp(x.publication_time or x.modification_time,
-                    y.publication_time or y.modification_time))
-        announces = [x for x in announces if x.publication_time < time.gmtime()
-                     and (x.expiration_time is None or x.expiration_time > time.gmtime())]
-        announces.reverse()
-        return announces
-    get_published_announces = classmethod(get_published_announces)
-
-
-EmailsDirectory.register('aq-announce',
-        N_('Publication of announce to subscriber'),
-        N_('Available variables: title, text'),
-        default_subject = N_('Announce: [title]'),
-        default_body = N_("""\
-[text]
-
--- 
-This is an announce sent to you by your city, you can opt to not receive
-those messages anymore on the city website.
-"""))
-
diff --git a/auquotidien/modules/announces_ui.py b/auquotidien/modules/announces_ui.py
deleted file mode 100644
index 38c18ad..0000000
--- a/auquotidien/modules/announces_ui.py
+++ /dev/null
@@ -1,459 +0,0 @@
-from quixote import get_request, get_response, get_session, redirect
-from quixote.directory import Directory, AccessControlled
-from quixote.html import htmltext, TemplateIO
-
-import wcs
-
-from wcs.qommon import _
-from wcs.qommon.backoffice.menu import html_top
-from wcs.qommon.admin.menu import command_icon
-from wcs.qommon import get_cfg
-from wcs.qommon import errors
-from wcs.qommon.form import *
-from wcs.qommon.afterjobs import AfterJob
-
-from .announces import Announce, AnnounceSubscription
-
-
-class SubscriptionDirectory(Directory):
-    _q_exports = ['delete_email', "delete_sms"]
-
-    def __init__(self, subscription):
-        self.subscription = subscription
-
-    def delete_email(self):
-        form = Form(enctype='multipart/form-data')
-        form.widgets.append(HtmlWidget('<p>%s</p>' % _(
-                        'You are about to delete this subscription.')))
-        form.add_submit('submit', _('Submit'))
-        form.add_submit('cancel', _('Cancel'))
-        if form.get_submit() == 'cancel':
-            return redirect('..')
-        if not form.is_submitted() or form.has_errors():
-            get_response().breadcrumb.append(('delete', _('Delete')))
-            html_top('announces', title = _('Delete Subscription'))
-            r = TemplateIO(html=True)
-            r += htmltext('<h2>%s</h2>') % _('Deleting Subscription')
-            r += form.render()
-            return r.getvalue()
-        else:
-            self.subscription.remove("email")
-            return redirect('..')
-
-    def delete_sms(self):
-        form = Form(enctype='multipart/form-data')
-        form.widgets.append(HtmlWidget('<p>%s</p>' % _(
-                        'You are about to delete this subscription.')))
-        form.add_submit('submit', _('Submit'))
-        form.add_submit('cancel', _('Cancel'))
-        if form.get_submit() == 'cancel':
-            return redirect('..')
-        if not form.is_submitted() or form.has_errors():
-            get_response().breadcrumb.append(('delete', _('Delete')))
-            html_top('announces', title = _('Delete Subscription'))
-            r = TemplateIO(html=True)
-            r += htmltext('<h2>%s</h2>') % _('Deleting Subscription')
-            r += form.render()
-            return r.getvalue()
-        else:
-            self.subscription.remove("sms")
-            return redirect('..')
-
-
-class SubscriptionsDirectory(Directory):
-    _q_exports = ['']
-
-    def _q_traverse(self, path):
-        get_response().breadcrumb.append(('subscriptions', _('Subscriptions')))
-        return Directory._q_traverse(self, path)
-
-    def _q_index(self):
-        html_top('announces', _('Announces Subscribers'))
-        r = TemplateIO(html=True)
-
-        r += htmltext('<h2>%s</h2>') % _('Announces Subscribers')
-
-        subscribers = AnnounceSubscription.select()
-        r += htmltext('<ul class="biglist" id="subscribers-list">')
-        for l in subscribers:
-            if l.email:
-                if l.enabled is False:
-                    r += htmltext('<li class="disabled">')
-                else:
-                    r += htmltext('<li>')
-                r += htmltext('<strong class="label">')
-                if l.user:
-                    r += l.user.display_name
-                elif l.email:
-                    r += l.email
-                r += htmltext('</strong>')
-                r += htmltext('<p class="details">')
-                if l.user:
-                    r += l.user.email
-                r += htmltext('</p>')
-                r += htmltext('<p class="commands">')
-                r += command_icon('%s/delete_email' % l.id, 'remove', popup = True)
-                r += htmltext('</p></li>')
-                r += htmltext('</li>')
-            if l.sms:
-                if l.enabled_sms is False:
-                    r += htmltext('<li class="disabled">')
-                else:
-                    r += htmltext('<li>')
-                r += htmltext('<strong class="label">')
-                if l.user:
-                    r += l.user.display_name
-                elif l.email:
-                    r += l.email
-                r += htmltext('</strong>')
-                r += htmltext('<p class="details">')
-                r += l.sms
-                r += htmltext('</p>')
-                r += htmltext('<p class="commands">')
-                r += command_icon('%s/delete_sms' % l.id, 'remove', popup = True)
-                r += htmltext('</p></li>')
-                r += htmltext('</li>')
-        r += htmltext('</ul>')
-        return r.getvalue()
-
-    def _q_lookup(self, component):
-        try:
-            sub = AnnounceSubscription.get(component)
-        except KeyError:
-            raise errors.TraversalError()
-        get_response().breadcrumb.append((str(sub.id), str(sub.id)))
-        return SubscriptionDirectory(sub)
-
-    def listing(self):
-        return redirect('.')
-
-class AnnounceDirectory(Directory):
-    _q_exports = ['', 'edit', 'delete', 'email', 'sms']
-
-    def __init__(self, announce):
-        self.announce = announce
-
-    def _q_index(self):
-        form = Form(enctype='multipart/form-data')
-        get_response().filter['sidebar'] = self.get_sidebar()
-
-        if self.announce.sent_by_email_time is None:
-            form.add_submit('email', _('Send email'))
-
-        announces_cfg = get_cfg('announces', {})
-        if announces_cfg.get('sms_support', 0) and self.announce.sent_by_sms_time is None:
-            form.add_submit('sms', _('Send SMS'))
-
-        if form.get_submit() == 'edit':
-            return redirect('edit')
-        if form.get_submit() == 'delete':
-            return redirect('delete')
-        if form.get_submit() == 'email':
-            return redirect('email')
-        if form.get_submit() == 'sms':
-            return redirect('sms')
-
-        html_top('announces', title = _('Announce: %s') % self.announce.title)
-        r = TemplateIO(html=True)
-        r += htmltext('<h2>%s</h2>') % _('Announce: %s') % self.announce.title
-        r += htmltext('<div class="bo-block">')
-        r += htmltext('<p>')
-        r += self.announce.text
-        r += htmltext('</p>')
-        r += htmltext('</div>')
-
-        if form.get_submit_widgets():
-            r += form.render()
-
-        return r.getvalue()
-
-    def get_sidebar(self):
-        r = TemplateIO(html=True)
-        r += htmltext('<ul>')
-        r += htmltext('<li><a href="edit">%s</a></li>') % _('Edit')
-        r += htmltext('<li><a href="delete">%s</a></li>') % _('Delete')
-        r += htmltext('</ul>')
-        return r.getvalue()
-
-    def email(self):
-        if get_request().form.get('job'):
-            try:
-                job = AfterJob.get(get_request().form.get('job'))
-            except KeyError:
-                return redirect('..')
-            html_top('announces', title = _('Announce: %s') % self.announce.title)
-            r = TemplateIO(html=True)
-            get_response().add_javascript(['jquery.js', 'afterjob.js'])
-            r += htmltext('<dl class="job-status">')
-            r += htmltext('<dt>')
-            r += _(job.label)
-            r += htmltext('</dt>')
-            r += htmltext('<dd>')
-            r += htmltext('<span class="afterjob" id="%s">') % job.id
-            r += _(job.status)
-            r += htmltext('</span>')
-            r += htmltext('</dd>')
-            r += htmltext('</dl>')
-
-            r += htmltext('<div class="done">')
-            r += htmltext('<a href="../">%s</a>') % _('Back')
-            r += htmltext('</div>')
-
-            return r.getvalue()
-        else:
-            job = get_response().add_after_job(
-                    str(N_('Sending emails for announce')),
-                    self.announce.email)
-            return redirect('email?job=%s' % job.id)
-
-    def sms(self):
-        if get_request().form.get('job'):
-            try:
-                job = AfterJob.get(get_request().form.get('job'))
-            except KeyError:
-                return redirect('..')
-            html_top('announces', title = _('Announce: %s') % self.announce.title)
-            get_response().add_javascript(['jquery.js', 'afterjob.js'])
-            r = TemplateIO(html=True)
-            r += htmltext('<dl class="job-status">')
-            r += htmltext('<dt>')
-            r += _(job.label)
-            r += htmltext('</dt>')
-            r += htmltext('<dd>')
-            r += htmltext('<span class="afterjob" id="%s">') % job.id
-            r += _(job.status)
-            r += htmltext('</span>')
-            r += htmltext('</dd>')
-            r += htmltext('</dl>')
-
-            r += htmltext('<div class="done">')
-            r += htmltext('<a href="../">%s</a>') % _('Back')
-            r += htmltext('</div>')
-
-            return r.getvalue()
-        else:
-            job = get_response().add_after_job(
-                    str(N_('Sending sms for announce')),
-                    self.announce.sms)
-            return redirect('sms?job=%s' % job.id)
-
-    def edit(self):
-        form = self.form()
-        if form.get_submit() == 'cancel':
-            return redirect('.')
-
-        if form.is_submitted() and not form.has_errors():
-            self.submit(form)
-            return redirect('..')
-
-        html_top('announces', title = _('Edit Announce: %s') % self.announce.title)
-        r = TemplateIO(html=True)
-        r += htmltext('<h2>%s</h2>') % _('Edit Announce: %s') % self.announce.title
-        r += form.render()
-        return r.getvalue()
-
-    def form(self):
-        form = Form(enctype='multipart/form-data')
-        form.add(StringWidget, 'title', title = _('Title'), required = True,
-                value = self.announce.title)
-        if self.announce.publication_time:
-            pub_time = time.strftime(misc.date_format(), self.announce.publication_time)
-        else:
-            pub_time = None
-        form.add(DateWidget, 'publication_time', title = _('Publication Time'),
-                value = pub_time)
-        if self.announce.expiration_time:
-            exp_time = time.strftime(misc.date_format(), self.announce.expiration_time)
-        else:
-            exp_time = None
-        form.add(DateWidget, 'expiration_time', title = _('Expiration Time'),
-                value = exp_time)
-        form.add(TextWidget, 'text', title = _('Text'), required = True,
-                value = self.announce.text, rows = 10, cols = 70)
-        if get_cfg('misc', {}).get('announce_themes'):
-            form.add(SingleSelectWidget, 'theme', title = _('Announce Theme'),
-                    value = self.announce.theme,
-                    options = get_cfg('misc', {}).get('announce_themes'))
-        form.add(CheckboxWidget, 'hidden', title = _('Hidden'),
-                value = self.announce.hidden)
-        form.add_submit('submit', _('Submit'))
-        form.add_submit('cancel', _('Cancel'))
-        return form
-
-    def submit(self, form):
-        for k in ('title', 'text', 'hidden', 'theme'):
-            widget = form.get_widget(k)
-            if widget:
-                setattr(self.announce, k, widget.parse())
-        for k in ('publication_time', 'expiration_time'):
-            widget = form.get_widget(k)
-            if widget:
-                wid_time = widget.parse()
-                if wid_time:
-                    setattr(self.announce, k, time.strptime(wid_time, misc.date_format()))
-                else:
-                    setattr(self.announce, k, None)
-        self.announce.store()
-
-    def delete(self):
-        form = Form(enctype='multipart/form-data')
-        form.widgets.append(HtmlWidget('<p>%s</p>' % _(
-                        'You are about to irrevocably delete this announce.')))
-        form.add_submit('submit', _('Submit'))
-        form.add_submit('cancel', _('Cancel'))
-        if form.get_submit() == 'cancel':
-            return redirect('..')
-        if not form.is_submitted() or form.has_errors():
-            get_response().breadcrumb.append(('delete', _('Delete')))
-            html_top('announces', title = _('Delete Announce'))
-            r = TemplateIO(html=True)
-            r += htmltext('<h2>%s</h2>') % _('Deleting Announce: %s') % self.announce.title
-            r += form.render()
-            return r.getvalue()
-        else:
-            self.announce.remove_self()
-            return redirect('..')
-
-
-class AnnouncesDirectory(AccessControlled, Directory):
-    _q_exports = ['', 'new', 'listing', 'subscriptions', 'update_order', 'log']
-    label = N_('Announces')
-
-    subscriptions = SubscriptionsDirectory()
-
-    def is_accessible(self, user):
-        from .backoffice import check_visibility
-        return check_visibility('announces', user)
-
-    def _q_access(self):
-        user = get_request().user
-        if not user:
-            raise errors.AccessUnauthorizedError()
-
-        if not self.is_accessible(user):
-            raise errors.AccessForbiddenError(
-                    public_msg = _('You are not allowed to access Announces Management'),
-                    location_hint = 'backoffice')
-
-        get_response().breadcrumb.append(('announces/', _('Announces')))
-
-    def _q_index(self):
-        html_top('announces', _('Announces'))
-        r = TemplateIO(html=True)
-
-        get_response().filter['sidebar'] = self.get_sidebar()
-
-        announces = Announce.select()
-        announces.sort(lambda x,y: cmp(x.publication_time or x.modification_time,
-                    y.publication_time or y.modification_time))
-        announces.reverse()
-
-        r += htmltext('<ul class="biglist" id="announces-list">')
-        for l in announces:
-            announce_id = l.id
-            if l.hidden:
-                r += htmltext('<li class="disabled" class="biglistitem" id="itemId_%s">') % announce_id
-            else:
-                r += htmltext('<li class="biglistitem" id="itemId_%s">') % announce_id
-            r += htmltext('<strong class="label"><a href="%s/">%s</a></strong>') % (l.id, l.title)
-            if l.publication_time:
-                r += htmltext('<p class="details">')
-                r += time.strftime(misc.date_format(), l.publication_time)
-                r += htmltext('</p>')
-            r += htmltext('</li>')
-        r += htmltext('</ul>')
-        return r.getvalue()
-
-    def get_sidebar(self):
-        r = TemplateIO(html=True)
-        r += htmltext('<ul id="sidebar-actions">')
-        r += htmltext(' <li><a class="new-item" href="new">%s</a></li>') % _('New')
-        r += htmltext(' <li><a href="subscriptions/">%s</a></li>') % _('Subscriptions')
-        r += htmltext(' <li><a href="log">%s</a></li>') % _('Log')
-        r += htmltext('</ul>')
-        return r.getvalue()
-
-    def log(self):
-        announces = Announce.select()
-        log = []
-        for l in announces:
-            if l.publication_time:
-                log.append((l.publication_time, _('Publication'), l))
-            if l.sent_by_email_time:
-                log.append((l.sent_by_email_time, _('Email'), l))
-            if l.sent_by_sms_time:
-                log.append((l.sent_by_sms_time, _('SMS'), l))
-        log.sort()
-
-        get_response().breadcrumb.append(('log', _('Log')))
-        html_top('announces', title = _('Log'))
-        r = TemplateIO(html=True)
-
-        r += htmltext('<table>')
-        r += htmltext('<thead>')
-        r += htmltext('<tr>')
-        r += htmltext('<th>%s</th>') % _('Time')
-        r += htmltext('<th>%s</th>') % _('Type')
-        r += htmltext('<td></td>')
-        r += htmltext('</tr>')
-        r += htmltext('</thead>')
-        r += htmltext('<tbody>')
-        for log_time, log_type, log_announce in log:
-            r += htmltext('<tr>')
-            r += htmltext('<td>')
-            r += misc.localstrftime(log_time)
-            r += htmltext('</td>')
-            r += htmltext('<td>')
-            r += log_type
-            r += htmltext('</td>')
-            r += htmltext('<td>')
-            r += htmltext('<a href="%s">%s</a>') % (log_announce.id, log_announce.title)
-            r += htmltext('</td>')
-            r += htmltext('</tr>')
-        r += htmltext('</tbody>')
-        r += htmltext('</table>')
-        return r.getvalue()
-
-    def update_order(self):
-        request = get_request()
-        new_order = request.form['order'].strip(';').split(';')
-        announces = Announce.select()
-        dict = {}
-        for l in announces:
-            dict[str(l.id)] = l
-        for i, o in enumerate(new_order):
-            dict[o].position = i + 1
-            dict[o].store()
-        return 'ok'
-
-    def new(self):
-        announce = Announce()
-        announce.publication_time = time.gmtime()
-        announce_ui = AnnounceDirectory(announce)
-
-        form = announce_ui.form()
-        if form.get_submit() == 'cancel':
-            return redirect('.')
-
-        if form.is_submitted() and not form.has_errors():
-            announce_ui.submit(form)
-            return redirect('%s/' % announce_ui.announce.id)
-
-        get_response().breadcrumb.append(('new', _('New Announce')))
-        html_top('announces', title = _('New Announce'))
-        r = TemplateIO(html=True)
-        r += htmltext('<h2>%s</h2>') % _('New Announce')
-        r += form.render()
-        return r.getvalue()
-
-    def _q_lookup(self, component):
-        try:
-            announce = Announce.get(component)
-        except KeyError:
-            raise errors.TraversalError()
-        get_response().breadcrumb.append((str(announce.id), announce.title))
-        return AnnounceDirectory(announce)
-
-    def listing(self):
-        return redirect('.')
-
diff --git a/auquotidien/modules/myspace.py b/auquotidien/modules/myspace.py
index c0548d3..196c45e 100644
--- a/auquotidien/modules/myspace.py
+++ b/auquotidien/modules/myspace.py
@@ -25,7 +25,6 @@ from wcs.qommon.admin.texts import TextsDirectory
 from wcs.formdef import FormDef
 import wcs.myspace
 
-from .announces import AnnounceSubscription
 from .strongbox import StrongboxItem, StrongboxType
 from .payments import Invoice, Regie, is_payment_supported
 
@@ -411,7 +410,7 @@ class JsonDirectory(Directory):
 
 class MyspaceDirectory(wcs.myspace.MyspaceDirectory):
     _q_exports = ['', 'profile', 'new', 'password', 'remove', 'drafts', 'forms',
-            'announces', 'strongbox', 'invoices', 'json']
+            'strongbox', 'invoices', 'json']
 
     strongbox = StrongboxDirectory()
     invoices = MyInvoicesDirectory()
@@ -492,17 +491,6 @@ class MyspaceDirectory(wcs.myspace.MyspaceDirectory):
                 r += htmltext(' <strong><a href="remove" rel="popup">%s</a></strong>.') % _('Delete My Account')
                 r += htmltext('</p>')
 
-        options = get_cfg('misc', {}).get('announce_themes')
-        if options:
-            try:
-                subscription = AnnounceSubscription.get_on_index(
-                        get_request().user.id, str('user_id'))
-            except KeyError:
-                pass
-            else:
-                r += htmltext('<p class="command"><a href="announces">%s</a></p>') % _(
-                        'Edit my Subscription to Announces')
-
         if user_forms:
             r += htmltext('<h3 id="my-forms">%s</h3>') % _('My Forms')
             from . import root
@@ -675,45 +663,6 @@ class MyspaceDirectory(wcs.myspace.MyspaceDirectory):
         template.html_top(_('Removing Account'))
         return form.render()
 
-    def announces(self):
-        options = get_cfg('misc', {}).get('announce_themes')
-        if not options:
-            raise errors.TraversalError()
-        user = get_request().user
-        if not user or user.anonymous:
-            raise errors.AccessUnauthorizedError()
-        subscription = AnnounceSubscription.get_on_index(get_request().user.id, str('user_id'))
-        if not subscription:
-            raise errors.TraversalError()
-
-        if subscription.enabled_themes is None:
-            enabled_themes = options
-        else:
-            enabled_themes = subscription.enabled_themes
-
-        form = Form(enctype = 'multipart/form-data')
-        form.add(CheckboxesWidget, 'themes', title=_('Announce Themes'),
-                value=enabled_themes, options=[(x, x, x) for x in options],
-                inline=False, required=False)
-
-        form.add_submit('submit', _('Apply Changes'))
-        form.add_submit('cancel', _('Cancel'))
-
-        if form.get_submit() == 'cancel':
-            return redirect('.')
-
-        if form.is_submitted() and not form.has_errors():
-            chosen_themes = form.get_widget('themes').parse()
-            if chosen_themes == options:
-                chosen_themes = None
-            subscription.enabled_themes = chosen_themes
-            subscription.store()
-            return redirect('.')
-
-        template.html_top()
-        get_response().breadcrumb.append(('announces', _('Announce Subscription')))
-        return form.render()
-
 
 TextsDirectory.register('aq-myspace-invoice',
         N_('Message on top of invoices page'),
diff --git a/auquotidien/modules/pyatom/__init__.py b/auquotidien/modules/pyatom/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/auquotidien/modules/pyatom/afl-2.1.txt b/auquotidien/modules/pyatom/afl-2.1.txt
deleted file mode 100644
index 7c180c0..0000000
--- a/auquotidien/modules/pyatom/afl-2.1.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-# Larry Rosen has ceased to use or recommend any version
-# of the Academic Free License below version 2.1
-
-The Academic Free License
-v. 2.1
-
-This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following notice immediately following the copyright notice for the Original Work:
-
-Licensed under the Academic Free License version 2.1
-
-1) Grant of Copyright License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license to do the following:
-
-a) to reproduce the Original Work in copies;
-
-b) to prepare derivative works ("Derivative Works") based upon the Original Work;
-
-c) to distribute copies of the Original Work and Derivative Works to the public;
-
-d) to perform the Original Work publicly; and
-
-e) to display the Original Work publicly.
-
-2) Grant of Patent License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, to make, use, sell and offer for sale the Original Work and Derivative Works.
-
-3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor hereby agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work, and by publishing the address of that information repository in a notice immediately following the copyright notice that applies to the Original Work.
-
-4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior written permission of the Licensor. Nothing in this License shall be deemed to grant any rights to trademarks, copyrights, patents, trade secrets or any other intellectual property of Licensor except as expressly stated herein. No patent license is granted to make, use, sell or offer to sell embodiments of any patent claims other than the licensed claims defined in Section 2. No right is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under different terms from this License any Original Work that Licensor otherwise would have a right to license.
-
-5) This section intentionally omitted.
-
-6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
-
-7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately proceeding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to Original Work is granted hereunder except under this disclaimer.
-
-8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to any person for any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to liability for death or personal injury resulting from Licensor's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You.
-
-9) Acceptance and Termination. If You distribute copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. Nothing else but this License (or another written agreement between Licensor and You) grants You permission to create Derivative Works based upon the Original Work or to exercise any of the rights granted in Section 1 herein, and any attempt to do so except under the terms of this License (or another written agreement between Licensor and You) is expressly prohibited by U.S. copyright law, the equivalent laws of other countries, and by international treaty. Therefore, by exercising any of the rights granted to You in Section 1 herein, You indicate Your acceptance of this License and all of its terms and conditions.
-
-10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
-
-11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et seq., the equivalent laws of other countries, and international treaty. This section shall survive the termination of this License.
-
-12) Attorneys Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
-
-13) Miscellaneous. This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
-
-14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
-
-15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
-
-This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved. Permission is hereby granted to copy and distribute this license without modification. This license may not be modified without the express written permission of its copyright owner.
-
- 
-
diff --git a/auquotidien/modules/pyatom/pyatom.py b/auquotidien/modules/pyatom/pyatom.py
deleted file mode 100644
index 9a5eceb..0000000
--- a/auquotidien/modules/pyatom/pyatom.py
+++ /dev/null
@@ -1,1734 +0,0 @@
-# pyatom.py -- PyAtom library module
-
-"""
-PyAtom
-
-Module to make it really easy to create Atom syndication feeds.
-
-This module is Copyright (C) 2006 Steve R. Hastings.
-Licensed under the Academic Free License version 2.1
-
-You might want to start with the test cases at the end; see how they
-work, and then go back and look at the code in the module.
-
-I hope you find this useful!
-
-Steve R. Hastings
-
-Please send your questions or comments to this email address:
-
-pyatom@langri.com
-"""
-
-
-
-import re
-import sys
-import time
-
-s_pyatom_name = "PyAtom"
-s_pyatom_ver = "0.3.9"
-s_pyatom_name_ver = "%s version %s" % (s_pyatom_name, s_pyatom_ver)
-
-# string constants
-# These string values are used in more than one place.
-
-s_version = "version"
-s_encoding = "encoding"
-s_standalone = "standalone"
-
-s_href = "href"
-s_lang = "xml:lang"
-s_link = "link"
-s_term = "term"
-s_type = "type"
-
-
-
-def set_s_indent(s):
-	"""
-	Set up the globals PyAtom uses to indent its output:
-	s_indent, and s_indent_big
-
-	s_indent is the string to indent one level; default is \\t.
-
-	s_indent_big is s_indent concatenated many times.  PyAtom uses slice
-	copies to get indent strings from s_indent_big.
-	"""
-	global s_indent
-	global s_indent_big
-	s_indent = s
-	s_indent_big = s*256
-
-set_s_indent("\t")
-
-
-
-class TFC(object):
-	"""
-	class TFC: Tag Format Control.
-	Controls how tags are converted to strings.
-
-	Arguments to __init__():
-		level	Specifies what indent level to start at for output.  Default 0.
-		mode	Specifies how to format the output:
-				mode_terse -- minimal output (no indenting)
-				mode_normal -- default
-				mode_verbose -- normal, plus some XML comments
-
-	Normally, if an XML item has no data, nothing is printed, but with
-	mode_verbose you may get a comment like "Collection with 0 entries".
-
-	Methods:
-		b_print_all()
-			Return True if TFC set for full printing.
-		b_print_terse()
-			Return True if TFC set for terse printing.
-		b_print_verbose()
-			Return True if TFC set for verbose printing.
-
-		indent_by(incr)
-			Return a TFC instance that indents by incr columns.
-		s_indent(extra_indent=0)
-			Return an indent string.
-	"""
-	mode_terse, mode_normal, mode_verbose = range(3)
-
-	def __init__(self, level=0, mode=mode_normal):
-		"""
-Arguments:
-	level	Specifies what indent level to start at for output.  Default 0.
-	mode	Specifies how to format the output:
-			mode_terse -- minimal output (no indenting)
-			mode_normal -- default
-			mode_verbose -- normal, plus some XML comments
-
-Normally, if an XML item has no data, nothing is printed, but with
-mode_verbose you may get a comment like "Collection with 0 entries".
-		"""
-		self.level = level
-		self.mode = mode
-
-	def b_print_all(self):
-		"""
-		Return True if TFC set for full printing.
-
-		Some optional things are usually suppressed, but will be printed
-		if the current level is 0.  And everything gets printed when
-		mode_verbose is set.
-		"""
-		return self.level == 0 or self.mode == TFC.mode_verbose
-
-	def b_print_terse(self):
-		"""
-		Return True if TFC set for terse printing.
-		"""
-		return self.mode == TFC.mode_terse
-
-	def b_print_verbose(self):
-		"""
-		Return True if TFC set for verbose printing.
-		"""
-		return self.mode == TFC.mode_verbose
-
-	def indent_by(self, incr):
-		"""
-		Return a TFC instance that indents by incr columns.
-
-		Pass this to a function that takes a TFC to get a temporary indent.
-		"""
-		return TFC(self.level + incr, self.mode)
-	def s_indent(self, extra_indent=0):
-		"""
-		Return an indent string.
-
-		Return a string of white space that indents correctly for the 
-		current TFC settings.  If specified, extra_indent will be added
-		to the current indent level.
-		"""
-		if self.mode == TFC.mode_terse:
-			return ""
-		level = self.level + extra_indent
-		return s_indent_big[0:level]
-
-
-
-pat_nbsp = re.compile(r'&nbsp;')
-def s_entities_to_ws(s):
-	"""
-	Return a copy of s with HTML whitespace entities replaced by a space.
-
-	Currently just gets rid of HTML non-breaking spaces ("&nbsp;").
-	"""
-	if not s:
-		return s
-
-	s = re.sub(pat_nbsp, " ", s)
-	return s
-
-def s_normalize_ws(s):
-	"""
-	Return a copy of string s with each run of whitespace replaced by one space.
-	>>> s = "and    now\n\n\nfor \t  something\v   completely\r\n  different"
-	>>> print s_normalize_ws(s)
-	and now for something completely different
-	>>>
-	"""
-	lst = s.split()
-	s = " ".join(lst)
-	return s
-	
-
-def s_escape_html(s):
-	"""
-	Return a copy of string s with HTML codes escaped.
-
-	This is useful when you want HTML tags printed literally, rather than
-	interpreted.
-
-	>>> print s_escape_html("<head>")
-	&lt;head&gt;
-	>>> print s_escape_html("&nbsp;")
-	&amp;nbsp;
-	"""
-	s = s.replace("&", "&amp;")
-	s = s.replace("<", "&lt;")
-	s = s.replace(">", "&gt;")
-	return s
-
-def s_create_atom_id(t, domain_name, uri=""):
-	"""
-	Create ID using Mark Pilgrim's algorithm.
-
-	Algorithm taken from here:
-	http://diveintomark.org/archives/2004/05/28/howto-atom-id
-	"""
-
-	# ymd (year-month-day) example: 2003-12-13
-	ymd = time.strftime("%Y-%m-%d", t)
-
-	if uri == "":
-		# mush (all mushed together) example: 20031213083000
-		mush = time.strftime("%Y%m%d%H%M%S", t)
-		uri = "/weblog/" + mush
-
-	# s = "tag:" + domain_name + "," + ymd + ":" + uri
-	s = "tag:%s,%s:%s" % (domain_name, ymd, uri)
-
-	s = s.replace("#", "/")
-
-	return s
-
-s_copyright_multiyear = "Copyright %s %d-%d by %s."
-s_copyright_oneyear = "Copyright %s %d by %s."
-def s_copyright(s_owner, s_csym="(C)", end_year=None, start_year=None):
-	"""
-	Return a string with a copyright notice.
-
-	s_owner
-		string with copyright owner's name.
-	s_csym
-		string with copyright symbol. (An HTML entity might be good here.)
-	end_year
-		last year of the copyright.  Default is the current year.
-	start_year
-		first year of the copyright.
-
-	If only end_year is specified, only print one year; if both end_year and
-	start_year are specified, print a range.
-
-	To localize the entire copyright message into another language, change
-	the global variables with the copyright template:
-		s_copyright_multiyear: for a year range
-		s_copyright_oneyear: for a single year
-	"""
-	if not end_year:
-		end_year = time.localtime().tm_year
-
-	if start_year:
-		return s_copyright_multiyear % (s_csym, start_year, end_year, s_owner)
-
-	return s_copyright_oneyear % (s_csym, end_year, s_owner)
-
-
-
-# Here are all of the possible XML items.
-#
-# Supported by PyAtom:
-# XML Declaration: <?xml ... ?>
-# Comments: <!-- ... -->
-# Elements: <tag_name>...</tag_name>
-#
-# Minimal support:
-# Markup Declarations: <!KEYWORD ... >
-# Processing Instructions (PIs): <?KEYWORD ... ?>
-#
-# Not currently supported:
-# INCLUDE and IGNORE directives: <!KEYWORD[ ... ]]>
-# CDATA sections: <![CDATA[ ... ]]>
-#
-
-class XMLItem(object):
-	"""
-	All PyAtom classes inherit from this class.  All it does is provide a
-	few default methods, and be a root for the inheritance tree.
-
-	An XMLItem has several methods that return an XML tag representation of
-	its contents.  Each XMLItem knows how to make a tag for itself.  An
-	XMLItem that contains other XMLItems will ask each one to make a tag;
-	so asking the top-level XMLItem for a tag will cause the entire tree
-	of XMLItems to recursively make tags, and you get a full XML
-	representation with tags appropriately nested and indented.
-	"""
-	def _s_tag(self, tfc):
-		"""
-		A stub which must always be overridden by child classes.
-		"""
-		assert False, "XMLItem instance is too abstract to print."
-
-	def s_tag(self, level):
-		"""
-		Return the item as a string containing an XML tag declaration.
-
-		The XML tag will be indented.
-		Will return an empty string if the item is empty.
-		"""
-		tfc = TFC(level, TFC.mode_normal)
-		return self._s_tag(tfc)
-
-	def s_tag_verbose(self, level):
-		"""
-		Return the item as a string containing an XML tag declaration.
-
-		The XML tag will be indented.
-		May return an XML Comment if the item is empty.
-		"""
-		tfc = TFC(level, TFC.mode_verbose)
-		return self._s_tag(tfc)
-
-	def s_tag_terse(self, level):
-		"""
-		Return the item as a string containing an XML tag declaration.
-
-		The XML tag will not be indented.
-		Will return an empty string if the item is empty.
-		"""
-		tfc = TFC(level, TFC.mode_terse)
-		return self._s_tag(tfc)
-
-	def __str__(self):
-		return self.s_tag(0)
-
-	def level(self):
-		"""
-		Return an integer describing what level this tag is.
-
-		The root tag of an XML document is level 0; document-level comments
-		or other document-level declarations are also level 0.  Tags nested
-		inside the root tag are level 1, tags nested inside those tags are
-		level 2, and so on.
-
-		This is currently only used by the s_tree() functions.  When
-		printing tags normally, the code that walks the tree keeps track of
-		what level is current.
-		"""
-		level = 0
-		while self._parent != None:
-			self = self._parent
-			if self.is_element():
-				level += 1
-		return level
-
-	def s_name(self):
-		"""
-		Return a name for the current item.
-
-		Used only by the s_tree() functions.
-		"""
-		if self._name:
-			return self._name
-		return "unnamed_instance_of_" + type(self).__name__
-
-	def s_tree(self):
-		"""
-		Return a verbose tree showing the current tag and its children.
-
-		This is for debugging; it's not valid XML syntax.
-		"""
-		level = self.level()
-		return "%2d) %s\t%s" % (level, self.s_name(), str(self))
-
-
-
-class DocItem(XMLItem):
-	"""
-	A document-level XML item (appearing above root element).
-
-	Items that can be document-level inherit from this class.
-	"""
-	pass
-
-
-
-class ElementItem(XMLItem):
-	"""
-	An item that may be nested inside an element.
-
-	Items that can be nested inside other elements inherit from this class.
-	"""
-	pass
-
-
-
-class Comment(DocItem,ElementItem):
-	"""
-	An XML comment.
-
-	Attributes:
-		text
-			set the text of the comment
-	"""
-	def __init__(self, text=""):
-		"""
-		text: set the text of the comment
-		"""
-		self._parent = None
-		self._name = ""
-		self.tag_name = "comment"
-		self.text = text
-
-	def _s_tag(self, tfc):
-		if not self:
-			if tfc.b_print_all():
-				return tfc.s_indent() + "<!-- -->"
-			else:
-				return ""
-		else:
-			if self.text.find("\n") >= 0:
-				lst = []
-				lst.append(tfc.s_indent() + "<!--")
-				lst.append(self.text)
-				lst.append(tfc.s_indent() + "-->")
-				return "\n".join(lst)
-			else:
-				s = "%s%s%s%s" % (tfc.s_indent(), "<!-- ", self.text, " -->")
-				return s
-
-		assert False, "not possible to reach this line."
-
-	def __nonzero__(self):
-		# Returns True if there is any comment text.
-		# Returns False otherwise.
-		return not not self.text
-
-	def is_element(self):
-		return True
-
-
-
-# REVIEW: can a PI be an ElementItem?
-class PI(DocItem):
-	"""
-	XML Processing Instruction (PI).
-
-	Attributes:
-		keyword
-		text
-	"""
-	def __init__(self):
-		self._parent = None
-		self._name = ""
-		self.keyword = ""
-		self.text = ""
-
-	def _s_tag(self, tfc):
-		if not self:
-			return ""
-		else:
-			if self.text.find("\n") >= 0:
-				lst = []
-				lst.append("%s%s%s" % (tfc.s_indent(), "<?", self.keyword))
-				lst.append(self.text)
-				lst.append("%s%s" % (tfc.s_indent(), "?>"))
-				return "\n".join(lst)
-			else:
-				s = "%s%s%s %s%s"% \
-						(tfc.s_indent(), "<?", self.keyword, self.text, "?>")
-				return s
-
-		assert False, "not possible to reach this line."
-
-	def __nonzero__(self):
-		# Returns True if there is any keyword.
-		# Returns False otherwise.
-		return not not self.keyword
-
-
-
-# REVIEW: can a MarkupDecl be an ElementItem?
-class MarkupDecl(DocItem):
-	"""
-	XML Markup Declaration.
-
-	Attributes:
-		keyword
-		text
-	"""
-	def __init__(self):
-		self._parent = None
-		self._name = ""
-		self.keyword = ""
-		self.text = ""
-
-	def _s_tag(self, tfc):
-		if not self:
-			return ""
-		else:
-			if self.text.find("\n") >= 0:
-				lst = []
-				lst.append("%s%s%s" % (tfc.s_indent(), "<!", self.keyword))
-				lst.append(self.text)
-				lst.append("%s%s" % (tfc.s_indent(), ">"))
-				return "\n".join(lst)
-			else:
-				s = "%s%s%s %s%s" % \
-						(tfc.s_indent(), "<!", self.keyword, self.text, ">")
-				return s
-
-		assert False, "not possible to reach this line."
-
-	def __nonzero__(self):
-		# Returns True if there is any keyword.
-		# Returns False otherwise.
-		return not not self.keyword
-
-
-
-class CoreElement(ElementItem):
-	"""
-	This is an abstract class.
-
-	All of the XML element classes inherit from this.
-	"""
-	def __init__(self, tag_name, def_attr, def_attr_value, attr_names = []):
-		# dictionary of attributes and their values
-		self.lock = False
-		self._parent = None
-		self._name = ""
-		self.tag_name = tag_name
-		self.def_attr = def_attr
-		self.attrs = {}
-		if def_attr and def_attr_value:
-			self.attrs[def_attr] = def_attr_value
-		self.attr_names = attr_names
-		self.lock = True
-
-	def __nonzero__(self):
-		# Returns True if any attrs are set or there are any contents.
-		# Returns False otherwise.
-		return not not self.attrs or self.has_contents()
-
-	def text_check(self):
-		"""
-		Raise an exception, unless element has text contents.
-
-		Child classes that have text must override this to do nothing.
-		"""
-		raise TypeError, "element does not have text contents"
-
-	def nest_check(self):
-		"""
-		Raise an exception, unless element can nest other elements.
-
-		Child classes that can nest must override this to do nothing.
-		"""
-		raise TypeError, "element cannot nest other elements"
-
-	def __delattr__(self, name):
-		# REVIEW: this should be made to work!
-		raise TypeError, "cannot delete elements"
-
-	def __getattr__(self, name):
-		if name == "lock":
-			# If the "lock" hasn't been created yet, we always want it
-			# to be False, i.e. we are not locked.
-			return False
-		else:
-			raise AttributeError, name
-
-	def __setattr__(self, name, value):
-		# Here's how this works:
-		#
-		# 0) "self.lock" is a boolean, set to False during __init__()
-		# but turned True afterwards.  When it's False, you can add new
-		# members to the class instance without any sort of checks; once
-		# it's set True, __setattr__() starts checking assignments.
-		# By default, when lock is True, you cannot add a new member to
-		# the class instance, and any assignment to an old member has to
-		# be of matching type.  So if you say "a.text = string", the
-		# .text member has to exist and be a string member.
-		#
-		# This is the default __setattr__() for all element types.  It
-		# gets overloaded by the __setattr__() in NestElement, because
-		# for nested elments, it makes sense to be able to add new
-		# elements nested inside.
-		#
-		# This is moderately nice.  But later in NestElement there is a
-		# version of __setattr__() that is *very* nice; check it out.
-		#
-		# 1) This checks assignments to _parent, and makes sure they are
-		# plausible (either an XMLItem, or None).
-
-		try:
-			lock = self.lock
-		except AttributeError:
-			lock = False
-
-		if not lock:
-			self.__dict__[name] = value
-			return
-
-		dict = self.__dict__
-		if not name in dict:
-			# brand-new item
-			if lock:
-				raise TypeError, "element cannot nest other elements"
-
-		if name == "_parent":
-			if not (isinstance(value, XMLItem) or value is None):
-				raise TypeError, "only XMLItem or None is permitted"
-			self.__dict__[name] = value
-			return
-
-		# locked item so do checks
-		if not type(self.__dict__[name]) is type(value):
-			raise TypeError, "value is not the same type"
-
-		self.__dict__[name] = value
-		
-
-	def has_contents(self):
-		return False
-
-	def multiline_contents(self):
-		return False
-
-	def s_contents(self, tfc):
-		assert False, "CoreElement is an abstract class; it has no contents."
-
-	def _s_start_tag_name_attrs(self, tfc):
-		"""
-		Return a string with the start tag name, and any attributes.
-
-		Wrap this in correct punctuation to get a start tag.
-		"""
-		def attr_newline(tfc):
-			if tfc.b_print_terse():
-				return " "
-			else:
-				return "\n" + tfc.s_indent(2)
-
-		lst = []
-		lst.append(self.tag_name)
-
-		if len(self.attrs) == 1:
-			# just one attr so do on one line
-			attr = self.attrs.keys()[0]
-			s_attr = '%s="%s"' % (attr, self.attrs[attr])
-			lst.append(" " + s_attr)
-		elif len(self.attrs) > 1:
-			# more than one attr so do a nice nested tag
-			# 0) show all attrs in the order of attr_names
-			for attr in self.attr_names:
-				if attr in self.attrs.keys():
-					s_attr = '%s="%s"' % (attr, self.attrs[attr])
-					lst.append(attr_newline(tfc) + s_attr)
-			# 1) any attrs not in attr_names?  list them, too
-			for attr in self.attrs:
-				if not attr in self.attr_names:
-					s_attr = '%s="%s"' % (attr, self.attrs[attr])
-					lst.append(attr_newline(tfc) + s_attr)
-
-		return "".join(lst)
-
-	def _s_tag(self, tfc):
-		if not self:
-			if not tfc.b_print_all():
-				return ""
-
-		lst = []
-
-		lst.append(tfc.s_indent() + "<" + self._s_start_tag_name_attrs(tfc))
-
-		if not self.has_contents():
-			lst.append("/>")
-		else:
-			lst.append(">")
-			if self.multiline_contents():
-				s = "\n%s\n" % self.s_contents(tfc.indent_by(1))
-				lst.append(s + tfc.s_indent())
-			else:
-				lst.append(self.s_contents(tfc))
-			lst.append("</" + self.tag_name + ">")
-
-		return "".join(lst)
-
-	def s_start_tag(self, tfc):
-		return tfc.s_indent() + "<" + self._s_start_tag_name_attrs(tfc) + ">"
-
-	def s_end_tag(self):
-		return "</" + self.tag_name + ">"
-
-	def s_compact_tag(self, tfc):
-		return tfc.s_indent() + "<" + self._s_start_tag_name_attrs(tfc) + "/>"
-
-	def is_element(self):
-		return True
-
-
-
-class TextElement(CoreElement):
-	"""
-	An element that cannot have other elements nested inside it.
-
-	Attributes:
-		attr
-		text
-	"""
-	def __init__(self, tag_name, def_attr, def_attr_value, attr_names = []):
-		CoreElement.__init__(self, tag_name, def_attr, def_attr_value,
-				attr_names)
-		self.lock = False
-		self.text = ""
-		self.lock = True
-
-	def text_check(self):
-		pass
-
-	def has_contents(self):
-		return not not self.text
-
-	def multiline_contents(self):
-		return self.text.find("\n") >= 0
-
-	def s_contents(self, tfc):
-		return self.text
-
-
-
-class Nest(ElementItem):
-	"""
-	A data structure that can store Elements, nested inside it.
-
-	Note: this is not, itself, an Element!  Because it is not an XML
-	element, it has no tags.  Its string representation is the
-	representations of the elements nested inside it.
-
-	NestElement and XMLDoc inherit from this.
-	"""
-	def __init__(self):
-		self.lock = False
-		self._parent = None
-		self._name = ""
-		self.elements = []
-		self.lock = True
-	def __len__(self):
-		return len(self.elements)
-	def __getitem__(self, key):
-		return self.elements[key]
-	def __setitem__(self, key, value):
-		self.elements[key] = value
-	def __delitem__(self, key):
-		del(self.elements[key])
-
-	def _do_setattr(self, name, value):
-		if isinstance(value, XMLItem):
-			value._parent = self
-			value._name = name
-			self.elements.append(value)
-		self.__dict__[name] = value
-
-	def __setattr__(self, name, value):
-		# Lots of magic here!  This is important stuff.  Here's how it works:
-		#
-		# 0) self.lock is a boolean, set to False initially and then set
-		# to True at the end of __init__().  When it's False, you can add new
-		# members to the class instance without any sort of checks; once
-		# it's set True, __setattr__() starts checking assignments.  By
-		# default, when lock is True, any assignment to an old member
-		# has to be of matching type.  You can add a new member to the
-		# class instance, but __setattr__() checks to ensure that the
-		# new member is an XMLItem.
-		#
-		# 1) Whether self.lock is set or not, if the value is an XMLitem,
-		# then this will properly add the XMLItem into the tree
-		# structure.  The XMLItem will have _parent set to the parent,
-		# will have _name set to its name in the parent, and will be
-		# added to the parent's elements list.  This is handled by
-		# _do_setattr().
-		#
-		# 2) As a convenience for the user, if the user is assigning a
-		# string, and self is an XMLItem that has a .text value, this
-		# will assign the string to the .text value.  This allows usages
-		# like "e.title = string", which is very nice.  Before I added
-		# this, I frequently wrote that instead of "e.title.text =
-		# string" so I wanted it to just work.  Likewise the user can
-		# assign a time value directly into Timestamp elements.
-		#
-		# 3) This checks assignments to _parent, and makes sure they are
-		# plausible (either an XMLItem, or None).
-
-		try:
-			lock = self.lock
-		except AttributeError:
-			lock = False
-
-		if not lock:
-			self._do_setattr(name, value)
-			return
-
-		dict = self.__dict__
-		if not name in dict:
-			# brand-new item
-			if lock:
-				self.nest_check()
-				if not isinstance(value, XMLItem):
-					raise TypeError, "only XMLItem is permitted"
-			self._do_setattr(name, value)
-			return
-
-		if name == "_parent" or name == "root_element":
-			if not (isinstance(value, XMLItem) or value is None):
-				raise TypeError, "only XMLItem or None is permitted"
-			self.__dict__[name] = value
-			return
-
-		if name == "_name" and type(value) == type(""):
-			self.__dict__[name] = value
-			return
-
-		# for Timestamp elements, allow this:  element = time
-		# (where "time" is a float value, since uses float for times)
-		# Also allow valid timestamp strings.
-		if isinstance(self.__dict__[name], Timestamp):
-			if type(value) == type(1.0):
-				self.__dict__[name].time = value
-				return
-			elif type(value) == type(""):
-				t = utc_time_from_s_timestamp(value)
-				if t:
-					self.__dict__[name].time = t
-				else:
-					raise ValueError, "value must be a valid timestamp string"
-				return
-
-		# Allow string assignment to go to the .text attribute, for
-		# elements that allow it.  All TextElements allow it;
-		# Elements will allow it if they do not nave nested elements.
-		# text_check() raises an error if it's not allowed.
-		if isinstance(self.__dict__[name], CoreElement) and \
-				type(value) == type(""):
-			self.__dict__[name].text_check()
-			self.__dict__[name].text = value
-			return
-
-		# locked item so do checks
-		if not type(self.__dict__[name]) is type(value):
-			raise TypeError, "value is not the same type"
-
-		self.__dict__[name] = value
-		
-	def __delattr__(self, name):
-		# This won't be used often, if ever, but if anyone tries it, it
-		# should work.
-		if isinstance(self.name, XMLItem):
-			o = self.__dict__[name]
-			self.elements.remove(o)
-			del(self.__dict__[name])
-		else:
-			# REVIEW: what error should this raise?
-			raise TypeError, "cannot delete that item"
-
-	def nest_check(self):
-		pass
-
-	def is_element(self):
-		# a Nest is not really an element
-		return False
-
-	def has_contents(self):
-		for element in self.elements:
-			if element:
-				return True
-		# empty iff all of the elements were empty
-		return False
-
-	def __nonzero__(self):
-		return self.has_contents()
-
-	def multiline_contents(self):
-		# if there are any contents, we want multiline for nested tags
-		return self.has_contents()
-
-	def s_contents(self, tfc):
-		if len(self.elements) > 0:
-			# if any nested elements exist, we show those
-			lst = []
-
-			for element in self.elements:
-				s = element._s_tag(tfc)
-				if s:
-					lst.append(s)
-
-			return "\n".join(lst)
-		else:
-			return ""
-
-		assert False, "not possible to reach this line."
-		return ""
-
-	def s_tree(self):
-		level = self.level()
-		tup = (level, self.s_name(), self.__class__.__name__)
-		s = "%2d) %s (instance of %s)" % tup
-		lst = []
-		lst.append(s)
-		for element in self.elements:
-			s = element.s_tree()
-			lst.append(s)
-		return "\n".join(lst)
-
-	def _s_tag(self, tfc):
-		return self.s_contents(tfc)
-
-
-
-
-class NestElement(Nest,CoreElement):
-	"""
-	An element that can have other elements nested inside it.
-
-	Attributes:
-		attr
-		elements: a list of other elements nested inside this one.
-	"""
-	def __init__(self, tag_name, def_attr, def_attr_value, attr_names=[]):
-		CoreElement.__init__(self, tag_name, def_attr, def_attr_value,
-				attr_names)
-		self.lock = False
-		self.elements = []
-		self.lock = True
-
-	def is_element(self):
-		return True
-
-	def __nonzero__(self):
-		return CoreElement.__nonzero__(self)
-
-	def _s_tag(self, tfc):
-		return CoreElement._s_tag(self, tfc)
-
-
-
-class Element(NestElement,TextElement):
-	"""
-	A class to represent an arbitrary XML tag.  Can either have other XML
-	elements nested inside it, or else can have a text string value, but
-	never both at the same time.
-
-	This is intended for user-defined XML tags.  The user can just use
-	"Element" for all custom tags.
-
-	PyAtom doesn't use this; PyAtom uses TextElement for tags with a text
-	string value, and NestElement for tags that nest other elements.  Users
-	can do the same, or can just use Element, as they like.
-
-	Attributes:
-		attr
-		elements:	a list of other elements nested inside, if any
-		text:	a text string value, if any
-
-	Note: if text is set, elements will be empty, and vice-versa.  If you
-	have elements nested inside and try to set the .text, this will raise
-	an exception, and vice-versa.
-	"""
-	# A Element can have other elements nested inside it, or it can have
-	# a single ".text" string value.  But never both at the same time.
-	# Once you nest another element, you can no longer use the .text.
-	def __init__(self, tag_name, def_attr, def_attr_value, attr_names=[]):
-		NestElement.__init__(self, tag_name, def_attr, def_attr_value,
-				attr_names)
-		self.lock = False
-		self.text = ""
-		self.lock = True
-
-	def nest_check(self):
-		if self.text:
-			raise TypeError, "Element has text contents so cannot nest"
-
-	def text_check(self):
-		if len(self.elements) > 0:
-			raise TypeError, "Element has nested elements so cannot assign text"
-
-	def has_contents(self):
-		return NestElement.has_contents(self) or TextElement.has_contents(self)
-
-	def multiline_contents(self):
-		return NestElement.has_contents(self) or self.text.find("\n") >= 0
-
-	def s_contents(self, tfc):
-		if len(self.elements) > 0:
-			return NestElement.s_contents(self, tfc)
-		elif self.text:
-			return TextElement.s_contents(self, tfc)
-		else:
-			return ""
-		assert False, "not possible to reach this line."
-
-	def s_tree(self):
-		lst = []
-		if len(self.elements) > 0:
-			level = self.level()
-			tup = (level, self.s_name(), self.__class__.__name__)
-			s = "%2d) %s (instance of %s)" % tup
-			lst.append(s)
-			for element in self.elements:
-				s = element.s_tree()
-				lst.append(s)
-			return "\n".join(lst)
-		elif self.text:
-			return XMLItem.s_tree(self)
-		else:
-			level = self.level()
-			tfc = TFC(level)
-			s = "%2d) %s %s" % (level, self.s_name(), "empty Element...")
-			return s
-		assert False, "not possible to reach this line."
-
-
-
-class Collection(XMLItem):
-	"""
-	A Collection contains 0 or more Elements, but isn't an XML element.
-	Use where a run of 0 or more Elements of the same type is legal.
-
-	When you init your Collection, you specify what class of Element it will
-	contain.  Attempts to append an Element of a different class will raise
-	an exception.  Note, however, that the various Element classes all
-	inherit from base classes, and you can specify a class from higher up in
-	the inheritance tree.  You could, if you wanted, make a Collection
-	containing "XMLItem" and then any item defined in PyAtom would be legal
-	in that collection.  (See XMLDoc, which contains two collections of
-	DocItem.)
-
-	Attributes:
-		contains:	the class of element this Collection will contain
-		elements:	a list of other elements nested inside, if any
-
-	Note: The string representation of a Collection is just the string
-	representations of the elements inside it.  However, a verbose string
-	reprentation may have an XML comment like this:
-
-	<!-- Collection of <class> with <n> elements -->
-
-	where <n> is the number of elements in the Collection and <class> is the
-	name of the class in this Collection.
-	"""
-	def __init__(self, element_class):
-		self.lock = False
-		self._parent = None
-		self._name = ""
-		self.elements = []
-		self.contains = element_class
-		self.lock = True
-	def __len__(self):
-		return len(self.elements)
-	def __getitem__(self, key):
-		return self.elements[key]
-	def __setitem__(self, key, value):
-		if not isinstance(value, self.contains):
-			raise TypeError, "object is the wrong type for this collection"
-		self.elements[key] = value
-	def __delitem__(self, key):
-		del(self.elements[key])
-
-	def __nonzero__(self):
-		# there are no attrs so if any element is nonzero, collection is too
-		for element in self.elements:
-			if element:
-				return True
-		return False
-
-	def is_element(self):
-		# A Collection is not really an Element
-		return False
-
-	def s_coll(self):
-		name = self.contains.__name__
-		n = len(self.elements)
-		if n == 1:
-			el = "element"
-		else:
-			el = "elements"
-		return "collection of %s with %d %s" % (name, n, el)
-
-	def append(self, element):
-		if not isinstance(element, self.contains):
-			print >> sys.stderr, "Error: attempted to insert", \
-					type(element).__name__, \
-					"into collection of", self.contains.__name__
-			raise TypeError, "object is the wrong type for this collection"
-		element._parent = self
-		self.elements.append(element)
-
-	def _s_tag(self, tfc):
-		# A collection exists only as a place to put real elements.
-		# There are no start or end tags...
-		# When tfc.b_print_all() is true, we do put an XML comment.
-
-		if not self.elements:
-			if not tfc.b_print_all():
-				return ""
-
-		lst = []
-
-		if tfc.b_print_verbose():
-			s = "%s%s%s%s" % (tfc.s_indent(), "<!-- ", self.s_coll(), " -->")
-			lst.append(s)
-			tfc = tfc.indent_by(1)
-
-		for element in self.elements:
-			s = element._s_tag(tfc)
-			if s:
-				lst.append(s)
-
-		return "\n".join(lst)
-
-	def s_tree(self):
-		level = self.level()
-		s = "%2d) %s %s" % (level, self.s_name(), self.s_coll())
-		lst = []
-		lst.append(s)
-		for element in self.elements:
-			s = element.s_tree()
-			lst.append(s)
-		return "\n".join(lst)
-
-
-
-class XMLDeclaration(XMLItem):
-	# REVIEW: should this print multi-line for multiple attrs?
-	def __init__(self):
-		self._parent = None
-		self._name = ""
-		self.attrs = {}
-		self.attrs[s_version] = "1.0"
-		self.attrs[s_encoding] = "utf-8"
-		self.attr_names = [s_version, s_encoding, s_standalone]
-
-	def _s_tag(self, tfc):
-		# An XMLDeclaration() instance is never empty, so always prints.
-
-		lst = []
-		s = "%s%s" % (tfc.s_indent(), "<?xml")
-		lst.append(s)
-		# 0) show all attrs in the order of attr_names
-		for attr in self.attr_names:
-			if attr in self.attrs.keys():
-				s_attr = ' %s="%s"' % (attr, self.attrs[attr])
-				lst.append(s_attr)
-		# 1) any attrs not in attr_names?  list them, too
-		for attr in self.attrs:
-			if not attr in self.attr_names:
-				s_attr = ' %s="%s"' % (attr, self.attrs[attr])
-				lst.append(s_attr)
-		lst.append("?>")
-
-		return "".join(lst)
-
-	def __nonzero__(self):
-		# Returns True because the XML Declaration is never empty.
-		return True
-
-	def is_element(self):
-		return True
-
-
-
-class XMLDoc(Nest):
-	"""
-	A data structure to represent an XML Document.  It will have the
-	following structure:
-
-	the XML Declaration item
-	0 or more document-level XML items
-	exactly one XML item (the "root tag")
-	0 or more document-level XML items
-
-	document level XML items are: Comment, PI, MarkupDecl
-
-
-	Attributes:
-		xml_decl:	the XMLDeclaration item
-		docitems_above:	a collection of DocItem (items above root_element)
-		root_element:	the XML tag containing your data
-		docitems_below:	a collection of DocItem (items below root_element)
-
-	Note: usually the root_element has lots of other XML items nested inside
-	it!
-	"""
-	def __init__(self, root_element=None):
-		Nest.__init__(self)
-
-		self._name = "XMLDoc"
-
-		self.xml_decl = XMLDeclaration()
-		self.docitems_above = Collection(DocItem)
-
-		if not root_element:
-			root_element = Comment("no root element yet")
-		self.root_element = root_element
-
-		self.docitems_below = Collection(DocItem)
-
-	def __setattr__(self, name, value):
-		# root_element may always be set to any ElementItem
-		if name == "root_element":
-			if not (isinstance(value, ElementItem)):
-				raise TypeError, "only ElementItem is permitted"
-
-			self.lock = False
-			# Item checks out, so assign it.  root_element should only
-			# ever have one element, and we always put the new element
-			# in the same slot in elements[].
-			if "i_root_element" in self.__dict__:
-				# Assign new root_element over old one in elements[]
-				assert self.elements[self.i_root_element] == self.root_element
-				self.elements[self.i_root_element] = value
-			else:
-				# This is the first time root_element was ever set.
-				self.i_root_element = len(self.elements)
-				self.elements.append(value)
-
-			value._parent = self
-			value._name = name
-			self.__dict__[name] = value
-			self.lock = True
-		else:
-			# for all other, fall through to inherited behavior
-			Nest.__setattr__(self, name, value)
-
-	def Validate(self):
-		# XMLDoc never has parent.  Never change this!
-		assert self._parent == None
-		return True
-
-
-
-def local_time_from_utc_time(t):
-	return t - time.timezone
-
-def utc_time_from_local_time(t):
-	return t + time.timezone
-
-def local_time():
-	return time.time() - time.timezone
-
-def utc_time():
-	return time.time()
-
-
-class TimeSeq(object):
-	"""
-	A class to generate a sequence of timestamps.
-
-	Atom feed validators complain if multiple timestamps have the same
-	value, so this provides a convenient way to set a bunch of timestamps
-	all at least one second different from each other.
-	"""
-	def __init__(self, init_time=0):
-		if init_time == 0:
-			self.time = local_time()
-		else:
-			self.time = float(init_time)
-	def next(self):
-		t = self.time
-		self.time += 1.0
-		return t
-
-format_RFC3339 = "%Y-%m-%dT%H:%M:%S"
-
-def parse_time_offset(s):
-	s = s.lstrip().rstrip()
-
-	if (s == '' or s == 'Z' or s == 'z'):
-		return 0
-
-	m = pat_time_offset.search(s)
-	sign = m.group(1)
-	offset_hour = int(m.group(2))
-	offset_min = int(m.group(3))
-	offset = offset_hour * 3600 + offset_min * 60
-	if sign == "-":
-		offset *= -1
-	return offset
-
-def s_timestamp(utc_time, time_offset="Z"):
-	"""
-	Format a time and offset into a string.
-
-	utc_time
-		a floating-point value, time in the UTC time zone
-	s_time_offset
-		a string specifying an offset from UTC.  Examples:
-			z or Z -- offset is 0 ("Zulu" time, UTC, aka GMT)
-			-08:00 -- 8 hours earlier than UTC (Pacific time zone)
-			"" -- empty string is technically not legal, but may work
-
-	Notes:
-		Returned string complies with RFC3339; uses ISO8601 date format.
-		Example: 2003-12-13T18:30:02Z
-		Example: 2003-12-13T18:30:02+02:00
-	"""
-
-	if not utc_time:
-		return ""
-
-	utc_time += parse_time_offset(time_offset)
-
-	try:
-		s = time.strftime(format_RFC3339, time.localtime(utc_time))
-	except:
-		return ""
-
-	return s + time_offset
-
-
-
-pat_RFC3339 = re.compile("(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(.*)")
-pat_time_offset = re.compile("([+-])(\d\d):(\d\d)")
-
-def utc_time_from_s_timestamp(s_date_time_stamp):
-	# parse RFC3339-compatible times that use ISO8601 date format
-	# date time stamp example: 2003-12-13T18:30:02Z
-	# date time stamp example: 2003-12-13T18:30:02+02:00
-	# leaving off the suffix is technically not legal, but allowed
-
-	s_date_time_stamp = s_date_time_stamp.lstrip().rstrip()
-
-	try:
-		m = pat_RFC3339.search(s_date_time_stamp)
-		year = int(m.group(1))
-		mon = int(m.group(2))
-		mday = int(m.group(3))
-		hour = int(m.group(4))
-		min = int(m.group(5))
-		sec = int(m.group(6))
-		tup = (year, mon, mday, hour, min, sec, -1, -1, -1)
-		t = time.mktime(tup)
-
-		s = m.group(7)
-		t += parse_time_offset(s)
-
-		return t
-
-	except:
-		return 0.0
-
-	assert False, "impossible to reach this line"
-
-
-def s_time_offset():
-	"""
-	Return a string with local offset from UTC in RFC3339 format.
-	"""
-
-	# If t is set to local time in seconds since the epoch, then...
-	# ...offset is the value you add to t to get UTC.  This is the
-	# reverse of time.timezone.
-
-	offset = -(time.timezone)
-
-	if offset > 0:
-		sign = "+"
-	else:
-		sign = "-"
-		offset = abs(offset)
-
-	offset_hour = offset // (60 * 60)
-	offset_min = (offset // 60) % 60
-	return "%s%02d:%02d" % (sign, offset_hour, offset_min)
-
-s_offset_local = s_time_offset()
-
-s_offset_default = s_offset_local
-
-def set_default_time_offset(s):
-	global s_offset_default
-	s_offset_default = s
-
-
-class Timestamp(CoreElement):
-	def __init__(self, tag_name, time=0.0):
-		CoreElement.__init__(self, tag_name, None, None)
-		self.lock = False
-		self.time = time
-		self.time_offset = s_offset_default
-		self.lock = True
-
-	def __delattr__(self, name):
-		CoreElement.__delattr_(self, name)
-
-	def __getattr__(self, name):
-		if name == "text":
-			return s_timestamp(self.time, self.time_offset)
-		return CoreElement.__getattr_(self, name)
-
-	def __setattr__(self, name, value):
-		if name == "text":
-			if type(value) != type(""):
-				raise TypeError, "can only assign a string to .text"
-			t = utc_time_from_s_timestamp(value)
-			if t:
-				self.time = utc_time_from_s_timestamp(value)
-			else:
-				raise ValueError, "value must be a valid timestamp string"
-			return
-		CoreElement.__setattr__(self, name, value)
-
-	def has_contents(self):
-		return self.time != 0
-
-	def multiline_contents(self):
-		return False
-
-	def s_contents(self, tfc):
-		return s_timestamp(self.time, self.time_offset)
-
-	def update(self):
-		self.time = local_time()
-		return self
-
-
-
-
-# Below are all the classes to implement Atom using the above tools.
-
-
-
-class AtomText(TextElement):
-	def __init__(self, tag_name):
-		attr_names = [ s_type ]
-		# legal values of type: "text", "html", "xhtml"
-		TextElement.__init__(self, tag_name, None, None, attr_names)
-
-class Title(AtomText):
-	def __init__(self, text=""):
-		AtomText.__init__(self, "title")
-		self.text = text
-		
-class Subtitle(AtomText):
-	def __init__(self, text=""):
-		AtomText.__init__(self, "subtitle")
-		self.text = text
-		
-class Content(AtomText):
-	def __init__(self, text=""):
-		AtomText.__init__(self, "content")
-		self.text = text
-		
-class Summary(AtomText):
-	def __init__(self, text=""):
-		AtomText.__init__(self, "summary")
-		self.text = text
-		
-class Rights(AtomText):
-	def __init__(self, text=""):
-		AtomText.__init__(self, "rights")
-		self.text = text
-		
-class Id(TextElement):
-	def __init__(self, text=""):
-		TextElement.__init__(self, "id", None, None)
-		self.text = text
-		
-class Generator(TextElement):
-	def __init__(self):
-		attr_names = [ "uri", "version" ]
-		TextElement.__init__(self, "generator", None, None, attr_names)
-		
-class Category(TextElement):
-	def __init__(self, term_val=""):
-		attr_names = [s_term, "scheme", "label"]
-		TextElement.__init__(self, "category", s_term, term_val, attr_names)
-
-class Link(TextElement):
-	def __init__(self, href_val=""):
-		attr_names = [
-				s_href, "rel", "type", "hreflang", "title", "length", s_lang]
-		TextElement.__init__(self, "link", s_href, href_val, attr_names)
-
-class Icon(TextElement):
-	def __init__(self):
-		TextElement.__init__(self, "icon", None, None)
-
-class Logo(TextElement):
-	def __init__(self):
-		TextElement.__init__(self, "logo", None, None)
-
-class Name(TextElement):
-	def __init__(self, text=""):
-		TextElement.__init__(self, "name", None, None)
-		self.text = text
-
-class Email(TextElement):
-	def __init__(self):
-		TextElement.__init__(self, "email", None, None)
-
-class Uri(TextElement):
-	def __init__(self):
-		TextElement.__init__(self, "uri", None, None)
-
-
-
-class BasicAuthor(NestElement):
-	def __init__(self, tag_name, name):
-		NestElement.__init__(self, tag_name, None, None)
-		self.name = Name(name)
-		self.email = Email()
-		self.uri = Uri()
-
-class Author(BasicAuthor):
-	def __init__(self, name=""):
-		BasicAuthor.__init__(self, "author", name)
-
-class Contributor(BasicAuthor):
-	def __init__(self, name=""):
-		BasicAuthor.__init__(self, "contributor", name)
-
-
-
-class Updated(Timestamp):
-	def __init__(self, time=0.0):
-		Timestamp.__init__(self, "updated", time)
-
-class Published(Timestamp):
-	def __init__(self, time=0.0):
-		Timestamp.__init__(self, "published", time)
-
-
-
-class FeedElement(NestElement):
-	def __init__(self, tag_name):
-		NestElement.__init__(self, tag_name, None, None)
-
-		self.title = Title("")
-		self.id = Id("")
-		self.updated = Updated()
-		self.authors = Collection(Author)
-		self.links = Collection(Link)
-
-		self.subtitle = Subtitle("")
-		self.categories = Collection(Category)
-		self.contributors = Collection(Contributor)
-		self.generator = Generator()
-		self.icon = Icon()
-		self.logo = Logo()
-		self.rights = Rights("")
-
-class Feed(FeedElement):
-	def __init__(self):
-		FeedElement.__init__(self, "feed")
-		self.attrs["xmlns"] = "http://www.w3.org/2005/Atom"
-		self.title.text = "Title of Feed Goes Here"
-		self.id.text = "ID of Feed Goes Here"
-		self.entries = Collection(Entry)
-
-class Source(FeedElement):
-	def __init__(self):
-		FeedElement.__init__(self, "source")
-
-
-
-class Entry(NestElement):
-	def __init__(self):
-		NestElement.__init__(self, "entry", None, None)
-		self.title = Title("Title of Entry Goes Here")
-		self.id = Id("ID of Entry Goes Here")
-		self.updated = Updated()
-		self.authors = Collection(Author)
-		self.links = Collection(Link)
-
-		self.content = Content("")
-		self.summary = Summary("")
-		self.categories = Collection(Category)
-		self.contributors = Collection(Contributor)
-		self.published = Published()
-		self.source = Source()
-		self.rights = Rights("")
-
-
-
-def diff(s0, name0, s1, name1):
-	from difflib import ndiff
-	lst0 = s0.split("\n")
-	lst1 = s1.split("\n")
-	report = '\n'.join(ndiff(lst0, lst1))
-	return report
-
-
-def run_test_cases():
-
-	# The default is to make time stamps in local time with appropriate
-	# offset; for our tests, we want a default "Z" offset instead.
-	set_default_time_offset("Z")
-
-	failed_tests = 0
-
-
-	# Test: convert current time into a timestamp string and back
-
-	now = local_time()
-	# timestamp format does not allow fractional seconds
-	now = float(int(now))	# truncate any fractional seconds
-	s = s_timestamp(now)
-	t = utc_time_from_s_timestamp(s)
-	if now != t:
-		failed_tests += 1
-		print "test case failed:"
-		print now, "-- original timestamp"
-		print t, "-- converted timestamp does not match"
-
-
-	# Test: convert a timestamp string to a time value and back
-
-	s_time = "2003-12-13T18:30:02Z"
-	t = utc_time_from_s_timestamp(s_time)
-	s = s_timestamp(t)
-	if s_time != s:
-		failed_tests += 1
-		print "test case failed:"
-		print s_time, "-- original timestamp"
-		print s, "-- converted timestamp does not match"
-
-
-	# Test: generate the "Atom-Powered Robots Run Amok" example
-	#
-	# Note: the original had some of the XML declarations in
-	# a different order than PyAtom puts them.  I swapped around
-	# the lines here so they would match the PyAtom order.  Other
-	# than that, this is the example from:
-	#
-	# http://www.atomenabled.org/developers/syndication/#sampleFeed
-
-	s_example = """\
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
-	<title>Example Feed</title>
-	<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
-	<updated>2003-12-13T18:30:02Z</updated>
-	<author>
-		<name>John Doe</name>
-	</author>
-	<link href="http://example.org/"/>
-	<entry>
-		<title>Atom-Powered Robots Run Amok</title>
-		<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
-		<updated>2003-12-13T18:30:02Z</updated>
-		<link href="http://example.org/2003/12/13/atom03"/>
-		<summary>Some text.</summary>
-	</entry>
-</feed>"""
-
-	xmldoc = XMLDoc()
-	
-	feed = Feed()
-	xmldoc.root_element = feed
-
-	feed.title = "Example Feed"
-	feed.id = "urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6"
-	feed.updated = "2003-12-13T18:30:02Z"
-
-	link = Link("http://example.org/")
-	feed.links.append(link)
-
-	author = Author("John Doe")
-	feed.authors.append(author)
-
-
-	entry = Entry()
-	feed.entries.append(entry)
-	entry.id = "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"
-	entry.title = "Atom-Powered Robots Run Amok"
-	entry.updated = "2003-12-13T18:30:02Z"
-	entry.summary = "Some text."
-
-	link = Link("http://example.org/2003/12/13/atom03")
-	entry.links.append(link)
-
-
-	s = str(xmldoc)
-	if s_example != s:
-		failed_tests += 1
-		print "test case failed:"
-		print "The generated XML doesn't match the example.  diff follows:"
-		print diff(s_example, "s_example", s, "s")
-
-
-	# Test: verify that xmldoc.Validate() succeeds
-
-	if not xmldoc.Validate():
-		failed_tests += 1
-		print "test case failed:"
-		print "xmldoc.Validate() failed."
-
-
-	# Test: does Element work both nested an non-nested?
-	s_test = """\
-<test>
-	<test:agent number="007">James Bond</test:agent>
-	<test:pet
-			nickname="Mei-Mei"
-			type="cat">Matrix</test:pet>
-</test>"""
-
-	class TestPet(Element):
-		def __init__(self, name=""):
-			Element.__init__(self, "test:pet", None, None)
-			self.text = name
-
-	class TestAgent(Element):
-		def __init__(self, name=""):
-			Element.__init__(self, "test:agent", None, None)
-			self.text = name
-
-	class Test(Element):
-		def __init__(self):
-			Element.__init__(self, "test", None, None)
-			self.test_agent = TestAgent()
-			self.test_pet = TestPet()
-
-	test = Test()
-	test.test_agent = "James Bond"
-	test.test_agent.attrs["number"] = "007"
-	test.test_pet = "Matrix"
-	test.test_pet.attrs["type"] = "cat"
-	test.test_pet.attrs["nickname"] = "Mei-Mei"
-
-	s = str(test)
-	if s_test != s:
-		failed_tests += 1
-		print "test case failed:"
-		print "test output doesn't match.  diff follows:"
-		print diff(s_test, "s_test", s, "s")
-
-
-	if failed_tests > 0:
-		print "self-test failed!"
-	else:
-		print "self-test successful."
-
-
-
-if __name__ == "__main__":
-	run_test_cases()
diff --git a/auquotidien/modules/pyatom/readme.txt b/auquotidien/modules/pyatom/readme.txt
deleted file mode 100644
index a311805..0000000
--- a/auquotidien/modules/pyatom/readme.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-PyAtom
-
-
-PyAtom is a Python library module I wrote to make it very easy to create
-an Atom syndication feed.
-
-http://atomenabled.org/developers/syndication/
-
-
-I have released PyAtom under The Academic Free License 2.1.  I intend to
-donate PyAtom to the Python Software Foundation.
-
-
-Notes on PyAtom:
-
-XML is best represented in a tree structure, and PyAtom is a set of
-classes that automatically manage the tree structure for the user.  The
-top level of an Atom feed is an XML "Feed" element with a "<feed>" tag;
-the Feed element has other elements nested inside it that describe the
-feed, and then it has 0 or more Entry elements, each of which has
-elements that describe the Entry.
-
-Take a look at RunPyAtomTestCases(), at the end of pyatom.py, for
-example code showing how to set up a feed with an entry.
-
-To create an XML document with a feed in it, the user does this:
-
-xmldoc = XMLDoc()
-feed = Feed()
-xmldoc.root_element = feed
-
-To assign an entry to a feed, the user just does this:
-
-feed.entries.append(entry)
-
-This adds "entry" to the internal list that keeps track of entries.
-"entry" is now nested inside "feed", which is nested inside "xmldoc".
-
-Later, when the user wants to save the XML in a file, the user can just
-do this:
-
-f = open("file.xml", "w")
-s = str(xmldoc)
-f.write(s)
-
-To make the string from xmldoc, the XMLDoc class walks through the XML
-elements nested inside xmldoc, asking each one to return its string.
-Each element that has other elements nested inside does the same thing.
-The whole tree is recursively walked, and the tags all return strings
-that are indented properly for their level in the tree.
-
-The classes that implement Atom in PyAtom just use the heck out of
-inheritance.  There are abstract base classes that implement broadly
-useful behavior, and lots of classes that just inherit and use this
-behavior; but there are plenty of places where the child classes
-overload the inherited behavior and do something different.  The way
-Python handles inheritance made this a joy to code up.
-
-
-
-If you have any questions about anything here, please contact me using
-this email address:
-
-pyatom@langri.com
diff --git a/auquotidien/modules/root.py b/auquotidien/modules/root.py
index 253d36b..cd1c71e 100644
--- a/auquotidien/modules/root.py
+++ b/auquotidien/modules/root.py
@@ -34,7 +34,6 @@ from wcs.qommon.tokens import Token
 from wcs.qommon.admin.emails import EmailsDirectory
 from wcs.qommon.admin.texts import TextsDirectory
 
-from .announces import Announce, AnnounceSubscription
 from .myspace import MyspaceDirectory
 from .payments import PublicPaymentDirectory
 from .payments_ui import InvoicesDirectory
@@ -134,493 +133,6 @@ class FormsRootDirectory(wcs.forms.root.RootDirectory):
         return r.getvalue()
 
 
-class AnnounceDirectory(Directory):
-    _q_exports = ['', 'edit', 'delete', 'email']
-
-    def __init__(self, announce):
-        self.announce = announce
-
-    def _q_index(self):
-        template.html_top(_('Announces to citizens'))
-        r = TemplateIO(html=True)
-
-        if self.announce.publication_time:
-            date_heading = '%s - ' % time.strftime(misc.date_format(), self.announce.publication_time)
-        else:
-            date_heading = ''
-
-        r += htmltext('<h3>%s%s</h3>') % (date_heading, self.announce.title)
-
-        r += htmltext('<p>')
-        r += self.announce.text
-        r += htmltext('</p>')
-
-        r += htmltext('<p>')
-        r += htmltext('<a href="../">%s</a>') % _('Back')
-        r += htmltext('</p>')
-        return r.getvalue()
-
-
-class AnnouncesDirectory(Directory):
-    _q_exports = ['', 'subscribe', 'email', 'atom', 'sms', 'emailconfirm',
-            'email_unsubscribe', 'sms_unsubscribe', 'smsconfirm', 'rawlist']
-
-    def _q_traverse(self, path):
-        get_response().breadcrumb.append(('announces/', _('Announces')))
-        return Directory._q_traverse(self, path)
-
-    def _q_index(self):
-        template.html_top(_('Announces to citizens'))
-        r = TemplateIO(html=True)
-        r += self.announces_list()
-        r += htmltext('<ul id="announces-links">')
-        r += htmltext('<li><a href="subscribe">%s</a></li>') % _('Receiving those Announces')
-        r += htmltext('</ul>')
-        return r.getvalue()
-
-    def _get_announce_subscription(self):
-        """ """
-        sub = None
-        if get_request().user:
-            subs = AnnounceSubscription.select(lambda x: x.user_id == get_request().user.id)
-            if subs:
-                sub = subs[0]
-        return sub
-
-    def rawlist(self):
-        get_response().filter = None
-        return self.announces_list()
-
-    def announces_list(self):
-        announces = Announce.get_published_announces()
-        if not announces:
-            raise errors.TraversalError()
-
-        # XXX: will need pagination someday
-        r = TemplateIO(html=True)
-        for item in announces:
-            r += htmltext('<div class="announce-item">\n')
-            r += htmltext('<h4>')
-            if item.publication_time:
-                r += time.strftime(misc.date_format(), item.publication_time)
-                r += ' - '
-            r += item.title
-            r += htmltext('</h4>\n')
-            r += htmltext('<p>\n')
-            r += item.text
-            r += htmltext('\n</p>\n')
-            r += htmltext('</div>\n')
-        return r.getvalue()
-
-
-    def sms(self):
-        sms_mode = get_cfg('sms', {}).get('mode', 'none')
-
-        if sms_mode == 'none':
-            raise errors.TraversalError()
-
-        get_response().breadcrumb.append(('sms', _('SMS')))
-        template.html_top(_('Receiving announces by SMS'))
-        r = TemplateIO(html=True)
-
-        if sms_mode == 'demo':
-            r += TextsDirectory.get_html_text('aq-sms-demo')
-        else:
-            announces_cfg = get_cfg('announces',{})
-            mobile_mask = announces_cfg.get('mobile_mask')
-            if mobile_mask:
-                mobile_mask = ' (' + mobile_mask + ')'
-            else:
-                mobile_mask = ''
-            form = Form(enctype='multipart/form-data')
-            form.add(StringWidget, 'mobile', title = _('Mobile number %s') % mobile_mask, size=12, required=True)
-            form.add_submit('submit', _('Subscribe'))
-            form.add_submit('cancel', _('Cancel'))
-
-            if form.get_submit() == 'cancel':
-                return redirect('subscribe')
-
-            if form.is_submitted() and not form.has_errors():
-                s = self.sms_submit(form)
-                if s == False:
-                    r += form.render()
-                else:
-                    return redirect("smsconfirm")
-            else:
-                r += form.render()
-        return r.getvalue()
-
-    def sms_submit(self, form):
-        mobile = form.get_widget("mobile").parse()
-        # clean the string, remove any extra character
-        mobile = re.sub('[^0-9+]','',mobile)
-        # if a mask was set, validate
-        announces_cfg = get_cfg('announces',{})
-        mobile_mask = announces_cfg.get('mobile_mask')
-        if mobile_mask:
-            mobile_regexp = re.sub('X','[0-9]', mobile_mask) + '$'
-            if not re.match(mobile_regexp, mobile):
-                form.set_error("mobile", _("Phone number invalid ! It must match ") + mobile_mask)
-                return False
-        if mobile.startswith('00'):
-            mobile = '+' + mobile[2:]
-        else:
-            # Default to france international prefix
-            if not mobile.startswith('+'):
-                mobile = re.sub("^0", "+33", mobile)
-        sub = self._get_announce_subscription()
-        if not sub:
-            sub = AnnounceSubscription()
-        if get_request().user:
-            sub.user_id = get_request().user.id
-
-        if mobile:
-            sub.sms = mobile
-
-        if not get_request().user:
-            sub.enabled = False
-
-        sub.store()
-
-        # Asking sms confirmation
-        token = Token(3 * 86400, 4, string.digits)
-        token.type = 'announces-subscription-confirmation'
-        token.subscription_id = sub.id
-        token.store()
-
-        message = _("Confirmation code : %s") % str(token.id)
-        sms_cfg = get_cfg('sms', {})
-        sender = sms_cfg.get('sender', 'AuQuotidien')[:11]
-        mode = sms_cfg.get('mode', 'none')
-        sms = SMS.get_sms_class(mode)
-        try:
-            sms.send(sender, [mobile], message)
-        except errors.SMSError, e:
-            get_logger().error(e)
-            form.set_error("mobile", _("Send SMS confirmation failed"))
-            sub.remove("sms")
-            return False
-
-    def smsconfirm(self):
-        template.html_top(_('Receiving announces by SMS confirmation'))
-        r = TemplateIO(html=True)
-        r += htmltext("<p>%s</p>") % _("You will receive a confirmation code by SMS.")
-        form = Form(enctype='multipart/form-data')
-        form.add(StringWidget, 'code', title = _('Confirmation code (4 characters)'), size=12, required=True)
-        form.add_submit('submit', _('Subscribe'))
-        form.add_submit('cancel', _('Cancel'))
-
-        if form.get_submit() == 'cancel':
-            return redirect('..')
-
-        if form.is_submitted() and not form.has_errors():
-            token = None
-            id = form.get_widget("code").parse()
-            try:
-                token = Token.get(id)
-            except KeyError:
-                form.set_error("code",  _('Invalid confirmation code.'))
-            else:
-                if token.type != 'announces-subscription-confirmation':
-                    form.set_error("code",  _('Invalid confirmation code.'))
-                else:
-                    sub = AnnounceSubscription.get(token.subscription_id)
-                    token.remove_self()
-                    sub.enabled_sms = True
-                    sub.store()
-                    return redirect('.')
-            r += form.render()
-        else:
-            r += form.render()
-
-        return r.getvalue()
-
-    def sms_unsubscribe(self):
-        sub = self._get_announce_subscription()
-
-        form = Form(enctype='multipart/form-data')
-        if not sub:
-            return redirect('..')
-
-        form.add_submit('submit', _('Unsubscribe'))
-        form.add_submit('cancel', _('Cancel'))
-
-        if form.get_submit() == 'cancel':
-            return redirect('..')
-
-        get_response().breadcrumb.append(('sms', _('SMS Unsubscription')))
-        template.html_top()
-        r = TemplateIO(html=True)
-
-        if form.is_submitted() and not form.has_errors():
-            if sub:
-                sub.remove("sms")
-
-            root_url = get_publisher().get_root_url()
-            r += htmltext('<p>')
-            r += _('You have been unsubscribed from announces')
-            r += htmltext('</p>')
-            r += htmltext('<a href="%s">%s</a>') % (root_url, _('Back Home'))
-        else:
-            r += htmltext('<p>')
-            r += _('Do you want to stop receiving announces by sms ?')
-            r += htmltext('</p>')
-            r += form.render()
-
-        return r.getvalue()
-
-
-    def subscribe(self):
-        get_response().breadcrumb.append(('subscribe', _('Subscription')))
-        template.html_top(_('Receiving Announces'))
-        r = TemplateIO(html=True)
-
-        r += TextsDirectory.get_html_text('aq-announces-subscription')
-
-        sub = self._get_announce_subscription()
-
-        r += htmltext('<ul id="announce-modes">')
-        if sub and sub.email:
-            r += htmltext(' <li>')
-            r += htmltext('<span id="par_mail">%s</span>') % _('Email (currently subscribed)')
-            r += htmltext(' <a href="email_unsubscribe" rel="popup">%s</a></li>') % _('Unsubscribe')
-        else:
-            r += htmltext(' <li><a href="email" id="par_mail" rel="popup">%s</a></li>') % _('Email')
-        if sub and sub.sms:
-            r += htmltext(' <li>')
-            if sub.enabled_sms:
-                r += htmltext('<span id="par_sms">%s</span>') % _('SMS %s (currently subscribed)') % sub.sms
-            else:
-                r += htmltext('<span id="par_sms">%s</span>') % _('SMS %s (currently not confirmed)') % sub.sms
-                r += htmltext(' <a href="smsconfirm" rel="popup">%s</a> ') % _('Confirmation')
-            r += htmltext(' <a href="sms_unsubscribe" rel="popup">%s</a></li>') % _('Unsubscribe')
-        elif get_cfg('sms', {}).get('mode', 'none') != 'none':
-            r += htmltext(' <li><a href="sms" id="par_sms">%s</a></li>') % _('SMS')
-        r += htmltext(' <li><a class="feed-link" href="atom" id="par_rss">%s</a>') % _('Feed')
-        r += htmltext('</ul>')
-        return r.getvalue()
-
-    def email(self):
-        get_response().breadcrumb.append(('email', _('Email Subscription')))
-        template.html_top(_('Receiving Announces by email'))
-        r = TemplateIO(html=True)
-
-        form = Form(enctype='multipart/form-data')
-        if get_request().user:
-            if get_request().user.email:
-                r += htmltext('<p>')
-                r += _('You are logged in and your email is %s, ok to subscribe ?') % \
-                        get_request().user.email
-                r += htmltext('</p>')
-                form.add_submit('submit', _('Subscribe'))
-            else:
-                r += htmltext('<p>')
-                r += _("You are logged in but there is no email address in your profile.")
-                r += htmltext('</p>')
-                form.add(EmailWidget, 'email', title = _('Email'), required = True)
-                form.add_submit('submit', _('Subscribe'))
-                form.add_submit('submit-remember', _('Subscribe and add this email to my profile'))
-        else:
-            r += htmltext('<p>')
-            r += _('FIXME will only be used for this purpose etc.')
-            r += htmltext('</p>')
-            form.add(EmailWidget, 'email', title = _('Email'), required = True)
-            form.add_submit('submit', _('Subscribe'))
-
-        form.add_submit('cancel', _('Cancel'))
-
-        if form.get_submit() == 'cancel':
-            return redirect('subscribe')
-
-        if form.is_submitted() and not form.has_errors():
-            s = self.email_submit(form)
-            if s is not False:
-                return s
-        else:
-            r += form.render()
-
-        return r.getvalue()
-
-    def email_submit(self, form):
-        sub = self._get_announce_subscription()
-        if not sub:
-            sub = AnnounceSubscription()
-
-        if get_request().user:
-            sub.user_id = get_request().user.id
-
-        if form.get_widget('email'):
-            sub.email = form.get_widget('email').parse()
-        elif get_request().user.email:
-            sub.email = get_request().user.email
-
-        if not get_request().user:
-            sub.enabled = False
-
-        sub.store()
-
-        if get_request().user:
-            r = TemplateIO(html=True)
-            root_url = get_publisher().get_root_url()
-            r += htmltext('<p>')
-            r += _('You have been subscribed to the announces.')
-            r += htmltext('</p>')
-            r += htmltext('<a href="%s">%s</a>') % (root_url, _('Back Home'))
-            return r.getvalue()
-
-        # asking email confirmation before subscribing someone
-        token = Token(3 * 86400)
-        token.type = 'announces-subscription-confirmation'
-        token.subscription_id = sub.id
-        token.store()
-        data = {
-            'confirm_url': get_request().get_url() + 'confirm?t=%s&a=cfm' % token.id,
-            'cancel_url': get_request().get_url() + 'confirm?t=%s&a=cxl' % token.id,
-            'time': misc.localstrftime(time.localtime(token.expiration)),
-        }
-
-        emails.custom_template_email('announces-subscription-confirmation',
-                data, sub.email, exclude_current_user = False)
-
-        r = TemplateIO(html=True)
-        root_url = get_publisher().get_root_url()
-        r += htmltext('<p>')
-        r += _('You have been sent an email for confirmation')
-        r += htmltext('</p>')
-        r += htmltext('<a href="%s">%s</a>') % (root_url, _('Back Home'))
-        return r.getvalue()
-
-    def emailconfirm(self):
-        tokenv = get_request().form.get('t')
-        action = get_request().form.get('a')
-
-        root_url = get_publisher().get_root_url()
-
-        try:
-            token = Token.get(tokenv)
-        except KeyError:
-            return template.error_page(
-                    _('The token you submitted does not exist, has expired, or has been cancelled.'),
-                    continue_to = (root_url, _('home page')))
-
-        if token.type != 'announces-subscription-confirmation':
-            return template.error_page(
-                    _('The token you submitted is not appropriate for the requested task.'),
-                    continue_to = (root_url, _('home page')))
-
-        sub = AnnounceSubscription.get(token.subscription_id)
-
-        if action == 'cxl':
-            r = TemplateIO(html=True)
-            root_url = get_publisher().get_root_url()
-            template.html_top(_('Email Subscription'))
-            r += htmltext('<h1>%s</h1>') % _('Request Cancelled')
-            r += htmltext('<p>%s</p>') % _('The request for subscription has been cancelled.')
-            r += htmltext('<p>')
-            r += htmltext(_('Continue to <a href="%s">home page</a>') % root_url)
-            r += htmltext('</p>')
-            token.remove_self()
-            sub.remove_self()
-            return r.getvalue()
-
-        if action == 'cfm':
-            token.remove_self()
-            sub.enabled = True
-            sub.store()
-            r = TemplateIO(html=True)
-            root_url = get_publisher().get_root_url()
-            template.html_top(_('Email Subscription'))
-            r += htmltext('<h1>%s</h1>') % _('Subscription Confirmation')
-            r += htmltext('<p>%s</p>') % _('Your subscription to announces is now effective.')
-            r += htmltext('<p>')
-            r += htmltext(_('Continue to <a href="%s">home page</a>') % root_url)
-            r += htmltext('</p>')
-            return r.getvalue()
-
-    def atom(self):
-        response = get_response()
-        response.set_content_type('application/atom+xml')
-
-        from pyatom import pyatom
-        xmldoc = pyatom.XMLDoc()
-        feed = pyatom.Feed()
-        xmldoc.root_element = feed
-        feed.title = get_cfg('misc', {}).get('sitename') or 'Publik'
-        feed.id = get_request().get_url()
-
-        author_email = get_cfg('emails', {}).get('reply_to')
-        if not author_email:
-            author_email = get_cfg('emails', {}).get('from')
-        if author_email:
-            feed.authors.append(pyatom.Author(author_email))
-
-        announces = Announce.get_published_announces()
-
-        if announces and announces[0].modification_time:
-            feed.updated = misc.format_time(announces[0].modification_time,
-                        '%(year)s-%(month)02d-%(day)02dT%(hour)02d:%(minute)02d:%(second)02dZ',
-                        gmtime = True)
-        feed.links.append(pyatom.Link(get_request().get_url(1) + '/'))
-
-        for item in announces:
-            entry = item.get_atom_entry()
-            if entry:
-                feed.entries.append(entry)
-
-        return str(feed)
-
-    def email_unsubscribe(self):
-        sub = self._get_announce_subscription()
-
-        form = Form(enctype='multipart/form-data')
-        if not sub:
-            form.add(EmailWidget, 'email', title = _('Email'), required = True)
-
-        form.add_submit('submit', _('Unsubscribe'))
-        form.add_submit('cancel', _('Cancel'))
-
-        if form.get_submit() == 'cancel':
-            return redirect('..')
-
-        get_response().breadcrumb.append(('email', _('Email Unsubscription')))
-        template.html_top()
-        r = TemplateIO(html=True)
-
-        if form.is_submitted() and not form.has_errors():
-            if sub:
-                sub.remove("email")
-            else:
-                email = form.get_widget('email').parse()
-                for s in AnnounceSubscription.select():
-                    if s.email == email:
-                        s.remove("email")
-
-            root_url = get_publisher().get_root_url()
-            r += htmltext('<p>')
-            r += _('You have been unsubscribed from announces')
-            r += htmltext('</p>')
-            r += htmltext('<a href="%s">%s</a>') % (root_url, _('Back Home'))
-
-        else:
-            r += htmltext('<p>')
-            r += _('Do you want to stop receiving announces by email?')
-            r += htmltext('</p>')
-            r += form.render()
-
-        return r.getvalue()
-
-    def _q_lookup(self, component):
-        try:
-            announce = Announce.get(component)
-        except KeyError:
-            raise errors.TraversalError()
-
-        if announce.hidden:
-            raise errors.TraversalError()
-
-        get_response().breadcrumb.append((str(announce.id), announce.title))
-        return AnnounceDirectory(announce)
-
 OldRegisterDirectory = wcs.root.RegisterDirectory
 
 class AlternateRegisterDirectory(OldRegisterDirectory):
@@ -757,7 +269,6 @@ class AlternateRootDirectory(OldRootDirectory):
     _q_exports = ['', 'admin', 'backoffice', 'forms', 'login', 'logout',
             'saml', 'register', 'ident', 'afterjobs',
             ('informations-editeur', 'informations_editeur'),
-            ('announces', 'announces_dir'),
             'myspace', 'services', 'categories', 'user',
             ('tmp-upload', 'tmp_upload'), 'json', '__version__',
             'themes', 'pages', 'payment', 'invoices', 'roles',
@@ -765,7 +276,6 @@ class AlternateRootDirectory(OldRootDirectory):
             ('reload-top', 'reload_top'), 'static',
             ('i18n.js', 'i18n_js'), 'actions',]
 
-    announces_dir = AnnouncesDirectory()
     register = AlternateRegisterDirectory()
     login = AlternateLoginDirectory()
     ident = AlternateIdentDirectory()
@@ -909,7 +419,6 @@ class AlternateRootDirectory(OldRootDirectory):
         r += self.myspace_snippet()
         r += self.box_services(position='2nd')
         r += self.consultations()
-        r += self.announces()
         r += htmltext('</div>')
 
         user = get_request().user
@@ -1105,34 +614,6 @@ class AlternateRootDirectory(OldRootDirectory):
     def has_anonymous_access_codes(self):
         return any((x for x in FormDef.select() if x.enable_tracking_codes))
 
-    def announces(self):
-        announces = Announce.get_published_announces()
-        if not announces:
-            return
-
-        r = TemplateIO(html=True)
-        r += htmltext('<div id="announces">')
-        r += htmltext('<h3>%s</h3>') % _('Announces to citizens')
-        for item in announces[:3]:
-            r += htmltext('<div class="announce-item">')
-            r += htmltext('<h4>')
-            if item.publication_time:
-                r += time.strftime(misc.date_format(), item.publication_time)
-                r += ' - '
-            r += item.title
-            r += htmltext('</h4>')
-            r += htmltext('<p>')
-            r += item.text
-            r += htmltext('</p>')
-            r += htmltext('</div>')
-
-        r += htmltext('<ul id="announces-links">')
-        r += htmltext('<li><a href="announces/subscribe">%s</a></li>') % _('Receiving those Announces')
-        r += htmltext('<li><a href="announces/">%s</a></li>') % _('Previous Announces')
-        r += htmltext('</ul>')
-        r += htmltext('</div>')
-        return r.getvalue()
-
     def myspace_snippet(self):
         r = TemplateIO(html=True)
         r += htmltext('<div id="myspace">')
@@ -1183,41 +664,6 @@ get_publisher_class().after_login_url = 'myspace/'
 get_publisher_class().use_sms_feature = True
 
 
-EmailsDirectory.register('announces-subscription-confirmation',
-        N_('Confirmation of Announces Subscription'),
-        N_('Available variables: change_url, cancel_url, time, sitename'),
-        default_subject = N_('Announce Subscription Request'),
-        default_body = N_("""\
-You have (or someone impersonating you has) requested to subscribe to
-announces from [sitename].  To confirm this request, visit the
-following link:
-
-[confirm_url]
-
-If you are not the person who made this request, or you wish to cancel
-this request, visit the following link:
-
-[cancel_url]
-
-If you do nothing, the request will lapse after 3 days (precisely on
-[time]).
-"""))
-
-
-TextsDirectory.register('aq-announces-subscription',
-        N_('Text on announces subscription page'),
-        default = N_('''\
-<p>
-FIXME
-'</p>'''))
-
-TextsDirectory.register('aq-sms-demo',
-        N_('Text when subscribing to announces SMS and configured as demo'),
-        default = N_('''
-<p>
-Receiving announces by SMS is not possible in this demo
-</p>'''))
-
 TextsDirectory.register('aq-editor-info', N_('Editor Informations'))
 TextsDirectory.register('aq-accessibility', N_('Accessibility Statement'))
 TextsDirectory.register('aq-contact', N_('Contact Information'))
diff --git a/auquotidien/modules/template.py b/auquotidien/modules/template.py
index 3b2a3c9..534da82 100644
--- a/auquotidien/modules/template.py
+++ b/auquotidien/modules/template.py
@@ -43,11 +43,6 @@ def render_response(publisher, body):
     elif section == 'consultations':
         section_title = '<h2 id="consultations">%s</h2>\n' % _('Consultations')
         response.filter['bigdiv'] = 'rub_consultation'
-    elif section == 'announces':
-        response.filter['bigdiv'] = 'rub_annonce'
-        section_title = '<h2 id="announces">%s</h2>\n' % _('Announces to citizens')
-        if page_title == _('Announces to citizens'):
-            page_title = ''
     elif section and len(section) > 1:
         # XXX: this works but is not efficient
         if Category.has_urlname(section):
-- 
2.24.0

