当前位置: 首页>>代码示例>>Python>>正文


Python api.TicketSystem类代码示例

本文整理汇总了Python中trac.ticket.api.TicketSystem的典型用法代码示例。如果您正苦于以下问题:Python TicketSystem类的具体用法?Python TicketSystem怎么用?Python TicketSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TicketSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: print_edit_view

    def print_edit_view(self, req, error=None, filter=None, warning=None):

        userMail = self.get_user_email(req.authname)
        fields = TicketSystem(self.env).get_ticket_fields()
        customFields = TicketSystem(self.env).get_custom_fields()

        for  f in fields[:]:
            for cf in customFields:
                if f['name'] == cf['name']:
                    fields.remove(f)

        disableSubmitButton = ""
        if not userMail:
            userMail = ["No email specified"]
            disableSubmitButton = "disabled"

        data = {'userEmail' : userMail, 
                'submitDisabled': disableSubmitButton,
                'datetime_hint': get_datetime_format_hint(),
                'fields': fields,
                'filter': filter,
                'error': error,
                'warning': warning}
        
        add_stylesheet(req, 'hw/css/style.css')
        add_script(req, 'hw/js/xmail.js')
        
        return 'xmail-edit.html', data, None
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:28,代码来源:XMailMainView.py

示例2: ticket_created

    def ticket_created(self, ticket):
        ticketsystem = TicketSystem(self.env)
        resource_name = get_resource_shortname(self.env, ticket.resource)
        resource_desc = ticketsystem.get_resource_description(ticket.resource,
                                                              format='summary')
        # make sure we will index customerrequest name not id
        cr_id = ticket['customerrequest']
        if cr_id:
            db = self.env.get_read_db()
            cursor = db.cursor()
            cursor.execute("SELECT name FROM public.customer_requests "
                           " WHERE id='%s'" % cr_id)
            row = cursor.fetchone()
            if row:
                ticket.values['customerrequest'] = row[0]

        so = FullTextSearchObject(
                self.project, ticket.resource,
                title = u"%(title)s: %(message)s" % {'title': resource_name,
                                                     'message': resource_desc},
                author = ticket.values.get('reporter'),
                changed = ticket.values.get('changetime'),
                created = ticket.values.get('time'),
                tags = ticket.values.get('keywords'),
                involved = re.split(r'[;,\s]+', ticket.values.get('cc', ''))
                           or ticket.values.get('reporter'),
                popularity = 0, #FIXME
                oneline = shorten_result(ticket.values.get('description', '')),
                body = u'%r' % (ticket.values,),
                status = ticket.values.get('status'),
                comments = [t[4] for t in ticket.get_changelog()],
                )
        self.backend.create(so, quiet=True)
        self._update_ticket(ticket)
        self.log.debug("Ticket added for indexing: %s", ticket)
开发者ID:getpenelope,项目名称:fulltextsearchplugin,代码行数:35,代码来源:fulltextsearch.py

示例3: print_edit_view

    def print_edit_view(self, req, error=None, filter=None, warning=None):

        userMail = self.get_user_email(req.authname)
        fields = TicketSystem(self.env).get_ticket_fields()
        customFields = TicketSystem(self.env).get_custom_fields()

        for f in fields[:]:
            for cf in customFields:
                if f["name"] == cf["name"]:
                    fields.remove(f)

        disableSubmitButton = ""
        if not userMail:
            userMail = ["No email specified"]
            disableSubmitButton = "disabled"

        data = {
            "userEmail": userMail,
            "submitDisabled": disableSubmitButton,
            "datetime_hint": get_datetime_format_hint(),
            "fields": fields,
            "filter": filter,
            "error": error,
            "warning": warning,
        }

        add_stylesheet(req, "hw/css/style.css")
        add_script(req, "hw/js/xmail.js")

        return "xmail-edit.html", data, None
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:30,代码来源:XMailMainView.py

示例4: __init__

 def __init__(self):
     self.log.debug('Starting Sqa Testing System API')
     ts = TicketSystem(self.env)
     '''
     When the object is created collect 
     a set of tickets configured in this
     running instance of track
     '''
     self.ticket_fields = ts.get_ticket_fields()
开发者ID:shilanguedangue,项目名称:tracpm,代码行数:9,代码来源:api.py

示例5: describe_tagged_resource

 def describe_tagged_resource(self, req, resource):
     if not self.check_permission(req.perm, 'view'):
         return ''
     ticket = Ticket(self.env, resource.id)
     if ticket.exists:
         # Use the corresponding IResourceManager.
         ticket_system = TicketSystem(self.env)
         return ticket_system.get_resource_description(ticket.resource,
                                                       format='summary')
     else:
         return ''
开发者ID:kzhamaji,项目名称:TracTagsPlugin,代码行数:11,代码来源:ticket.py

