Ejemplo n.º 1
0
 def change_workflow_config(self, lines):
     for (option, value) in lines:
         self.env.config.set('ticket-workflow', option, value)
     self.env.config.save()
     self.clear_ticket_system_field_cache()
     ticket_workflow = ConfigurableTicketWorkflow(self.env)
     ticket_workflow.actions = get_workflow_config(self.env.config)
Ejemplo n.º 2
0
Archivo: db33.py Proyecto: wataash/trac
def do_upgrade(env, version, cursor):
    """Add 'create' actions to ticket-workflow (ticket #2045).
    """
    save = False
    all_actions = get_workflow_config(env.config)
    all_states = list({
        state
        for action in all_actions.itervalues() for state in action['oldstates']
    } | {action['newstate']
         for action in all_actions.itervalues()})

    for action, attributes in new_actions.items():
        if action == 'create_and_assign' and 'assigned' not in all_states:
            continue
        if action not in env.config['ticket-workflow']:
            for attr, value in attributes.items():
                key = action + ('.' + attr if attr else '')
                env.config.set('ticket-workflow', key, value)
            save = True
        else:
            env.log.info(
                "Couldn't add ticket action '%s' because it "
                "already exists.", action)
    if save:
        backup_config_file(env, '.db33.bak')
        env.config.save()
Ejemplo n.º 3
0
 def change_workflow_config(self, lines):
     for (option, value) in lines:
         self.env.config.set('ticket-workflow', option, value)
     self.env.config.save()
     self.clear_ticket_system_field_cache()
     ticket_workflow = ConfigurableTicketWorkflow(self.env)
     ticket_workflow.actions = get_workflow_config(self.env.config)
Ejemplo n.º 4
0
def get_statuses_from_workflow(config):
    wf = get_workflow_config(config)
    x = Set()
    for key, value in wf.items():
        x.add(value['newstate'])
        x |= Set(value['oldstates'])
    x.difference_update([u'*'])
    return x
def get_statuses_from_workflow(config):
    wf = get_workflow_config(config)
    x = set()
    for key, value in wf.items():
        x.add(value['newstate'])
        x |= set(value['oldstates'])
    x.difference_update([u'*'])
    return x
Ejemplo n.º 6
0
 def __init__(self, *args, **kwargs):
     Component.__init__(self, *args, **kwargs)
     self.actions = get_workflow_config(self.config)
     self.ensureUserData = self.config.getbool('flexibleassignto', 
                                             'ensure_user_data', False)
     self.use_custom_get_known_users = self.config.getbool(
         'flexibleassignto', 'use_custom_get_known_users', False)
     if self.use_custom_get_known_users:
         self._replace_get_known_users()
Ejemplo n.º 7
0
    def render_admin_panel(self, req, cat, page, info):
        req.perm.require('TICKET_ADMIN')
        add_script(req, 'visualworkflow/js/graph_options.js')
        add_script(req, 'visualworkflow/js/editor_tab_fondler.js')
        add_stylesheet(req, 'visualworkflow/css/editor_tabs.css')

        actions = get_workflow_config(self.config)
        self.log.debug("Workflow from config: %s" % str(actions))
        data = {'workflow' : actions}
        return 'admin_workflow.html', data
Ejemplo n.º 8
0
def do_upgrade(env, version, cursor):
    """Add 'create' actions to ticket-workflow (ticket #2045).
    """
    save = False
    all_actions = get_workflow_config(env.config)
    all_states = list(set(
        [state for action in all_actions.itervalues()
               for state in action['oldstates']] +
        [action['newstate'] for action in all_actions.itervalues()]))

    for action, attributes in new_actions.items():
        if action == 'create_and_assign' and 'assigned' not in all_states:
            continue
        if action not in env.config['ticket-workflow']:
            for attr, value in attributes.items():
                key = action + ('.' + attr if attr else '')
                env.config.set('ticket-workflow', key, value)
            save = True
        else:
            env.log.info("Couldn't add ticket action '%s' because it "
                         "already exists.", action)
    if save:
        backup_config_file(env, '.db33.bak')
        env.config.save()
Ejemplo n.º 9
0
 def __init__(self):
     self.rules = self._get_validation_rules()
     self.workflow = get_workflow_config(self.config)