~ubuntu-branches/ubuntu/hardy/mailman/hardy-updates

« back to all changes in this revision

Viewing changes to Mailman/Cgi/confirm.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-07-03 16:59:25 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060703165925-175ubna955u796c0
Tags: 0:2.1.8-1ubuntu1
* Merge to Debian; remaining Ubuntu changes:
  - debian/mailman.init: Create /var/{run,lock}/mailman.
  - debian/control: exim4 -> postfix.
* debian/control: Dependency fix: apache -> apache2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2001-2004 by the Free Software Foundation, Inc.
 
1
# Copyright (C) 2001-2005 by the Free Software Foundation, Inc.
2
2
#
3
3
# This program is free software; you can redistribute it and/or
4
4
# modify it under the terms of the GNU General Public License
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 
16
# USA.
16
17
 
17
18
"""Confirm a pending action via URL."""
18
19
 
308
309
 
309
310
 
310
311
def subscription_cancel(mlist, doc, cookie):
311
 
    # Discard this cookie
312
 
    userdesc = mlist.pend_confirm(cookie)[1]
 
312
    mlist.Lock()
 
313
    try:
 
314
        # Discard this cookie
 
315
        userdesc = mlist.pend_confirm(cookie)[1]
 
316
    finally:
 
317
        mlist.Unlock()
313
318
    lang = userdesc.language
314
319
    i18n.set_language(lang)
315
320
    doc.set_language(lang)
366
371
            address that has already been unsubscribed.'''))
367
372
        except Errors.MMAlreadyAMember:
368
373
            doc.addError(_("You are already a member of this mailing list!"))
 
374
        except Errors.MembershipIsBanned:
 
375
            owneraddr = mlist.GetOwnerEmail()
 
376
            doc.addError(_("""You are currently banned from subscribing to
 
377
            this list.  If you think this restriction is erroneous, please
 
378
            contact the list owners at %(owneraddr)s."""))
369
379
        except Errors.HostileSubscriptionError:
370
380
            doc.addError(_("""\
371
381
            You were not invited to this mailing list.  The invitation has
513
523
            bad_confirmation(doc, _('''Invalid confirmation string.  It is
514
524
            possible that you are attempting to confirm a request for an
515
525
            address that has already been unsubscribed.'''))
 
526
        except Errors.MembershipIsBanned:
 
527
            owneraddr = mlist.GetOwnerEmail()
 
528
            realname = mlist.real_name
 
529
            doc.addError(_("""%(newaddr)s is banned from subscribing to the
 
530
            %(realname)s list.  If you think this restriction is erroneous,
 
531
            please contact the list owners at %(owneraddr)s."""))
516
532
        else:
517
533
            # The response
518
534
            listname = mlist.real_name
777
793
        <a href="%(listinfourl)s">list information page</a>.""")])
778
794
        return
779
795
 
780
 
    date = time.strftime('%A, %B %d, %Y', info.date + (0,) * 6)
 
796
    date = time.strftime('%A, %B %d, %Y',
 
797
                         time.localtime(time.mktime(info.date + (0,)*6)))
781
798
    daysleft = int(info.noticesleft *
782
799
                   mlist.bounce_you_are_disabled_warnings_interval /
783
800
                   mm_cfg.days(1))