def get_pod_command_args(run_config): if not run_config or not run_config.cmd: raise ValueError('The specification must contain a command.') cmd = strip_spaces(value=run_config.cmd, join=False) cmd = [c.strip().strip('\\') for c in cmd if (c and c != '\\')] cmd = [c for c in cmd if (c and c != '\\')] return cmd, []
def render_mail_template(subject_template, body_template, context): """ Renders both the subject and body templates in the given context. Returns a tuple (subject, body) of the result. """ try: subject = strip_spaces(render_to_string(subject_template, context)) body = render_to_string(body_template, context) finally: pass return subject, body
def _validate_config(cls, config): if not config: return {} recipients = config.get('recipients') if not recipients: return {} if isinstance(recipients, str): recipients = strip_spaces(recipients, sep=',', join=False) config['recipients'] = [email for email in recipients if email] return config
def get_ordering(self, request, queryset, view): """ Ordering is set by a comma delimited ?ordering=... query parameter. The `ordering` query parameter can be overridden by setting the `ordering_param` value on the OrderingFilter or by specifying an `ORDERING_PARAM` value in the API settings. """ params = request.query_params.get(self.ordering_param) if params: fields = strip_spaces(value=params, sep=',', join=False) ordering, annotations = self.remove_invalid_fields(queryset, fields, view, request) if ordering: return ordering, annotations # No ordering was included, or all the ordering fields were invalid return self.get_default_ordering(view), None