Example #1
0
    def settings_appearance_update(self, id, format='html'):
        c.page_instance = self._get_current_instance(id)
        require.instance.edit(c.page_instance)

        # delete the logo if the button was pressed and exit
        if 'delete_logo' in self.form_result:
            logo.delete(c.page_instance)
            return self.settings_result(
                True, c.page_instance, 'appearance',
                message=_(u'The logo has been deleted.'))

        # process the normal form
        updated = update_attributes(c.page_instance, self.form_result, ['css'])
        try:
            # fixme: show logo errors in the form
            if ('logo' in request.POST and
                hasattr(request.POST.get('logo'), 'file') and
                request.POST.get('logo').file):
                logo.store(c.page_instance, request.POST.get('logo').file)
                updated = True
        except Exception, e:
            model.meta.Session.rollback()
            h.flash(unicode(e), 'error')
            log.debug(e)
            return self.settings_appearance(id)
Example #2
0
    def settings_appearance_update(self, id, format='html'):
        c.page_instance = self._get_current_instance(id)
        require.instance.edit(c.page_instance)

        # delete the logo if the button was pressed and exit
        if 'delete_logo' in self.form_result:
            logo.delete(c.page_instance)
            return self._settings_result(
                True, c.page_instance, 'appearance',
                message=_(u'The logo has been deleted.'))

        # process the normal form
        updated = update_attributes(c.page_instance, self.form_result,
                                    ['css',
                                     'thumbnailbadges_width',
                                     'thumbnailbadges_height'])
        try:
            # fixme: show logo errors in the form
            if ('logo' in request.POST and
                hasattr(request.POST.get('logo'), 'file') and
                    request.POST.get('logo').file):
                logo.store(c.page_instance, request.POST.get('logo').file)
                updated = True
        except Exception, e:
            model.meta.Session.rollback()
            h.flash(unicode(e), 'error')
            log.debug(e)
            return self.settings_appearance(id)
Example #3
0
    def settings_appearance_update(self, id, format="html"):
        c.page_instance = self._get_current_instance(id)
        require.instance.edit(c.page_instance)

        # delete the logo if the button was pressed and exit
        if "delete_logo" in self.form_result:
            logo.delete(c.page_instance)
            return self.settings_result(True, c.page_instance, "appearance", message=_(u"The logo has been deleted."))

        # process the normal form
        updated = update_attributes(c.page_instance, self.form_result, ["css"])
        try:
            # fixme: show logo errors in the form
            if "logo" in request.POST and hasattr(request.POST.get("logo"), "file") and request.POST.get("logo").file:
                logo.store(c.page_instance, request.POST.get("logo").file)
                updated = True
        except Exception, e:
            model.meta.Session.rollback()
            h.flash(unicode(e), "error")
            log.debug(e)
            return self.settings_appearance(id)
Example #4
0
    def update(self, id, format='html'):
        c.page_instance = self._get_current_instance(id)
        require.instance.edit(c.page_instance)
        c.page_instance.description = self.form_result.get('description')
        c.page_instance.label = self.form_result.get('label')
        c.page_instance.required_majority = self.form_result.get(
            'required_majority')
        c.page_instance.activation_delay = self.form_result.get(
            'activation_delay')
        c.page_instance.allow_adopt = self.form_result.get('allow_adopt')
        c.page_instance.allow_delegate = self.form_result.get('allow_delegate')
        c.page_instance.allow_propose = self.form_result.get('allow_propose')
        c.page_instance.allow_index = self.form_result.get('allow_index')
        c.page_instance.hidden = self.form_result.get('hidden')
        c.page_instance.frozen = self.form_result.get('frozen')
        c.page_instance.milestones = self.form_result.get('milestones')
        c.page_instance.css = self.form_result.get('css')
        c.page_instance.use_norms = self.form_result.get('use_norms')

        locale = Locale(self.form_result.get("locale"))
        if locale and locale in i18n.LOCALES:
            c.page_instance.locale = locale

        if (self.form_result.get('default_group').code in
            model.Group.INSTANCE_GROUPS):
            c.page_instance.default_group = self.form_result.get(
                'default_group')

        try:
            if ('logo' in request.POST and
                hasattr(request.POST.get('logo'), 'file') and
                request.POST.get('logo').file):
                logo.store(c.page_instance, request.POST.get('logo').file)
        except Exception, e:
            h.flash(unicode(e), 'error')
            log.debug(e)
Example #5
0
    def update(self, id, format='html'):
        c.page_instance = self._get_current_instance(id)
        require.instance.edit(c.page_instance)
        c.page_instance.description = self.form_result.get('description')
        c.page_instance.label = self.form_result.get('label')
        c.page_instance.required_majority = self.form_result.get(
            'required_majority')
        c.page_instance.activation_delay = self.form_result.get(
            'activation_delay')
        c.page_instance.allow_adopt = self.form_result.get('allow_adopt')
        c.page_instance.allow_delegate = self.form_result.get('allow_delegate')
        c.page_instance.allow_propose = self.form_result.get('allow_propose')
        c.page_instance.allow_index = self.form_result.get('allow_index')
        c.page_instance.hidden = self.form_result.get('hidden')
        c.page_instance.frozen = self.form_result.get('frozen')
        c.page_instance.milestones = self.form_result.get('milestones')
        c.page_instance.css = self.form_result.get('css')
        c.page_instance.use_norms = self.form_result.get('use_norms')

        locale = Locale(self.form_result.get("locale"))
        if locale and locale in i18n.LOCALES:
            c.page_instance.locale = locale

        if (self.form_result.get('default_group').code
                in model.Group.INSTANCE_GROUPS):
            c.page_instance.default_group = self.form_result.get(
                'default_group')

        try:
            if ('logo' in request.POST
                    and hasattr(request.POST.get('logo'), 'file')
                    and request.POST.get('logo').file):
                logo.store(c.page_instance, request.POST.get('logo').file)
        except Exception, e:
            h.flash(unicode(e), 'error')
            log.debug(e)