def _setValue(self, mlist, property, val, doc): # Watch for the special, immediate action attributes if property == "_new_volume" and val: mlist.bump_digest_volume() volume = mlist.volume number = mlist.next_digest_number doc.AddItem( _( """The next digest will be sent as volume %(volume)s, number %(number)s""" ) ) elif property == "_send_digest_now" and val: status = mlist.send_digest_now() if status: doc.AddItem(_("""A digest has been sent.""")) else: doc.AddItem(_("""There was no digest to send.""")) else: # Everything else... if property in ("digest_header", "digest_footer"): val = self._convertString(mlist, property, ALLOWEDS, val, doc) if val is None: # There was a problem, so don't set it return GUIBase._setValue(self, mlist, property, val, doc)
def _setValue(self, mlist, property, val, doc): # If we're changing the list's preferred language, change the I18N # context as well if property == 'preferred_language': i18n.set_language(val) doc.set_language(val) GUIBase._setValue(self, mlist, property, val, doc)
def _setValue(self, mlist, property, val, doc): # Watch for the special, immediate action attributes if property == '_mass_catchup' and val: mlist.usenet_watermark = None doc.AddItem(_('Mass catchup completed')) else: GUIBase._setValue(self, mlist, property, val, doc)
def _setValue(self, mlist, property, val, doc): # Do value conversion from web representation to internal # representation. try: if property == 'bounce_processing': val = int(val) elif property == 'bounce_score_threshold': val = float(val) elif property == 'bounce_info_stale_after': val = days(int(val)) elif property == 'bounce_you_are_disabled_warnings': val = int(val) elif property == 'bounce_you_are_disabled_warnings_interval': val = days(int(val)) elif property == 'bounce_notify_owner_on_disable': val = int(val) elif property == 'bounce_notify_owner_on_removal': val = int(val) except ValueError: doc.addError( _("""Bad value for <a href="?VARHELP=bounce/%(property)s" >%(property)s</a>: %(val)s"""), tag = _('Error: ')) return GUIBase._setValue(self, mlist, property, val, doc)
def _setValue(self, mlist, property, val, doc): if property in ('filter_mime_types', 'pass_mime_types'): types = [] for spectype in [s.strip() for s in val.splitlines()]: ok = 1 slashes = spectype.count('/') if slashes == 0 and not spectype: ok = 0 elif slashes == 1: maintype, subtype = [ s.strip().lower() for s in spectype.split('/') ] if not maintype or not subtype: ok = 0 elif slashes > 1: ok = 0 if not ok: doc.addError(_('Bad MIME type ignored: %(spectype)s')) else: types.append(spectype.strip().lower()) if property == 'filter_mime_types': mlist.filter_mime_types = types elif property == 'pass_mime_types': mlist.pass_mime_types = types elif property in ('filter_filename_extensions', 'pass_filename_extensions'): fexts = [] for ext in [s.strip() for s in val.splitlines()]: fexts.append(ext.lower()) if property == 'filter_filename_extensions': mlist.filter_filename_extensions = fexts elif property == 'pass_filename_extensions': mlist.pass_filename_extensions = fexts else: GUIBase._setValue(self, mlist, property, val, doc)
def _setValue(self, mlist, property, val, doc): # Do value conversion from web representation to internal # representation. try: if property == 'bounce_processing': val = int(val) elif property == 'bounce_score_threshold': val = float(val) elif property == 'bounce_info_stale_after': val = days(int(val)) elif property == 'bounce_you_are_disabled_warnings': val = int(val) elif property == 'bounce_you_are_disabled_warnings_interval': val = days(int(val)) elif property == 'bounce_notify_owner_on_disable': val = int(val) elif property == 'bounce_notify_owner_on_removal': val = int(val) except ValueError: doc.addError( _("""Bad value for <a href="?VARHELP=bounce/%(property)s" >%(property)s</a>: %(val)s"""), tag=_('Error: ')) return GUIBase._setValue(self, mlist, property, val, doc)
def _setValue(self, mlist, property, val, doc): if property in ('filter_mime_types', 'pass_mime_types'): types = [] for spectype in [s.strip() for s in val.splitlines()]: ok = 1 slashes = spectype.count('/') if slashes == 0 and not spectype: ok = 0 elif slashes == 1: maintype, subtype = [s.strip().lower() for s in spectype.split('/')] if not maintype or not subtype: ok = 0 elif slashes > 1: ok = 0 if not ok: doc.addError(_('Bad MIME type ignored: %(spectype)s')) else: types.append(spectype.strip().lower()) if property == 'filter_mime_types': mlist.filter_mime_types = types elif property == 'pass_mime_types': mlist.pass_mime_types = types elif property in ('filter_filename_extensions', 'pass_filename_extensions'): fexts = [] for ext in [s.strip() for s in val.splitlines()]: fexts.append(ext.lower()) if property == 'filter_filename_extensions': mlist.filter_filename_extensions = fexts elif property == 'pass_filename_extensions': mlist.pass_filename_extensions = fexts else: GUIBase._setValue(self, mlist, property, val, doc)
def _setValue(self, mlist, property, val, doc): alloweds = list(ALLOWEDS) if mlist.personalize: alloweds.extend(PERSONALIZED_ALLOWEDS) if property in ('msg_header', 'msg_footer'): val = self._convertString(mlist, property, alloweds, val, doc) if val is None: # There was a problem, so don't set it return GUIBase._setValue(self, mlist, property, val, doc)
def _setValue(self, mlist, property, val, doc): if property == 'real_name' and \ val.lower() != mlist.internal_name().lower(): # These values can't differ by other than case doc.addError(_("""<b>real_name</b> attribute not changed! It must differ from the list's name by case only.""")) elif property == 'new_member_options': # Get current value because there are valid bits not in OPTIONS. # If we're the admin CGI, we then process the bits in OPTIONS, # turning them on or off as appropriate. Otherwise we process all # the bits in mm_cfg.OPTINFO so that config_list can set and reset # them. newopts = mlist.new_member_options if isinstance(doc, Document): opts = OPTIONS else: opts = mm_cfg.OPTINFO for opt in opts: bitfield = mm_cfg.OPTINFO[opt] if opt in val: newopts |= bitfield else: newopts &= ~bitfield mlist.new_member_options = newopts elif property == 'subject_prefix': # Convert any html entities to Unicode mlist.subject_prefix = Utils.canonstr( val, mlist.preferred_language) elif property == 'info': if val != mlist.info: if Utils.suspiciousHTML(val): doc.addError(_("""The <b>info</b> attribute you saved contains suspicious HTML that could potentially expose your users to cross-site scripting attacks. This change has therefore been rejected. If you still want to make these changes, you must have shell access to your Mailman server. This change can be made with bin/withlist or with bin/config_list by setting mlist.info. """)) else: mlist.info = val elif property == 'admin_member_chunksize' and (val < 1 or not isinstance(val, int)): doc.addError(_("""<b>admin_member_chunksize</b> attribute not changed! It must be an integer > 0.""")) elif property == 'host_name': try: Utils.ValidateEmail('user@' + val) except Errors.EmailAddressError: doc.addError(_("""<b>host_name</b> attribute not changed! It must be a valid domain name.""")) else: GUIBase._setValue(self, mlist, property, val, doc) else: GUIBase._setValue(self, mlist, property, val, doc)
def _setValue(self, mlist, property, val, doc): # Handle these specially because we may need to convert to/from # external $-string representation. if property in ('autoresponse_postings_text', 'autoresponse_admin_text', 'autoresponse_request_text'): val = self._convertString(mlist, property, ALLOWEDS, val, doc) if val is None: # There was a problem, so don't set it return GUIBase._setValue(self, mlist, property, val, doc)
def _setValue(self, mlist, property, val, doc): if property == 'real_name' and \ val.lower() <> str(mlist.real_name.lower()): # These values can't differ by other than case doc.addError(_("""<b>real_name</b> attribute not changed! It must differ from the list's name by case only.""")) elif property == 'new_member_options': # Get current value because there are valid bits not in OPTIONS. # If we're the admin CGI, we then process the bits in OPTIONS, # turning them on or off as appropriate. Otherwise we process all # the bits in mm_cfg.OPTINFO so that config_list can set and reset # them. newopts = mlist.new_member_options if isinstance(doc, Document): opts = OPTIONS else: opts = mm_cfg.OPTINFO for opt in opts: bitfield = mm_cfg.OPTINFO[opt] if opt in val: newopts |= bitfield else: newopts &= ~bitfield mlist.new_member_options = newopts elif property == 'subject_prefix': # Convert any html entities to Unicode mlist.subject_prefix = Utils.canonstr( val, mlist.preferred_language) elif property == 'info': if val <> mlist.info: if 0 and Utils.suspiciousHTML(val): doc.addError(_("""The <b>info</b> attribute you saved contains suspicious HTML that could potentially expose your users to cross-site scripting attacks. This change has therefore been rejected. If you still want to make these changes, you must have shell access to your Mailman server. This change can be made with bin/withlist or with bin/config_list by setting mlist.info. """)) else: mlist.info = val elif property == 'admin_member_chunksize' and (val < 1 or not isinstance(val, IntType)): doc.addError(_("""<b>admin_member_chunksize</b> attribute not changed! It must be an integer > 0.""")) else: GUIBase._setValue(self, mlist, property, val, doc)
def _setValue(self, mlist, property, val, doc): # Watch for the special, immediate action attributes if property == '_new_volume' and val: mlist.bump_digest_volume() volume = mlist.volume number = mlist.next_digest_number doc.AddItem( _("""The next digest will be sent as volume %(volume)s, number %(number)s""")) elif property == '_send_digest_now' and val: status = mlist.send_digest_now() if status: doc.AddItem(_("""A digest has been sent.""")) else: doc.AddItem(_("""There was no digest to send.""")) else: # Everything else... if property in ('digest_header', 'digest_footer'): val = self._convertString(mlist, property, ALLOWEDS, val, doc) if val is None: # There was a problem, so don't set it return GUIBase._setValue(self, mlist, property, val, doc)