示例6: test_available_actions_no_perms

 def test_available_actions_no_perms(self):
     ts = TicketSystem(self.env)
     perm = Mock(has_permission=lambda x: 0)
     self.assertEqual(['leave'],
                      ts.get_available_actions({'status': 'new'}, perm))
     self.assertEqual(['leave'],
                      ts.get_available_actions({'status': 'assigned'}, perm))
     self.assertEqual(['leave'],
                      ts.get_available_actions({'status': 'reopened'}, perm))
     self.assertEqual(['leave'],
                      ts.get_available_actions({'status': 'closed'}, perm))
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:11,代码来源:api.py

示例7: test_available_actions_create_only

 def test_available_actions_create_only(self):
     ts = TicketSystem(self.env)
     perm = Mock(has_permission=lambda x: x == 'TICKET_CREATE')
     self.assertEqual(['leave'],
                      ts.get_available_actions({'status': 'new'}, perm))
     self.assertEqual(['leave'],
                      ts.get_available_actions({'status': 'assigned'}, perm))
     self.assertEqual(['leave'],
                      ts.get_available_actions({'status': 'reopened'}, perm))
     self.assertEqual(['leave', 'reopen'],
                      ts.get_available_actions({'status': 'closed'}, perm))
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:11,代码来源:api.py

示例8: ResetActionTestCase

class ResetActionTestCase(unittest.TestCase):

    def setUp(self):
        self.env = EnvironmentStub(default_data=True)
        self.perm_sys = PermissionSystem(self.env)
        self.ctlr = TicketSystem(self.env).action_controllers[0]
        self.req1 = Mock(authname='user1', args={},
                         perm=PermissionCache(self.env, 'user1'))
        self.req2 = Mock(authname='user2', args={},
                         perm=PermissionCache(self.env, 'user2'))
        self.ticket = Ticket(self.env)
        self.ticket['status'] = 'invalid'
        self.ticket.insert()

    def tearDown(self):
        self.env.reset_db()

    def _reload_workflow(self):
        self.ctlr.actions = self.ctlr.get_all_actions()

    def test_default_reset_action(self):
        """Default reset action."""
        self.perm_sys.grant_permission('user2', 'TICKET_ADMIN')
        self._reload_workflow()

        actions1 = self.ctlr.get_ticket_actions(self.req1, self.ticket)
        actions2 = self.ctlr.get_ticket_actions(self.req2, self.ticket)
        chgs2 = self.ctlr.get_ticket_changes(self.req2, self.ticket, '_reset')

        self.assertEqual(1, len(actions1))
        self.assertNotIn((0, '_reset'), actions1)
        self.assertEqual(2, len(actions2))
        self.assertIn((0, '_reset'), actions2)
        self.assertEqual('new', chgs2['status'])

    def test_custom_reset_action(self):
        """Custom reset action in [ticket-workflow] section."""
        config = self.env.config['ticket-workflow']
        config.set('_reset', '-> review')
        config.set('_reset.operations', 'reset_workflow')
        config.set('_reset.permissions', 'TICKET_BATCH_MODIFY')
        config.set('_reset.default', 2)
        self.perm_sys.grant_permission('user2', 'TICKET_BATCH_MODIFY')
        self._reload_workflow()

        actions1 = self.ctlr.get_ticket_actions(self.req1, self.ticket)
        actions2 = self.ctlr.get_ticket_actions(self.req2, self.ticket)
        chgs2 = self.ctlr.get_ticket_changes(self.req2, self.ticket, '_reset')

        self.assertEqual(1, len(actions1))
        self.assertNotIn((2, '_reset'), actions1)
        self.assertEqual(2, len(actions2))
        self.assertIn((2, '_reset'), actions2)
        self.assertEqual('review', chgs2['status'])
开发者ID:pkdevbox,项目名称:trac,代码行数:54,代码来源:default_workflow.py

示例9: _check_field_existance

 def _check_field_existance(self):
     
     ticket_system = TicketSystem(self.env)
     custom_fields = ticket_system.get_custom_fields()
     
     for custom_field in custom_fields:
         if custom_field['type'] == 'text':
             if custom_field['name'] == self.tfield:
                 return True
     
     return False
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:11,代码来源:relevantticket.py

示例10: _complete_transition

 def _complete_transition(self, args):
     if len(args) < 3:
         states = TicketSystem(self.env).get_all_status()
         if len(args) == 2 and args[0] in states:
             states.remove(args[0])
         return states
     if len(args) == 3:
         return self.common_days
     if len(args) == 4:
         return self._get_user_list()
     if len(args) == 5:
         return self._get_explanations(args[3])
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:12,代码来源:scheduledworkflow.py

