Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Add convenience bindings in __init__ #5

@ca-scribner

Description

@ca-scribner

I liked what @DnPlas did in the training operator where she bound a few commonly used things from the model to local attributes in __init__. Should we add some standard ones to our template? Yes, these are things that are already available (via self.model... etc), but to new people they're hard to find (and sometimes interpret, for example namespace). At a minimum, bindings tend to read better in the code.

I'm thinking something like:

def __init__(...):
  self._name = self.model.app.name
  self._namespace = self.model.name  # Or even better, we put in the template the more robust namespace solution @jnsgruk proposed a few weeks back, I think to handle when something is accidentally deployed into the controller model?
  self._model_name = self.model.name
  # (other things)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions