stalker.models.ticket.Ticket

Inheritance diagram of stalker.models.ticket.Ticket
class stalker.models.ticket.Ticket(project=None, links=None, priority='TRIVIAL', summary=None, **kwargs)

Bases: stalker.models.entity.Entity, stalker.models.mixins.StatusMixin

Tickets are the way of reporting errors or asking for changes.

The Stalker Ticketing system is based on Trac Basic Workflow. For more information please visit Trac Workflow

Trac Workflow:: http://trac.edgewall.org/wiki/TracWorkflow

Stalker Ticket system is very flexible, to customize the workflow please update the Config.ticket_workflow dictionary.

In the default setup, there are four actions available; accept, resolve, reopen, reassign, and five statuses available New, Assigned, Accepted, Reopened, Closed.

Parameters:
  • project (Project) – The Project that this Ticket is assigned to. A Ticket in Stalker must be assigned to a Project. project argument can not be skipped or can not be None.
  • summary (str) – A string which contains the title or a short description of this Ticket.
  • priority (enum) –

    The priority of the Ticket which is an enum value. Possible values are:

    0 / TRIVIAL defect with little or no impact / cosmetic enhancement
    1 / MINOR defect with minor impact / small enhancement
    2 / MAJOR defect with major impact / big enhancement
    3 / CRITICAL severe loss of data due to the defect or highly needed enhancement
    4 / BLOCKER basic functionality is not available until this is fixed
  • reported_by – An instance of User who created this Ticket. It is basically a synonym for the SimpleEntity.created_by attribute.

Changing the Ticket.:attr`.Ticket.status` will create a new TicketLog instance showing the previous operation.

Even though Tickets needs statuses they don’t need to be supplied a StatusList nor Status for the Tickets. It will be automatically filled accordingly. For newly created Tickets the status of the ticket is NEW and can be changed to other statuses as follows:

Status -> Action -> New Status

NEW -> resolve -> CLOSED NEW -> accept -> ACCEPTED NEW -> reassign -> ASSIGNED

ASSIGNED -> resolve -> CLOSED ASSIGNED -> accept -> ACCEPTED ASSIGNED -> reassign -> ASSIGNED

ACCEPTED -> resolve -> CLOSED ACCEPTED -> accept -> ACCEPTED ACCEPTED -> reassign -> ASSIGNED

REOPENED -> resolve -> CLOSED REOPENED -> accept -> ACCEPTED REOPENED -> reassign -> ASSIGNED

CLOSED -> reopen -> REOPENED

actions available: resolve reassign accept reopen

The Ticket.name is automatically generated by using the stalker.config.Config.ticket_label attribute and Ticket.ticket_number. So if defaults are used the first ticket name will be “Ticket#1” and the second “Ticket#2” and so on. For every project the number will restart from 1.

Use the Ticket.resolve(), Ticket.reassign(), Ticket.accept(), Ticket.reopen() methods to change the status of the current Ticket.

Changing the status of the Ticket will create TicketLog entries reflecting the change made.

__init__(project=None, links=None, priority='TRIVIAL', summary=None, **kwargs)

Methods

__init__([project, links, priority, summary])
accept([created_by]) accepts the ticket
del_resolution(*args) deletes the timing_resolution
reassign([created_by, assign_to]) reassigns the ticket
reopen([created_by]) reopens the ticket
resolve([created_by, resolution]) resolves the ticket
set_owner(*args) sets owner to the given owner
set_resolution(*args) sets the timing_resolution

Attributes

comments A list of Note instances showing the comments made for this Ticket instance.
created_by The User who has created this object.
created_by_id The id of the User who has created this entity.
date_created A datetime.datetime instance showing the creation date and time of this object.
date_updated A datetime.datetime instance showing the update date and time of this object.
description Description of this object.
entity_groups
entity_id
entity_type
generic_data This attribute can hold any kind of data which exists in SOM.
generic_text This attribute can hold any text.
html_class
html_style
id
links
logs
metadata
name Name of this object
nice_name Nice name of this object.
notes All the Notess attached to this entity.
number The automatically generated number for the tickets.
owner
owner_id
plural_class_name the plural name of this class
priority The priority of the Ticket which is an enum value.
project returns the project attribute
project_id
query
related_tickets A list of other Ticket instances which are related to this one.
reported_by Shows who created this Ticket
resolution
status The current status of the object.
status_id
status_list
status_list_id
summary
tags A list of tags attached to this object.
thumbnail
thumbnail_id
ticket_id
tjp_id returns TaskJuggler compatible id
to_tjp renders a TaskJuggler compliant string used for TaskJuggler integration.
type The type of the object.
type_id The id of the Type of this entity.
updated_by The User who has updated this object.
updated_by_id The id of the User who has updated this entity.
accept(created_by=None)

accepts the ticket

comments

A list of Note instances showing the comments made for this Ticket instance. It is a synonym for the Ticket.notes attribute.

created_by

The User who has created this object.

created_by_id

The id of the User who has created this entity.

date_created

A datetime.datetime instance showing the creation date and time of this object.

date_updated

A datetime.datetime instance showing the update date and time of this object.

del_resolution(*args)

deletes the timing_resolution

description

Description of this object.

generic_data

This attribute can hold any kind of data which exists in SOM.

generic_text

This attribute can hold any text.

name

Name of this object

nice_name

Nice name of this object.

It has the same value with the name (contextually) but with a different format like, all the white spaces replaced by underscores (“_”), all the CamelCase form will be expanded by underscore (_) characters and it is always lower case.

notes

All the Notess attached to this entity.

It is a list of Note instances or an empty list, setting it to None will raise a TypeError.

number

The automatically generated number for the tickets.

plural_class_name

the plural name of this class

priority

The priority of the Ticket which is an enum value. Possible values are:

0 / TRIVIAL defect with little or no impact / cosmetic enhancement
1 / MINOR defect with minor impact / small enhancement
2 / MAJOR defect with major impact / big enhancement
3 / CRITICAL severe loss of data due to the defect or highly needed enhancement
4 / BLOCKER basic functionality is not available until this is fixed
project

returns the project attribute

reassign(created_by=None, assign_to=None)

reassigns the ticket

related_tickets

A list of other Ticket instances which are related to this one. Can be used to related Tickets to point to a common problem. The Ticket itself can not be assigned to this list

reopen(created_by=None)

reopens the ticket

reported_by

Shows who created this Ticket

resolve(created_by=None, resolution='')

resolves the ticket

set_owner(*args)

sets owner to the given owner

set_resolution(*args)

sets the timing_resolution

status

The current status of the object.

It is a Status instance which is one of the Statuses stored in the status_list attribute of this object.

tags

A list of tags attached to this object.

It is a list of Tag instances which shows the tags of this object

tjp_id

returns TaskJuggler compatible id

to_tjp

renders a TaskJuggler compliant string used for TaskJuggler integration. Needs to be overridden in inherited classes.

type

The type of the object.

It is a Type instance with a proper Type.target_entity_type.

type_id

The id of the Type of this entity. Mainly used by SQLAlchemy to create a Many-to-One relates between SimpleEntities and Types.

updated_by

The User who has updated this object.

updated_by_id

The id of the User who has updated this entity.