示例11: test_available_actions_chgprop_only

 def test_available_actions_chgprop_only(self):
     # CHGPROP is not enough for changing a ticket's state (#3289)
     ts = TicketSystem(self.env)
     perm = Mock(has_permission=lambda x: x == 'TICKET_CHGPROP')
     self.assertEqual(['leave'],
                      ts.get_available_actions({'status': 'new'}, perm))
     self.assertEqual(['leave'],
                      ts.get_available_actions({'status': 'assigned'}, perm))
     self.assertEqual(['leave'],
                      ts.get_available_actions({'status': 'reopened'}, perm))
     self.assertEqual(['leave'],
                      ts.get_available_actions({'status': 'closed'}, perm))
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:12,代码来源:api.py

示例12: _translation_deactivated

def _translation_deactivated(ticket=None):
    t = deactivate()
    if ticket is not None:
        ts = TicketSystem(ticket.env)
        translated_fields = ticket.fields
        ticket.fields = ts.get_ticket_fields()
    try:
        yield
    finally:
        if ticket is not None:
            ticket.fields = translated_fields
        reactivate(t)
开发者ID:pkdevbox,项目名称:trac,代码行数:12,代码来源:notification.py

示例13: get_search_results

    def get_search_results(self, req, terms, filters):
        """Overriding search results for Tickets"""
        if not "ticket" in filters:
            return
        ticket_realm = Resource("ticket")
        with self.env.db_query as db:
            sql, args = search_to_sql(
                db, ["summary", "keywords", "description", "reporter", "cc", db.cast("id", "text")], terms
            )
            sql2, args2 = search_to_sql(db, ["newvalue"], terms)
            sql3, args3 = search_to_sql(db, ["value"], terms)
            ticketsystem = TicketSystem(self.env)
            if req.args.get("product"):
                productsql = "product='%s' AND" % req.args.get("product")
            else:
                productsql = ""

            for summary, desc, author, type, tid, ts, status, resolution in db(
                """SELECT summary, description, reporter, type, id,
                                 time, status, resolution 
                          FROM ticket
                          WHERE (%s id IN (
                              SELECT id FROM ticket WHERE %s
                            UNION
                              SELECT ticket FROM ticket_change
                              WHERE field='comment' AND %s
                            UNION
                              SELECT ticket FROM ticket_custom WHERE %s
                          ))
                          """
                % (productsql, sql, sql2, sql3),
                args + args2 + args3,
            ):
                t = ticket_realm(id=tid)
                if "TICKET_VIEW" in req.perm(t):
                    yield (
                        req.href.ticket(tid),
                        tag_(
                            "%(title)s: %(message)s",
                            title=tag.span(get_resource_shortname(self.env, t), class_=status),
                            message=ticketsystem.format_summary(summary, status, resolution, type),
                        ),
                        from_utimestamp(ts),
                        author,
                        shorten_result(desc, terms),
                    )

        # Attachments
        for result in AttachmentModule(self.env).get_search_results(req, ticket_realm, terms):
            yield result
开发者ID:rvelezc,项目名称:rafaelvelez.us-backup,代码行数:50,代码来源:web_ui.py

示例14: _get_ticket_fields

    def _get_ticket_fields(self, data):
        """ Return a list of the ticket fields corresponding to the output columns

        The data returned is used for ticket field input
        """
        ts = TicketSystem(self.env)
        fields = ts.get_ticket_fields()
        results = []
        for header in data['headers'][1:]:
            for field in fields:
                if field['name'] == header['name']:
                    results.append(field)
                continue
            continue
        return results
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:15,代码来源:main.py

示例15: setUp

    def setUp(self):
        tmpdir = os.path.realpath(tempfile.gettempdir())
        self.env = EnvironmentStub(enable=['trac.*', AuthzPolicy], path=tmpdir)
        self.env.config.set('trac', 'permission_policies',
                            'AuthzPolicy, DefaultPermissionPolicy')
        self.env.config.set('ticket', 'restrict_owner', True)

        self.perm_sys = PermissionSystem(self.env)
        self.env.insert_known_users([
            ('user1', '', ''), ('user2', '', ''),
            ('user3', '', ''), ('user4', '', '')
        ])
        self.perm_sys.grant_permission('user1', 'TICKET_MODIFY')
        self.perm_sys.grant_permission('user2', 'TICKET_VIEW')
        self.perm_sys.grant_permission('user3', 'TICKET_MODIFY')
        self.perm_sys.grant_permission('user4', 'TICKET_MODIFY')
        self.authz_file = os.path.join(tmpdir, 'trac-authz-policy')
        create_file(self.authz_file)
        self.env.config.set('authz_policy', 'authz_file', self.authz_file)
        self.ctlr = TicketSystem(self.env).action_controllers[0]
        self.req1 = Mock(authname='user1', args={},
                         perm=PermissionCache(self.env, 'user1'))
        self.ticket = Ticket(self.env)
        self.ticket['status'] = 'new'
        self.ticket.insert()
开发者ID:pkdevbox,项目名称:trac,代码行数:25,代码来源:default_workflow.py


注:本文中的trac.ticket.api.TicketSystem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。