本文整理汇总了Python中vilya.models.project_issue.ProjectIssue类的典型用法代码示例。如果您正苦于以下问题:Python ProjectIssue类的具体用法?Python ProjectIssue怎么用?Python ProjectIssue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProjectIssue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_gets_by_project_ids
def test_gets_by_project_ids(self):
p1 = ProjectIssue.add('test1', 'desp', 'test', project=1)
p2 = ProjectIssue.add('test2', 'desp', 'test2', project=2)
p3 = ProjectIssue.add('test3', 'desp', 'test3', project=2)
issues = ProjectIssue.gets_by_project_ids([1, 2])
assert len(issues), 3
for p in [p1, p2, p3]:
p.delete()
开发者ID:000fan000,项目名称:code,代码行数:10,代码来源:test_project_issue.py
示例2: main
def main():
rs = store.execute("select id, project_id, issue_id, number from project_issues")
if rs:
for r in rs:
pi = ProjectIssue(*r)
pi.update_rank_score()
rs = store.execute("select id, team_id, issue_id, number from team_issues")
if rs:
for r in rs:
ti = TeamIssue(*r)
ti.update_rank_score()
开发者ID:leeccong,项目名称:code,代码行数:11,代码来源:init_rank_score.py
示例3: test_zero_vote_and_zero_comment_display
def test_zero_vote_and_zero_comment_display(self):
app = TestApp(M.app)
project_name = "project"
delete_project(project_name)
project = CodeDoubanProject.add(
project_name, owner_id="test1", summary="test", product="fire")
ProjectIssue.add('test', 'test description', 'test',
project=project.id)
resp = app.get(project.url + "/issues/")
assert resp.status_int == 200
assert 'Issues' in resp.body
assert '0 vote' not in resp.body
assert '0 comment' not in resp.body
开发者ID:000fan000,项目名称:code,代码行数:14,代码来源:test_issue_votes_and_comments_count_display.py
示例4: _get_issue_comment_by_uid
def _get_issue_comment_by_uid(uid):
issue = {}
# uid: issue-type-id-number
if uid and uid.startswith('issue-'):
fields = uid.split('-')
if len(fields) != 6:
return issue
_, _, type, id, number, comment_number = fields
if type == 'project':
_issue = ProjectIssue.get(id, number=number)
_issue = Issue.get_cached_issue(_issue.issue_id)
_target = _get_project_by_name(_issue.target.name)
elif type == 'team':
_issue = TeamIssue.get(id, number=number)
_issue = Issue.get_cached_issue(_issue.issue_id)
_target = _get_team_by_uid(_issue.target.uid)
else:
return issue
_author = _get_user_by_name(_issue.creator_id)
_closer = _get_user_by_name(_issue.closer_id) if _issue.closer_id else {}
issue = dict(
id=_issue.issue_id,
name=_issue.title,
author=_author,
closer=_closer,
)
issue[_issue.target_type] = _target
return issue
开发者ID:000fan000,项目名称:code,代码行数:28,代码来源:timeline.py
示例5: _q_lookup
def _q_lookup(self, request, issue_number):
repo = self.repo
issue = ProjectIssue.get(project_id=repo.id,
number=issue_number)
if not issue:
raise api_errors.NotFoundError('project issue')
return IssueUI(request, repo, issue)
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:issues.py
示例6: test_single_project
def test_single_project(self):
skip_test()
u_to = User("admin")
u_from = User("testuser")
to_proj = self._prj("test", "admin")
self._add(to_proj, u_to, "README.md", "hi")
from_proj = self._prj("testuser/test", "testuser", to_proj.id)
self._add(from_proj, u_from, "README.md", "hello")
pullreq = PullRequest.open(from_proj, "master", to_proj, "master")
ticket = Ticket(None, None, to_proj.id, "title", "desc", "testuser",
None, None)
pullreq = add_pull(ticket, pullreq, u_from)
iss = ProjectIssue.add(title='title1', description='desc1',
creator='owner', project=to_proj.id)
IssuePRSearch.index_a_project(to_proj)
res = IssueSearch.search_a_phrase('title1', to_proj.id)
res = SearchEngine.decode(res, ('issue_id',))
res = [id for id, in res]
assert len(res) == 1
assert res[0] == iss.id
res = PullRequestSearch.search_a_phrase('title', to_proj.id)
res = SearchEngine.decode(res, ('issue_id',))
res = [id for id, in res]
assert len(res) == 1
开发者ID:leeccong,项目名称:code,代码行数:25,代码来源:test_search.py
示例7: index_a_project_issue
def index_a_project_issue(cls, project):
issues = ProjectIssue._get_issues_by_project_id(project.id)
for issue in issues:
data = issue.as_dict()
if data:
serial = "%s_%s" % (project.index_name, issue.number)
cls.index_an_object(serial, data)
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:issue_pr_search.py
示例8: setUp
def setUp(self):
super(ProjectIssueCommentsTest, self).setUp()
project_name = "code"
product_name = "fire"
summary = "test"
owner_id = "lisong_intern"
delete_project(project_name)
project = CodeDoubanProject.add(
project_name,
owner_id=owner_id,
summary=summary,
product=product_name
)
self.project = project
title = "test title"
description = "test desc"
creator = "test"
issue = ProjectIssue.add(
title,
description,
creator,
project=self.project.id
)
self.issue = issue
self.project = project
self.comment1 = IssueComment.add(
self.issue.issue_id, 'content1', 'test1')
self.comment2 = IssueComment.add(
self.issue.issue_id, 'content2', 'test2')
self.api_token = self.create_api_token('test1')
self.api_token2 = self.create_api_token('test2')
开发者ID:000fan000,项目名称:code,代码行数:31,代码来源:test_project_issue_comments.py
示例9: __init__
def __init__(self, issue_id, description, hl_description):
self.issue = ProjectIssue.get_by_issue_id(issue_id) \
if issue_id else None
if self.issue and self.issue.description:
description = self.issue.description
self.description = description
self.hl_description = hl_description or description
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:issue_pr_search.py
示例10: test_add_issue
def test_add_issue(self):
p = ProjectIssue.add('test', 'test description', 'test', project=1)
assert isinstance(p, ProjectIssue)
assert p.title == 'test'
assert p.description == 'test description'
assert p.project_id == 1
p.delete()
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:test_project_issue.py
示例11: create
def create(self, request):
if request.method == 'POST':
user = request.user
if not user:
raise AccessError
project = request.get_form_var('project')
title = request.get_form_var('title', '').decode('utf-8')
description = request.get_form_var('body', '').decode('utf-8')
tags = request.get_form_var('issue_tags', [])
if isinstance(tags, list):
tags = [tag.decode('utf-8') for tag in tags if tag]
elif isinstance(tags, basestring):
tags = [tags.decode('utf-8')]
if not project:
raise TraversalError
if not title.strip():
return request.redirect('/%s/issues/new?error=empty' % project)
project = CodeDoubanProject.get_by_name(project)
pissue = ProjectIssue.add(title, description, user.name,
project=project.id)
pissue.add_tags(tags, pissue.project_id)
# TODO: 重构feed后取消信号发送
issue_signal.send(author=user.name, content=description,
issue_id=pissue.issue_id)
dispatch('issue', data={
'sender': user.name,
'content': description,
'issue': pissue
})
return request.redirect(pissue.url)
project_name = self.proj_name
return request.redirect('/%s/issues' % project_name)
开发者ID:000fan000,项目名称:code,代码行数:33,代码来源:issue.py
示例12: _q_index
def _q_index(request):
user = request.user
my_issues = []
if user:
username = user.username
your_projects = CodeDoubanProject.get_projects(owner=username,
sortby='lru')
watched_projects = CodeDoubanProject.get_watched_others_projects_by_user( # noqa
user=username,
sortby='lru')
teams = Team.get_by_user_id(user.name)
actions = get_user_inbox(username).get_actions(
stop=PAGE_ACTIONS_COUNT - 1)
badge_items = user.get_badge_items()
# pull request
# your_tickets = user.get_user_pull_requests_rank(limit=5)
your_tickets = user.get_user_submit_pull_requests(limit=5)
# issue
project_ids = CodeDoubanProject.get_ids(user.name)
dt = {
'state': "open",
'limit': 5,
'start': 0,
}
my_issues = ProjectIssue.gets_by_project_ids(project_ids, **dt)
return st('newsfeed.html', **locals())
return request.redirect("/teams/")
开发者ID:000fan000,项目名称:code,代码行数:32,代码来源:__init__.py
示例13: setUp
def setUp(self):
TestCase.setUp(self)
self.testuser1 = 'testuser1'
self.testuser2 = 'testuser2'
self.testuser3 = 'testuser3'
self.test_team_issue = TeamIssue.add('test', 'test description',
self.testuser1, team=1)
self.test_project_issue = ProjectIssue.add(
'test', 'test description', self.testuser1, project=1)
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:test_issue_upvote.py
示例14: get
def get(self, request):
page = int(request.get_form_var('page', 1))
count = int(request.get_form_var('count', 25))
start = (page - 1) * count
state = request.get_form_var('state', None)
project = self.project
project_issues = ProjectIssue.gets_by_target(project.id, state=state,
start=start, limit=count)
return [issue.as_dict() for issue in project_issues]
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:issue.py
示例15: __init__
def __init__(self, proj_name, issue_number):
self.target = CodeDoubanProject.get_by_name(proj_name)
self.issue_number = issue_number
project_issue = ProjectIssue.get(self.target.id,
number=self.issue_number)
self.issue_id = project_issue.issue_id
self.issue = Issue.get_cached_issue(self.issue_id)
self.issue_template = 'issue/issue.html'
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:issue.py
示例16: test_gets_by_project_ids
def test_gets_by_project_ids(self):
ProjectIssue.add('test1', 'desp', 'test', project=1)
ProjectIssue.add('test2', 'desp', 'test2', project=2)
ProjectIssue.add('test3', 'desp', 'test3', project=2)
issues = ProjectIssue.gets_by_project_ids([1, 2])
assert len(issues), 3
开发者ID:leeccong,项目名称:code,代码行数:8,代码来源:test_project_issue.py
示例17: test_upate_issue_not_author_fail
def test_upate_issue_not_author_fail(self):
issue = ProjectIssue.add("old title", "old desc", self.username, project=self.project.id)
title = "new title"
description = "new desc"
ret = self.app.patch_json(
"/api/%s/issues/%s/" % (self.project.name, issue.number),
dict(title=title, description=description),
headers=dict(Authorization="Bearer %s" % self.api_token2.token),
status=403,
).json
self.assertProblemType(ret["type"], "not_the_author")
开发者ID:leeccong,项目名称:code,代码行数:11,代码来源:test_project_issue.py
示例18: _get_closed_multi
def _get_closed_multi(self):
milestone = self.milestone
tasks = []
rs = IssueMilestone.gets_by(milestone_id=milestone.id)
for r in rs:
issue = ProjectIssue.get_by_issue_id(r.issue_id)
if not issue:
continue
if issue.closer_id:
tasks.append(r)
return tasks
开发者ID:000fan000,项目名称:code,代码行数:11,代码来源:milestone_task.py
示例19: test_multiple_project
def test_multiple_project(self):
skip_test()
p1 = self._prj("test_1")
p2 = self._prj("test_2")
iss1 = ProjectIssue.add(title='title1', description='desc1',
creator='owner', project=p1.id)
iss2 = ProjectIssue.add(title='title1', description='desc1',
creator='owner', project=p2.id)
IssueSearch.index_a_project_issue(p1)
IssueSearch.index_a_project_issue(p2)
res = IssueSearch.search_a_phrase('title1', p1.id)
res = SearchEngine.decode(res, ('issue_id',))
res = [id for id, in res]
assert len(res) == 1
assert res[0] == iss1.id
res = IssueSearch.search_a_phrase('title1', p2.id)
res = SearchEngine.decode(res, ('issue_id',))
res = [id for id, in res]
assert len(res) == 1
assert res[0] == iss2.id
开发者ID:leeccong,项目名称:code,代码行数:20,代码来源:test_search.py
示例20: test_get_single_issue
def test_get_single_issue(self):
title = "test title"
description = "test desc"
creator = "test"
issue = ProjectIssue.add(title, description, creator, project=self.project.id)
IssueComment.add(issue.issue_id, "content", "test")
ret = self.app.get("/api/%s/issues/%s/" % (self.project.name, issue.number), status=200).json
self.assertEquals(ret["title"], title)
self.assertEquals(ret["description"], description)
self.assertEquals(ret["creator"], creator)
self.assertEquals(ret["project"], self.project.name)
self.assertEquals(ret["comments"], 1)
开发者ID:leeccong,项目名称:code,代码行数:12,代码来源:test_project_issue.py
注:本文中的vilya.models.project_issue.ProjectIssue类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论