Update of /cvsroot/mailman/mailman/Mailman/Cgi
In directory usw-pr-cvs1:/tmp/cvs-serv15183/Mailman/Cgi
Modified Files:
options.py
Log Message:
Good suggestion by Fred Drake: the delivery of MIME vs. plain text
should be settable globally, since you're probably using the same MUA
for all your list traffic. Specifically:
main(): Define a Global class as a bag of attributes, and use this
instead of the separate global_* variables. Added the extraction of
the mime-globally form variable which sets the MIME digest setting
globally. Always call global_options(), which now does the "do we
need to do anything" test before locking the list.
options_page(): Replace <mm-global-mime-button> with a checkbox for
setting the MIME/plain text flag.
global_options(): Signature changed to take an instance. Make sure
that all non _* attributes have a non-None value before locking the
list. Also, set the DisableMime member option.
Index: options.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Cgi/options.py,v
retrieving revision 2.31
retrieving revision 2.32
diff -C2 -d -r2.31 -r2.32
*** options.py 22 Mar 2002 20:45:29 -0000 2.31
--- options.py 22 Mar 2002 23:09:04 -0000 2.32
***************
*** 505,511 ****
mlist.Unlock()
# The enable/disable option and the password remind option may have
# their global flags sets.
- global_enable = None
if cgidata.getvalue('deliver-globally'):
# Yes, this is inefficient, but the list is so small it shouldn't
--- 505,519 ----
mlist.Unlock()
+ # A bag of attributes for the global options
+ class Global:
+ enable = None
+ remind = None
+ nodupes = None
+ mime = None
+
+ globalopts = Global()
+
# The enable/disable option and the password remind option may have
# their global flags sets.
if cgidata.getvalue('deliver-globally'):
# Yes, this is inefficient, but the list is so small it shouldn't
***************
*** 513,538 ****
for flag, newval in newvals:
if flag == mm_cfg.DisableDelivery:
! global_enable = newval
break
- global_remind = None
if cgidata.getvalue('remind-globally'):
for flag, newval in newvals:
if flag == mm_cfg.SuppressPasswordReminder:
! global_remind = newval
break
- global_nodupes = None
if cgidata.getvalue('nodupes-globally'):
for flag, newval in newvals:
if flag == mm_cfg.DontReceiveDuplicates:
! global_nodupes = newval
break
! if global_enable is not None or global_remind is not None \
! or global_nodupes is not None:
! for gmlist in lists_of_member(mlist, user):
! global_options(gmlist, user,
! global_enable, global_remind, global_nodupes)
# Now print the results
--- 521,547 ----
for flag, newval in newvals:
if flag == mm_cfg.DisableDelivery:
! globalopts.enable = newval
break
if cgidata.getvalue('remind-globally'):
for flag, newval in newvals:
if flag == mm_cfg.SuppressPasswordReminder:
! globalopts.remind = newval
break
if cgidata.getvalue('nodupes-globally'):
for flag, newval in newvals:
if flag == mm_cfg.DontReceiveDuplicates:
! globalopts.nodupes = newval
break
! if cgidata.getvalue('mime-globally'):
! for flag, newval in newvals:
! if flag == mm_cfg.DisableMime:
! globalopts.mime = newval
! break
!
! for gmlist in lists_of_member(mlist, user):
! global_options(gmlist, user, globalopts)
# Now print the results
***************
*** 588,591 ****
--- 597,602 ----
replacements['<mm-mime-digests-button>'] = mlist.FormatOptionButton(
mm_cfg.DisableMime, 0, user)
+ replacements['<mm-global-mime-button>'] = (
+ CheckBox('mime-globally', 1, checked=0).Format())
replacements['<mm-delivery-enable-button>'] = mlist.FormatOptionButton(
mm_cfg.DisableDelivery, 0, user)
***************
*** 830,834 ****
! def global_options(mlist, user, global_enable, global_remind, global_nodupes):
def sigterm_handler(signum, frame, mlist=mlist):
# Make sure the list gets unlocked...
--- 841,854 ----
! def global_options(mlist, user, globalopts):
! # Is there anything to do?
! for attr in dir(globalopts):
! if attr.startswith('_'):
! continue
! if getattr(globalopts, attr) is not None:
! break
! else:
! return
!
def sigterm_handler(signum, frame, mlist=mlist):
# Make sure the list gets unlocked...
***************
*** 845,858 ****
signal.signal(signal.SIGTERM, sigterm_handler)
! if global_enable is not None:
! mlist.setDeliveryStatus(user, global_enable)
! if global_remind is not None:
mlist.setMemberOption(user, mm_cfg.SuppressPasswordReminder,
! global_remind)
! if global_nodupes is not None:
mlist.setMemberOption(user, mm_cfg.DontReceiveDuplicates,
! global_nodupes)
mlist.Save()
--- 865,881 ----
signal.signal(signal.SIGTERM, sigterm_handler)
! if globalopts.enable is not None:
! mlist.setDeliveryStatus(user, globalopts.enable)
! if globalopts.remind is not None:
mlist.setMemberOption(user, mm_cfg.SuppressPasswordReminder,
! globalopts.remind)
! if globalopts.nodupes is not None:
mlist.setMemberOption(user, mm_cfg.DontReceiveDuplicates,
! globalopts.nodupes)
!
! if globalopts.mime is not None:
! mlist.setMemberOption(user, mm_cfg.DisableMime, globalopts.mime)
mlist.Save()
_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins