本文整理汇总了Python中trac.ticket.Ticket.values['reporter']方法的典型用法代码示例。如果您正苦于以下问题:Python Ticket.values['reporter']方法的具体用法?Python Ticket.values['reporter']怎么用?Python Ticket.values['reporter']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.ticket.Ticket
的用法示例。
在下文中一共展示了Ticket.values['reporter']方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_ticket_for_lineitem
# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['reporter'] [as 别名]
def create_ticket_for_lineitem (self, req, id, addMesage, lineitem, summary=None):
#skip line items that have a ticket
if re.search('/ticket/\d+', lineitem.description): return
compname = 'Estimate-'+str(id)
if summary: compname = summary
ensure_component(self.env, compname, req.authname)
t = Ticket(self.env)
# try to split on a newline or space that is less than 80 chars into the string
idx = lineitem.description.find('\n', 0, 80)
if idx < 0: idx = lineitem.description.find(' ', 45, 80)
if idx < 0: idx = 45
summary = lineitem.description[:idx]
desc = lineitem.description
desc += "\n\nFrom [/Estimate?id=%s Created From Estimate %s]" % \
(lineitem.estimate_id,lineitem.estimate_id)
t.values['summary'] = summary
t.values['description'] = desc
t.values['status'] = 'new'
t.values['reporter'] = req.authname
t.values['component'] = compname
t.values['estimatedhours'] = avg(lineitem.low, lineitem.high)
t.insert()
lineitem.description+="\n\nCreated as /ticket/%s" % (t.id, )
return t
示例2: import_tickets
# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['reporter'] [as 别名]
def import_tickets(self):
trac_cursor = self.env.get_db_cnx().cursor()
peer = SymfonyErrorPeer(self.env)
owners = {}
trac_cursor.execute("select owner, name from component")
for name, owner in trac_cursor:
owners[name] = owner
for error in peer.select_grouped():
# ticket with current hash key not exists ?
trac_cursor.execute("select ticket from ticket_custom where name = 'symfony_error_key' and value = '%s'" % error['hash_key'])
existing = trac_cursor.fetchone()
if not existing:
ticket = Ticket(self.env)
ticket.values['summary'] = 'Bug #' + error['hash_key'] + ' ' + error['message']
ticket.values['symfony_error_key'] = error['hash_key']
ticket.values['reporter'] = 'cron'
ticket.values['resolution'] = 'new'
ticket.values['status'] = 'new'
ticket.values['milestone'] = '0.3.1'
if error['module_name'] in owners:
owner = owners[error['module_name']]
else:
owner = self.default_owner
ticket.values['owner'] = owner
ticket.insert()
示例3: _do_create
# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['reporter'] [as 别名]
def _do_create(self, req, db):
if not req.args.get('summary'):
raise TracError(u'Les tickets doivent contenir un intitulé.')
ticket = Ticket(self.env, db=db)
ticket.populate(req.args)
ticket.values['reporter'] = get_reporter_id(req, 'reporter')
self._validate_ticket(req, ticket)
ticket.insert(db=db)
db.commit()
# Notify
try:
tn = TicketNotifyEmail(self.env)
tn.notify(ticket, newticket=True)
except Exception, e:
self.log.exception(u"Impossible d'envoyer une notification sur la création du "
u"ticket #%s: %s" % (ticket.id, e))
示例4: _do_create
# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['reporter'] [as 别名]
def _do_create(self, req, db):
if not req.args.get('summary'):
raise TracError('Tickets must contain a summary.')
ticket = Ticket(self.env, db=db)
ticket.populate(req.args)
ticket.values['reporter'] = get_reporter_id(req, 'reporter')
self._validate_ticket(req, ticket)
ticket.insert(db=db)
db.commit()
# Notify
try:
tn = TicketNotifyEmail(self.env)
tn.notify(ticket, newticket=True)
except Exception, e:
self.log.exception("Failure sending notification on creation of "
"ticket #%s: %s" % (ticket.id, e))
示例5: process_request
# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['reporter'] [as 别名]
def process_request(self, req):
req.perm.assert_permission('TICKET_CREATE')
db = self.env.get_db_cnx()
if req.method == 'POST' and 'owner' in req.args and \
not req.perm.has_permission('TICKET_MODIFY'):
del req.args['owner']
if req.method == 'POST' and not req.args.has_key('preview'):
self._do_create(req, db)
ticket = Ticket(self.env, db=db)
ticket.populate(req.args)
ticket.values['reporter'] = get_reporter_id(req, 'reporter')
if ticket.values.has_key('description'):
description = wiki_to_html(ticket['description'], self.env, req, db)
req.hdf['newticket.description_preview'] = description
req.hdf['title'] = u'Nouveau ticket'
req.hdf['newticket'] = ticket.values
field_names = [field['name'] for field in ticket.fields
if not field.get('custom')]
if 'owner' in field_names:
curr_idx = field_names.index('owner')
if 'cc' in field_names:
insert_idx = field_names.index('cc')
else:
insert_idx = len(field_names)
if curr_idx < insert_idx:
ticket.fields.insert(insert_idx, ticket.fields[curr_idx])
del ticket.fields[curr_idx]
for field in ticket.fields:
name = field['name']
del field['name']
if name in ('summary', 'reporter', 'description', 'type', 'status',
'resolution'):
field['skip'] = True
elif name == 'owner':
field['label'] = u'Assigner à'
if not req.perm.has_permission('TICKET_MODIFY'):
field['skip'] = True
elif name == 'milestone':
# Don't make completed milestones available for selection
options = field['options'][:]
for option in field['options']:
milestone = Milestone(self.env, option, db=db)
if milestone.is_completed:
options.remove(option)
field['options'] = options
field['label'] = translate(self.env, field['label'])
req.hdf['newticket.fields.' + name] = field
if req.perm.has_permission('TICKET_APPEND'):
req.hdf['newticket.can_attach'] = True
req.hdf['newticket.attachment'] = req.args.get('attachment')
add_stylesheet(req, 'common/css/ticket.css')
return 'newticket.cs', None
示例6: generateTracTickets
# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['reporter'] [as 别名]
def generateTracTickets( self, req ) :
"""
ok, it's a post so we know we are supposed to go ahead and create some TRAC tickets...the parameters that we care about are:
#users ...this will be a list...
#testtemplates ... this will be a list...
#testcases ... this will be a list...
#version...this will be a string...
#milestone...this will be a string...
This method does one of two things. It will either return: "True, URL" if ticket creation based on user input was succesful or "False, ErrorMessage" if
the ticket creation failed.
"""
#grab the parameters that we care about out of the request object
testRunDescription = str( req.args.get('testrundescription') )
users = req.args.get('users')
testTemplates = req.args.get('testtemplates')
testcases = req.args.get('testcases')
version = str( req.args.get('selectedversion'))
milestone = str( req.args.get('selectedmilestone'))
#-----------------------------------ERROR CHECKING ON PARAMETERS--------------------------------------------
if version == None:
version = ""
if milestone == None:
milestone = ""
if users == None :
return False, "No users selected for test run"
if isinstance( users, unicode):
users = [users.encode('ascii', 'ignore')]
version = version.encode('ascii', 'ignore').strip()
milestone = milestone.encode('ascii', 'ignore').strip()
if testcases == None :
testcases = [] #so we don't get a blow up later...
if testTemplates == None :
return False, "must select at least one testcase or test template to create a test run"
return 'errorCreatingTestRun.cs', None
elif testTemplates == None :
testTemplates = []
#create combined testcase list
testcases = self.createCombinedTestCaseList( testTemplates, testcases, req )
allTestcases = self.properties.getTestCases( self, req ) #fetch the testcases...
if allTestcases == None :
return False, None
#--------------------------------------------DONE ERROR CHECKING -----------------------------------------------
#ok this is where we actually create the tickets...
db = self.env.get_db_cnx()
for aUser in users :
for testId in testcases :
testId = testId.encode('ascii', 'ignore').strip()
if testId in allTestcases :
test = allTestcases[ testId ]
ticket = Ticket(self.env, db=db)
ticket.populate(req.args)
ticket.values['reporter'] = req.authname #the reporter is whoever is logged in
ticket.values['summary'] = "TestID: " + test.getId() + " -- " + test.getSummary()
ticket.values['description'] = "''''''Test Details:''''''\n\n" + test.getDescription() + "\n\n''''''Expected result:'''''' \n\n" + test.getExpectedResult()
ticket.values['type'] = 'testcase'
ticket.values['status'] = 'new'
ticket.values['action'] = 'create'
ticket.values['component'] = test.getComponent()
ticket.values['owner'] = aUser
ticket.values['version'] = version
ticket.values['milestone'] = milestone
ticket.values['keywords'] = "Test_ver" + version + "_mile_" + milestone
#self._validate_ticket(req, ticket) #probably should validate the ticket here.
ticket.insert(db=db)
db.commit()
else:
return False, "The test " + testId + " specified in a test template or as the testcaseID in the test file does not exist in the master test list "
#ok blow away the session vars incase someone trys to refresh the created test run page...no need to recreate all the tickets again...
#thanks to the haxs in the reporty.py module...
for var in ('users', 'testcases', 'testtemplates','milestone','version'):
if req.session.has_key(var):
del req.session[var]
#redirect to a custom query report showing the created tickets
return True, req.base_url + "/query?status=new&status=assigned&status=reopened&testcase_result=&version=" + version + "&milestone=" + milestone + "&type=testcase&order=priority&group=owner"
示例7: process_request
# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['reporter'] [as 别名]
def process_request(self, req):
req.perm.assert_permission('TICKET_CREATE')
db = self.env.get_db_cnx()
if req.method == 'POST' and 'owner' in req.args and \
not req.perm.has_permission('TICKET_MODIFY'):
del req.args['owner']
if req.method == 'POST' and not req.args.has_key('preview'):
self._do_create(req, db)
ticket = Ticket(self.env, db=db)
ticket.populate(req.args)
ticket.values['reporter'] = get_reporter_id(req, 'reporter')
if ticket.values.has_key('description'):
description = wiki_to_html(ticket['description'], self.env, req, db)
req.hdf['newticket.description_preview'] = description
req.hdf['title'] = 'New Ticket'
req.hdf['newticket'] = ticket.values
field_names = [field['name'] for field in ticket.fields
if not field.get('custom')]
if 'owner' in field_names:
curr_idx = field_names.index('owner')
if 'cc' in field_names:
insert_idx = field_names.index('cc')
else:
insert_idx = len(field_names)
if curr_idx < insert_idx:
ticket.fields.insert(insert_idx, ticket.fields[curr_idx])
del ticket.fields[curr_idx]
#处理newticket页面的表单
for field in ticket.fields:
name = field['name']
del field['name']
if name in ('summary', 'reporter', 'description', 'type', 'status',
'resolution'):
field['skip'] = True
elif name == 'owner':
field['label'] = 'Assign to'
if not req.perm.has_permission('TICKET_MODIFY'):
field['skip'] = True
elif name == 'milestone':
# Don't make completed milestones available for selection
options = field['options'][:]
for option in field['options']:
milestone = Milestone(self.env, option, db=db)
if milestone.is_completed:
options.remove(option)
field['options'] = options
#原来的field:newticket.fields
#现在的field:newticket.fields.name.field
# 下面是汉化:(不在上面完成,而是在这里统一加入代码
#field['label']与field['name']都是可以的:
#<?cs alt:field.label ?><?cs var:field.name ?>
if name == 'priority':
field['label'] = u'優先'
elif name == 'owner':
field['label'] = u'指派給'
elif name == 'keywords':
field['label'] = u'關鍵字'
elif name == 'version':
field['label'] = u'版本'
elif name == 'milestone':
field['label'] = u'里程碑'
elif name == 'component':
field['label'] = u'组件'
elif name == 'cc':
field['label'] = u'附件給'
req.hdf['newticket.fields.' + name] = field
if req.perm.has_permission('TICKET_APPEND'):
req.hdf['newticket.can_attach'] = True
req.hdf['newticket.attachment'] = req.args.get('attachment')
add_stylesheet(req, 'common/css/ticket.css')
return 'newticket.cs', None
示例8: generateTracTickets
# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['reporter'] [as 别名]
#.........这里部分代码省略.........
if version == None:
version = ""
if milestone == None:
milestone = ""
if users == None :
return False, "No users selected for test run"
#check to see if the user, templates or testcases parameters is a str/unicode or a list (well if it isn't a unicode or str then it is a list)
if isinstance( users, unicode):
users = [users]
if isinstance( users, str):
users = [TracText.to_unicode ( users )]
if isinstance( testcases, unicode) :
testcases = [testcases]
if isinstance( testcases, str ):
testcases = [testcases]
if isinstance( testTemplates, unicode) :
testTemplates = [testTemplates]
if isinstance( testTemplates, str ):
testTemplates = [TracText.to_unicode ( testTemplates) ]
version = TracText.to_unicode ( version).strip()
milestone = TracText.to_unicode ( milestone ).strip()
if testcases == None :
testcases = [] #so we don't get a blow up later...
if testTemplates == None :
return False, "must select at least one testcase or test template to create a test run"
elif testTemplates == None :
testTemplates = []
#--------------------------------------------DONE ERROR CHECKING -----------------------------------------------
#create combined testcase list
testcases = self.createCombinedTestCaseList( testTemplates, testcases, req )
allTestcases, errors = self.properties.getTestCases( self, req ) #fetch the testcases...
if errors :
return False, errors
if allTestcases == None :
return False, None
#one last validation step
errorMessages = []
for aUser in users :
for testId in testcases :
testId = TracText.to_unicode( testId ).strip()
if testId in allTestcases :
continue
else:
self.env.log.info( "Testcase : " + testId + " not found in master list " )
errorMessages.append( "The test: " + testId + ", doesn't match it's file name or you've specified it wrong in the testtemplates.xml file" )
if errorMessages:
return False, errorMessages
#ok this is where we actually create the tickets...
db = self.env.get_db_cnx()
for aUser in users :
for testId in testcases :
testId = testId.encode('ascii', 'ignore').strip()
if testId in allTestcases :
test = allTestcases[ testId ]
ticket = Ticket(self.env, db=db)
ticket.populate(req.args)
ticket.values['reporter'] = req.authname #the reporter is whoever is logged in
ticket.values['summary'] = "TestID: " + test.getId() + " -- " + testConfiguration
ticket.values['description'] = "''''''Test Details:''''''\n\n" + test.getDescription() + "\n\n''''''Expected result:'''''' \n\n" + test.getExpectedResult()
ticket.values['type'] = 'testcase'
ticket.values['status'] = 'new'
ticket.values['action'] = 'create'
ticket.values['component'] = test.getComponent()
ticket.values['owner'] = aUser
ticket.values['version'] = version
ticket.values['milestone'] = milestone
ticket.values['keywords'] = testRunKeyWord
#self._validate_ticket(req, ticket) #probably should validate the ticket here.
ticket.insert(db=db)
db.commit()
else:
return False, "The test " + testId + " specified in a test template or as the testcaseID in the test file does not exist in the master test list "
#ok blow away the session vars incase someone trys to refresh the created test run page...no need to recreate all the tickets again...
#thanks to the haxs in the reporty.py module...
for var in ('users', 'testcases', 'testtemplates','milestone','version'):
if req.session.has_key(var):
del req.session[var]
#redirect to a custom query report showing the created tickets
return True, req.base_url + "/query?status=new&status=assigned&status=reopened&status=accepted&testcase_result=&version=" + version + "&milestone=" + milestone + "&type=testcase&order=priority&group=owner"