Esempio n. 1
0
    def get(self):
        self.response.headers['Content-Type'] = 'text/html'

        template_values = {
            'subscriptions': {},
            'url_prefix': URL_PREFIX
            }

        jid = users.get_current_user().email()
        template_values['subscriptions'][jid] = filters.subscriptions()[jid]

        self.response.out.write(render_to_string('filters.html',
                                                 template_values))
Esempio n. 2
0
    def delete_command(self, message=None):
        """Command handler for /delete i

        i -- the index from the filters' list

        Deletes the filter given by the index.
        """
        jid = message.sender.split('/')[0]

        try:
            i = int(message.arg)
            key = filters.subscriptions()[jid][i-1][1]
        except ValueError, IndexError:
            message.reply('Invalid index: %s' % message.arg or 'None')
Esempio n. 3
0
    def filters_command(self, message=None):
        """Command handler for /filters
        
        Shows a list of the sender's filters.
        """
        jid = _sender_jid(message)

        template_values = {
            'jid' : jid,
            'filters' : filters.subscriptions()[jid]
            }

        message.reply(render_to_string('filters.plain',
                                       template_values))