def put(self, template_id):
        form = BlueprintTemplateForm()
        if not form.validate_on_submit():
            logging.warn("validation error on update blueprint_template config")
            return form.errors, 422

        blueprint_template = BlueprintTemplate.query.filter_by(id=template_id).first()
        if not blueprint_template:
            abort(404)
        blueprint_template.name = form.config.data.get('name') or form.name.data
        blueprint_template.plugin = form.plugin.data

        config = form.config.data
        config.pop('name', None)
        blueprint_template.config = config
        try:
            validate_max_lifetime_template(config)  # Validate the maximum lifetime from config
        except ValueError:
            timeformat_error = {"timeformat error": "pattern should be [days]d [hours]h [minutes]m"}
            return timeformat_error, 422
        if isinstance(form.allowed_attrs.data, dict):  # WTForms can only fetch a dict
            blueprint_template.allowed_attrs = form.allowed_attrs.data['allowed_attrs']
            blueprint_template = blueprint_schemaform_config(blueprint_template)

        args = self.parser.parse_args()
        blueprint_template = toggle_enable_template(form, args, blueprint_template)

        db.session.add(blueprint_template)
        db.session.commit()