From ad5dec3dc6b54cc19ec5620637d0b9245ed5ef4e Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 8 Feb 2023 20:19:15 -0600 Subject: [PATCH] Use label handler to avoid deprecated logic --- tailbone/templates/labels/profiles/view.mako | 2 +- tailbone/views/labels/profiles.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tailbone/templates/labels/profiles/view.mako b/tailbone/templates/labels/profiles/view.mako index 2609ffbf..b93570af 100644 --- a/tailbone/templates/labels/profiles/view.mako +++ b/tailbone/templates/labels/profiles/view.mako @@ -35,7 +35,7 @@ % for name, display in printer.required_settings.items():
-
${instance.get_printer_setting(name) or ''}
+
${label_handler.get_printer_setting(instance, name) or ''}
% endfor diff --git a/tailbone/views/labels/profiles.py b/tailbone/views/labels/profiles.py index f49902bb..fa878448 100644 --- a/tailbone/views/labels/profiles.py +++ b/tailbone/views/labels/profiles.py @@ -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,