API documentation

Backends

The role of a backend is to handle the communication with a backend tool that will store the timesheets and provide projects and activities.

class taxi.backends.BaseBackend(username, password, hostname, port, path, options, context)

All Taxi backends should inherit from the BaseBackend class. Backends are usually constructed from a URL in the form <backend_name>://<username>:<password>@<hostname>:<port><path>?<options>. The PluginsRegistry takes care of the parsing and the instanciation of the backend objects. The options parameter is a dictionary constructed from the backend URL querystring.

Construct the backend.

get_projects()

Return a list of projects and activities. These will be then stored for further use. The list should contain Project objects.

post_push_entries()

Called after the entries have been pushed. Useful if you need to do post-processing like closing connection, or sending entries buffered in push_entry().

If an exception is raised in this method, the status of all the entries of the backend will be considered failed. You can also raise PushEntriesFailed with a custom user message to mark their status as failed. If you want to mark individual entries as failed, raise PushEntriesFailed with entries being a dictionary containing entries as keys, and error messages as values.

push_entry(date, entry)

Called when an entry should be pushed to the backend. date is a datetime.date object. entry is a TimesheetEntry object.

If the push fails, this method should raise a PushEntryFailed exception.

exception taxi.backends.PushEntriesFailed(message=None, entries=None)

Exception indicating that a set of entries couldn’t be pushed. Typically raised by BaseBackend.post_push_entries().

If entries is set, it should be a dictionary mapping taxi.timesheet.entry.TimesheetEntry with errors as strings.

exception taxi.backends.PushEntryFailed

Exception indicating that an entry couldn’t be pushed.

Plugins

Exceptions

Timesheets

Timesheet lines

class taxi.timesheet.lines.DateLine(date, text=None)

Represents a date in a timesheet.

is_date_line = True
class taxi.timesheet.lines.TextLine(text)

The TextLine is either a blank line or a comment line.

is_text_line = True

Timesheet parsing

Exceptions