Logo Search packages:      
Sourcecode: zope-formulator version File versions  Download package

def Formulator::Form::ZMIForm::manage_settings (   self,
  REQUEST 
)

Change settings in settings screen.

Definition at line 812 of file Form.py.

00812                                       :
        """Change settings in settings screen.
        """
        try:
            result = self.settings_form.validate_all(REQUEST)
        except FormValidationError, e:
            message = "Validation error(s).<br />" + string.join(
                map(lambda error: "%s: %s" % (error.field.get_value('title'),
                                              error.error_text), e.errors), "<br />")
            return self.formSettings(self, REQUEST,
                                     manage_tabs_message=message)
        # if we need to switch encoding, get xml representation before setting
        if result['unicode_mode'] != self.unicode_mode:
            xml = self.get_xml()
        # now set the form settings

        # convert XML to or from unicode mode if necessary
        unicode_message = None
        if result['unicode_mode'] != self.unicode_mode:
            # get XML (using current stored_encoding)
            xml = self.get_xml()

            # now save XML data again using specified encoding
            if result['unicode_mode']:
                encoding = 'unicode'
                unicode_message = "Converted to unicode."
            else:
                encoding = result['stored_encoding']
                unicode_message = ("Converted from unicode to %s encoding" %
                                   encoding)
            self.set_xml(xml, encoding)

        # now set the form settings
        for key, value in result.items():
            setattr(self, key, value)
        message="Settings changed."
        if unicode_message is not None:
            message = message + ' ' + unicode_message
        return self.formSettings(self, REQUEST,
                                 manage_tabs_message=message)

    security.declareProtected('Change Formulator Forms', 'manage_refresh')
    def manage_refresh(self, REQUEST):


Generated by  Doxygen 1.6.0   Back to index