Use label handler to avoid deprecated logic

This commit is contained in:
Lance Edgar 2023-02-08 20:19:15 -06:00
parent 32fc0415da
commit ad5dec3dc6
2 changed files with 9 additions and 2 deletions

View file

@ -35,7 +35,7 @@
% for name, display in printer.required_settings.items():
<div class="field-wrapper">
<label>${display}</label>
<div class="field">${instance.get_printer_setting(name) or ''}</div>
<div class="field">${label_handler.get_printer_setting(instance, name) or ''}</div>
</div>
% endfor
</div>

View file

@ -78,6 +78,13 @@ class LabelProfileView(MasterView):
# format
f.set_type('format', 'codeblock')
def template_kwargs_view(self, **kwargs):
kwargs = super(LabelProfileView, self).template_kwargs_view(**kwargs)
kwargs['label_handler'] = self.label_handler
return kwargs
def after_create(self, profile):
self.after_edit(profile)
@ -97,7 +104,7 @@ class LabelProfileView(MasterView):
node = colander.SchemaNode(colander.String(),
name=name,
title=label,
default=profile.get_printer_setting(name))
default=self.label_handler.get_printer_setting(profile, name))
schema.add(node)
form = forms.Form(schema=schema, request=self.request,