tycho_utils module

class tycho_utils.NetworkUtils

Bases: object

static get_client_ip(request, debug=False)

Get the IP address of the client. Account for requests from proxies. In debug mode, ignore loopback and try to get an IP from a n interface.

class tycho_utils.Resource

Bases: object

get_resource_obj(format=None)
static get_resource_path(resource_name)
static load_json(path)
static load_yaml(path)
class tycho_utils.TemplateUtils

Bases: object

Utilities for generating text.

static apply_environment(environment, text)

Given an environment configuration consisting of lines of Bash style variable assignemnts, parse the variables and apply them to the given text.

static render(template, context)

Render a template object given a context.

static render_text(template_text, context)

Render the text of a template given a context.

static trunc(a_string, max_len=80)