summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw2000-06-23 04:48:51 +0000
committerbwarsaw2000-06-23 04:48:51 +0000
commitbc0120b64d4e9054aa68a13bc7f35097c5c453ef (patch)
tree0e75b0fede71a20e0ec8678dc33d2d21e8059c50
parentd8768ceed998f9b98d61aa1810a2e12639e656d3 (diff)
downloadmailman-bc0120b64d4e9054aa68a13bc7f35097c5c453ef.tar.gz
mailman-bc0120b64d4e9054aa68a13bc7f35097c5c453ef.tar.zst
mailman-bc0120b64d4e9054aa68a13bc7f35097c5c453ef.zip
Hackish support for `volatile' properties in the web interface.
I.e. these are selections that can be presented in an admin page, but don't directly affect the value of a saved list attribute. This is used for a "Mass Catchup" button in the gateway category. Volatile property convention is that the name starts with an underscore. Specifically, GetItemGuiValue(): For Radios and Toggles, only do a getattr() of varname if the name does not start with an underscore. Otherwise default the checked value to 0. This is bogus because it would be better to take the default value from the property description, but that's too much of an API change for now. ChangeOptions(): If the property name starts with an underscore, do something different. This has to check for specific volatile parameters, of which the only one currently is `_mass_catchup'. If that's the property and the value is true, then set usenet_watermark to None, which is the signal to gate_news to do a mass catchup (i.e. set the watermark to the last article currently on the server). Note that the GatewayManager category used to always do a mass catchup when gateway_to_mail was toggled. This isn't always the right thing, so this change allows the admin to explicitly do a catch up.
-rw-r--r--Mailman/Cgi/admin.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/Mailman/Cgi/admin.py b/Mailman/Cgi/admin.py
index 466f2a04f..38634cfed 100644
--- a/Mailman/Cgi/admin.py
+++ b/Mailman/Cgi/admin.py
@@ -472,7 +472,11 @@ def GetItemGuiValue(mlist, kind, varname, params):
# for the fact that there is one fewer option. correspondingly,
# we alter the value back in the change options function -scott
#
- checked = getattr(mlist, varname)
+ # TBD: this is an ugly ugly hack.
+ if varname[0] == '_':
+ checked = 0
+ else:
+ checked = getattr(mlist, varname)
if varname == 'subscribe_policy' and not mm_cfg.ALLOW_OPEN_SUBSCRIBE:
checked = checked - 1
return RadioButtonArray(varname, params, checked)
@@ -831,7 +835,17 @@ def ChangeOptions(mlist, category, cgi_info, document):
else:
val = cgi_info[property].value
value = GetValidValue(mlist, property, kind, val, deps)
- if getattr(mlist, property) <> value:
+ #
+ # This is an ugly, ugly hack
+ if property[0] == '_':
+ # TBD: When turning on usenet->mail gating we want to
+ # automatically catch up the newsgroup otherwise the mailing
+ # list will suddently get flooded. There should be a much
+ # better way to do this (or for the admin to specify they want
+ # this).
+ if property == '_mass_catchup' and value:
+ mlist.usenet_watermark = None
+ elif getattr(mlist, property) <> value:
# TBD: Ensure that mlist.real_name differs only in letter
# case. Otherwise a security hole can potentially be opened
# when using an external archiver. This seems ad-hoc and
@@ -843,13 +857,6 @@ def ChangeOptions(mlist, category, cgi_info, document):
changed! It must differ from the list's name by case
only.<p>""")
continue
- # TBD: When turning on usenet->mail gating we want to
- # automatically catch up the newsgroup otherwise the mailing
- # list will suddently get flooded. There should be a much
- # better way to do this (or for the admin to specify they want
- # this).
- elif property == 'gateway_to_mail':
- mlist.usenet_watermark = None
setattr(mlist, property, value)
#
# mass subscription processing for members category