"Fossies" - the Fresh Open Source Software Archive

Member "PURELIB/trac/ticket/test.py" (27 Aug 2019, 934 Bytes) of package /windows/misc/Trac-1.4.win-amd64.exe:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "test.py": 1.3.5_vs_1.3.6.

    1 # -*- coding: utf-8 -*-
    2 #
    3 # Copyright (C) 2017-2019 Edgewall Software
    4 # All rights reserved.
    5 #
    6 # This software is licensed as described in the file COPYING, which
    7 # you should have received as part of this distribution. The terms
    8 # are also available at https://trac.edgewall.org/wiki/TracLicense.
    9 #
   10 # This software consists of voluntary contributions made by many
   11 # individuals. For the exact contribution history, see the revision
   12 # history and logs, available at https://trac.edgewall.org/log/.
   13 
   14 from trac.ticket.model import Ticket
   15 
   16 
   17 def insert_ticket(env, **props):
   18     """Insert a ticket to the database with properties specified in the
   19     keyword arguments. The creation time can be specified as a timestamp
   20     in the `when` argument.
   21     """
   22     when = props.pop('when', None)
   23     ticket = Ticket(env)
   24     for k, v in props.items():
   25         ticket[k] = v
   26     ticket.insert(when)
   27     return ticket