• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python api.TicketSystem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: _implementation

        def _implementation(db):
            tkt = Ticket(self.env, ticket_id)
            ts = TicketSystem(self.env)
            tm = TicketModule(self.env)
            if action not in ts.get_available_actions(req, tkt):
                raise ValueError(["This ticket cannot be moved to this status,\
                      perhaps the ticket has been updated by someone else."])

            field_changes, problems = \
                tm.get_ticket_changes(req, tkt, action)

            if problems:
                raise ValueError(problems)

            tm._apply_ticket_changes(tkt, field_changes)
            valid = tm._validate_ticket(req, tkt, force_collision_check=True)
            if not valid:
                raise ValueError(req.chrome['warnings'])
            else:
                tkt.save_changes(req.authname, "", when=datetime.now(utc))
开发者ID:CGI-define-and-primeportal,项目名称:trac-plugin-agiletools,代码行数:20,代码来源:taskboard.py


示例17: _index_ticket

 def _index_ticket(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")
     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,),
         comments=[t[4] for t in ticket.get_changelog()],
     )
     self.backend.create(so, quiet=True)
     self.log.debug("Ticket added for indexing: %s", ticket)
开发者ID:CGI-define-and-primeportal,项目名称:trac-plugin-solr,代码行数:20,代码来源:fulltextsearch.py


示例18: getActions

 def getActions(self, req, id):
     """Returns the actions that can be performed on the ticket as a list of
     `[action, label, hints, [input_fields]]` elements, where `input_fields` is
     a list of `[name, value, [options]]` for any required action inputs."""
     ts = TicketSystem(self.env)
     t = model.Ticket(self.env, id)
     actions = []
     for action in ts.get_available_actions(req, t):
         fragment = genshi.builder.Fragment()
         hints = []
         first_label = None
         for controller in ts.action_controllers:
             if action in [c_action for c_weight, c_action \
                             in controller.get_ticket_actions(req, t)]:
                 label, widget, hint = \
                     controller.render_ticket_action_control(req, t, action)
                 fragment += widget
                 hints.append(to_unicode(hint).rstrip('.') + '.')
                 first_label = first_label == None and label or first_label
         controls = []
         for elem in fragment.children:
             if not isinstance(elem, genshi.builder.Element):
                 continue
             if elem.tag == 'input':
                 controls.append((elem.attrib.get('name'),
                                 elem.attrib.get('value'), []))
             elif elem.tag == 'select':
                 value = ''
                 options = []
                 for opt in elem.children:
                     if not (opt.tag == 'option' and opt.children):
                         continue
                     option = opt.children[0]
                     options.append(option)
                     if opt.attrib.get('selected'):
                         value = option
                 controls.append((elem.attrib.get('name'),
                                 value, options))
         actions.append((action, first_label, " ".join(hints), controls))
     return actions
开发者ID:42cc,项目名称:XmlRpcPlugin,代码行数:40,代码来源:ticket.py


示例19: 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')
     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,),
             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:nyuhuhuu,项目名称:trachacks,代码行数:23,代码来源:fulltextsearch.py


示例20: __init__

 def __init__(self, env, tkt_id=None, version=None):
     self.env = env
     self.fields = TicketSystem(self.env).get_ticket_fields()
     self.editable_fields = \
         set(f['name'] for f in self.fields
                       if f['name'] not in self.protected_fields)
     self.std_fields, self.custom_fields, self.time_fields = [], [], []
     for f in self.fields:
         if f.get('custom'):
             self.custom_fields.append(f['name'])
         else:
             self.std_fields.append(f['name'])
         if f['type'] == 'time':
             self.time_fields.append(f['name'])
     self.values = {}
     if tkt_id is not None:
         tkt_id = int(tkt_id)
         self._fetch_ticket(tkt_id)
     else:
         self._init_defaults()
         self.id = None
     self.version = version
     self._old = {}
开发者ID:pkdevbox,项目名称:trac,代码行数:23,代码来源:model.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python batch.BatchModifyModule类代码示例发布时间:2022-05-27
下一篇:
Python ticket.Ticket类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap