本文整理汇总了Python中issues.models.Issue.by_tracker_id方法的典型用法代码示例。如果您正苦于以下问题:Python Issue.by_tracker_id方法的具体用法?Python Issue.by_tracker_id怎么用?Python Issue.by_tracker_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类issues.models.Issue
的用法示例。
在下文中一共展示了Issue.by_tracker_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sync
# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import by_tracker_id [as 别名]
def sync(self, tracker):
server = ServerProxy(tracker.config, allow_none=True,
use_datetime=datetime)
last_update = DateTime(time.mktime(tracker.last_update.timetuple()))
users = self._get_users(server)
ids = map(int, server.filter('issue', None, {'activity':
str(last_update)}))
for issue_id in ids:
data = server.display('issue%d' % issue_id, 'title', 'creation',
'creator', 'assignedto', 'activity',
'messages', 'status')
issue = Issue.by_tracker_id(tracker.id, issue_id)
issue.no = issue_id
issue.set_title(data.get('title', ''))
issue.set_description(self._get_description(
server, data.get('messages', [])))
issue.reporter = users[int(data['creator'])]
issue.owner = users[int(data['assignedto'])]
issue.last_change = _roundup_date_to_datetime(data.get('activity'))
status = int(data.get('status', -1))
issue.active = status in ACTIVE_STATUS
issue.tracker = tracker
if not issue.id:
issue.created = datetime.now()
issue.updated = datetime.now()
issue.save()
post_issue_sync.send(sender=self, issue=issue)
self._update_user_data(server, data, issue, users)
tracker.last_update = datetime.now() - timedelta(days=1)
tracker.save()
post_tracker_sync.send(sender=self, tracker=tracker)
return True
示例2: str
# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import by_tracker_id [as 别名]
err.errcode, err.errmsg))
return False
except Error, err:
self._log.error('Error: %s' % err)
return False
except:
self._log.error('Unknown error: %s' % str(sys.exc_info()[1]))
return False
self._log.info('Trac XMLRPC-API version: %s' % '.'.join(map(
str, api_version)))
d = DateTime(time.mktime(tracker.last_update.timetuple()))
self._log.info('Last update: %s' % d)
tids = server.ticket.getRecentChanges(d)
self._log.info('Issue updates: %s' % `tids`)
for tid in tids:
issue = Issue.by_tracker_id(tracker.id, tid)
id_, cr_date, last_change, data = server.ticket.get(tid)
#if isinstance(cr_date, int):
#cr_date = datetime.fromtimestamp(cr_date)
#last_change = datetime.fromtimestamp(last_change)
issue.no = id_
issue.set_title(data.get('summary', ''))
issue.set_description(data.get('description', ''))
issue.reporter = data.get('reporter')
issue.owner = data.get('owner')
issue.last_change = last_change
issue.tracker = tracker
# Only default status values are allowed as Trac allows renaming
# of status values.
resolution = data.get('resolution')
issue.active = resolution in ACTIVE_STATUS