Switch to unified view

a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
...
...
22
from allura.model import ACE, ALL_PERMISSIONS, DENY_ALL
22
from allura.model import ACE, ALL_PERMISSIONS, DENY_ALL
23
from allura.lib import patience
23
from allura.lib import patience
24
from allura.lib import security
24
from allura.lib import security
25
from allura.lib.search import search_artifact
25
from allura.lib.search import search_artifact
26
from allura.lib import utils
26
from allura.lib import utils
27
from allura.lib import helpers as h
27
28
28
log = logging.getLogger(__name__)
29
log = logging.getLogger(__name__)
29
30
30
config = utils.ConfigProxy(
31
config = utils.ConfigProxy(
31
    common_suffix='forgemail.domain')
32
    common_suffix='forgemail.domain')
...
...
241
                app_config_id=c.app.config._id,
242
                app_config_id=c.app.config._id,
242
                custom_fields=dict(),
243
                custom_fields=dict(),
243
                ticket_num=ticket_num)
244
                ticket_num=ticket_num)
244
            try:
245
            try:
245
                session(ticket).flush(ticket)
246
                session(ticket).flush(ticket)
247
                h.log_action(log, 'opened').info('')
246
                return ticket
248
                return ticket
247
            except OperationFailure, err:
249
            except OperationFailure, err:
248
                if 'duplicate' in err.args[0]:
250
                if 'duplicate' in err.args[0]:
249
                    log.warning('Try to create duplicate ticket %s', ticket.url())
251
                    log.warning('Try to create duplicate ticket %s', ticket.url())
250
                    session(ticket).expunge(ticket)
252
                    session(ticket).expunge(ticket)
...
...
371
                    self.ticket_num, self.summary),
373
                    self.ticket_num, self.summary),
372
                       'Edited By: %s (%s)' % (c.user.get_pref('display_name'), c.user.username)]
374
                       'Edited By: %s (%s)' % (c.user.get_pref('display_name'), c.user.username)]
373
            fields = [
375
            fields = [
374
                ('Summary', old.summary, self.summary),
376
                ('Summary', old.summary, self.summary),
375
                ('Status', old.status, self.status) ]
377
                ('Status', old.status, self.status) ]
378
            if old.status != self.status and self.status in c.app.globals.set_of_closed_status_names:
379
                h.log_action(log, 'closed').info('')
376
            for key in self.custom_fields:
380
            for key in self.custom_fields:
377
                fields.append((key, old.custom_fields.get(key, ''), self.custom_fields[key]))
381
                fields.append((key, old.custom_fields.get(key, ''), self.custom_fields[key]))
378
            for title, o, n in fields:
382
            for title, o, n in fields:
379
                if o != n:
383
                if o != n:
380
                    changes.append('%s updated: %r => %r' % (
384
                    changes.append('%s updated: %r => %r' % (
...
...
486
            root = Ticket.query.get(_id=next_id, app_config_id=c.app.config._id)
490
            root = Ticket.query.get(_id=next_id, app_config_id=c.app.config._id)
487
            next_id = root.super_id
491
            next_id = root.super_id
488
        if root is not None:
492
        if root is not None:
489
            root.recalculate_sums()
493
            root.recalculate_sums()
490
494
491
    def update(self,ticket_form):
495
    def update(self, ticket_form):
492
        self.globals.invalidate_bin_counts()
496
        self.globals.invalidate_bin_counts()
493
497
494
        # update is not allowed to change the ticket_num
498
        # update is not allowed to change the ticket_num
495
        ticket_form.pop('ticket_num', None)
499
        ticket_form.pop('ticket_num', None)
496
500