本文整理汇总了Python中models.Issue类的典型用法代码示例。如果您正苦于以下问题:Python Issue类的具体用法?Python Issue怎么用?Python Issue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Issue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
def post(self, slug):
"Create an issue against this project"
project = Project.all().filter('slug =', slug).fetch(1)[0]
# get details from the form
name = self.request.get("name")
description = self.request.get("description")
email = self.request.get("email")
try:
if Issue.all().filter('name =', name).filter('project =', project).count() == 0:
issue = Issue(
name=name,
description=description,
project=project,
)
if email:
issue.email = email
issue.put()
mail.send_mail(sender="[email protected]",
to=project.user.email(),
subject="[GitBug] New bug added to %s" % project.name,
body="""You requested to be emailed when a bug on GitBug was added:
Issue name: %s
Description: %s
Thanks for using GitBug <http://gitbug.appspot.com>. A very simple issue tracker.
""" % (issue.name, issue.description))
logging.info("issue created: %s in %s" % (name, project.name))
except Exception, e:
logging.error("error adding issue: %s" % e)
示例2: get_digest
def get_digest(self):
"""
builds a DigestData instance filled with the digest
"""
issue_list = list(self.get_issues())
digest = DigestData()
digest.user = self._user
digest.repo = self._repository_name
for github_issue in issue_list:
if github_issue.state == IssueStates.OPEN:
digest.total_opened += 1
elif github_issue.state == IssueStates.CLOSED:
digest.total_closed += 1
digest.total_issues += 1
issue = Issue()
issue.url = github_issue.html_url
issue.label = '{}/{}#{}'.format(self._user, self._repository_name, github_issue.number)
issue.title = github_issue.title
issue.state = github_issue.state
github_user = github_issue.user
display_name = github_user.name or github_user.login
if display_name not in digest.users:
user = User()
user.name = display_name
user.gravatar = github_user.avatar_url
digest.users[display_name] = user
digest.issues.setdefault(display_name, []).append(issue)
return digest
示例3: add_issue
def add_issue():
""" Create an issue """
data = request.get_json()
if 'title' in data and 'description' in data and data['title'].strip():
issue = Issue(data['title'].strip(), data['description'].strip(), current_user.id)
db.session.add(issue)
db.session.commit()
return jsonify(issue.to_dict()), 201
return 'Invalid title or description', 422
示例4: get
def get(self, slug):
output = get_cache("project_%s_rss" % slug)
if output is None:
project = Project.all().filter('slug =', slug).fetch(1)[0]
# allow query string arguments to specify filters
if self.request.get("open"):
status_filter = True
fixed = False
elif self.request.get("closed"):
status_filter = True
fixed = True
else:
status_filter = None
# if we have a filter then filter the results set
if status_filter:
issues = Issue.all().filter('project =', project).filter('fixed =', fixed).order('fixed').order('created_date')
else:
issues = Issue.all().filter('project =', project).order('fixed').order('created_date')
# create the RSS feed
rss = RSS2(
title="Issues for %s on GitBug" % project.name,
link="%s/%s/" % (settings.SYSTEM_URL, project.slug),
description="",
lastBuildDate=datetime.now()
)
# add an item for each issue
for issue in issues:
if issue.fixed:
pubDate = issue.fixed_date
title = "%s (%s)" % (issue.name, "Fixed")
else:
pubDate = issue.created_date
title = issue.name
rss.items.append(
RSSItem(
title=title,
link="%s/projects%s" % (settings.SYSTEM_URL, issue.internal_url),
description=issue.html,
pubDate=pubDate
))
# get the xml
output = rss.to_xml()
memcache.add("project_%s_rss" % slug, output, 3600)
# send the correct headers
self.response.headers["Content-Type"] = "application/rss+xml; charset=utf8"
self.response.out.write(output)
示例5: save_issue
def save_issue(request):
requester = models.Ti_user.objects.get(id=request.user.id)
title = request.POST.get('title')
description = request.POST.get('description')
severity = request.POST.get('severity')
department = models.Department.objects.get(department_name=request.POST.get('department'))
issue = Issue(title = title, description = description, requester = requester, assigned_group = department, Severity = severity)
issue.save()
print issue.id
comments = models.Comment.objects.filter(issue_id=issue.id).order_by('-created_time')
return HttpResponseRedirect('/issue/%s' %issue.id)
示例6: test_issue_creation
def test_issue_creation(self):
c = Category.objects.all()[0]
i = Issue(summary="Test",
description="Test",
reporter_name="User",
reporter_email="[email protected]",
urgent=True,
category=c)
i.save()
iid = i.id
i = Issue.objects.get(id=iid)
self.failUnlessEqual(i.summary, "Test")
示例7: test_issue
def test_issue(self):
issue = Issue(
user=self.user,
project=self.project,
id=42,
title="Wrong encoding",
action="opened",
url="http://bugtracker.example.com/issue/42"
)
self.assertEqual(
issue.render_simple(),
"[My Project] Mrs Foobar opened issue #42: Wrong encoding. "
"(http://bugtracker.example.com/issue/42)"
)
示例8: save_issues
def save_issues(issues, project, fetch_index):
for issue in issues:
Issue.create(
fetch_index=fetch_index,
github_id=issue['id'],
project=project,
number=issue['number'],
created_at=issue['created_at'],
updated_at=issue['updated_at'],
closed_at=issue['closed_at'],
state=issue['state'],
body=issue['body'],
comments=issue['comments'],
user_id=issue['user']['id'],
)
示例9: get
def get(self):
user = users.get_current_user()
if user:
logout_url = users.create_logout_url('/')
else:
login_url = users.create_login_url('/')
issues = Issue.all().order('creation_date').fetch(30)
success_type = self.request.get('success')
success_msg = None
if success_type == 'vote':
success_msg = 'Your vote was successfully cast!'
if success_type == 'updated':
success_msg = 'Your vote was successfully updated!'
created_by = Issue.issues_created_by(member=user,limit=20)
voted_on = Issue.issues_voted_on(member=user,limit=20)
#recent_results = [issue for issue in voted_on if issue.has_results]
recent_voted = [issue for issue in voted_on if issue.is_active()]
recent_results = Issue.recent_results(limit=20)
self.response.out.write(template.render('templates/overview.html', locals()))
示例10: add_issue_to_database
def add_issue_to_database(request):
issue = request.session.get('issue', False)
service = Service.objects.get(name=issue['service'])
try:
db_issue = Issue.objects.get(service=service, number=issue['number'], project=issue['project'])
if db_issue.status == "paid":
error = "I see that issue has been closed and paid already."
messages.error(request, error)
return False
except:
db_issue = Issue(
service=service,
number=issue['number'],
project=issue['project'],
user=issue.has_key('user') and issue['user'] or '',
title=issue['title'],
content=issue['content'][:350],
status = issue['status'])
filename, file = get_image_for_issue(service, issue)
if filename:
db_issue.image.save(filename, file)
db_issue.save()
if not settings.DEBUG:
create_comment(db_issue)
ends = issue['limit']
hour_day = ends[-1]
number = ends.rstrip(hour_day)
if hour_day == "h":
limit = datetime.timedelta(hours=int(number))
else:
limit = datetime.timedelta(days=int(number))
bounty = Bounty(user=request.user, issue=db_issue, price=issue['bounty'], ends=datetime.datetime.now()+limit )
bounty.save()
alert_watchers_increase(db_issue, int(request.GET.get('bounty', 0)))
del request.session['issue']
return True
示例11: create
def create(env, data, nxt):
data.form = form = IssueForm(env)
db = env.db
if env.request.method == 'POST':
if form.accept(env.request.POST):
deadline = form.python_data['deadline']
text = form.python_data['issue']
title, body = text, ''
chunks = text.split('\r\n\r\n', 1)
if len(chunks) > 1:
title, body = chunks
issue = Issue(title=title, proj=data.project,
author=env.user, deadline=deadline)
issue.executor = form.python_data['executor']
db.add(issue)
if body:
comment = Comment(issue=issue, raw=body, html=body, author=env.user)
db.add(comment)
db.commit()
return env.redirect_to('issue', issue=issue.id)
data.env = env
return env.template.render_to_response('create-issue', data.as_dict())
示例12: get_issue_events
def get_issue_events(show_progress):
# Retrieve the list of all projects for which issue events should be fetched.
github_projects = (
GitHubProject
.select(GitHubProject.owner, GitHubProject.repo)
.group_by(GitHubProject.owner, GitHubProject.repo)
)
if show_progress:
progress_bar = ProgressBar(maxval=github_projects.count(), widgets=[
'Progress: ', Percentage(),
' ', Bar(marker=RotatingMarker()),
' ', ETA(),
' Processing project ', Counter(), ' / ' + str(github_projects.count()) + '.'
])
progress_bar.start()
# Create a new fetch index
last_fetch_index = IssueEvent.select(fn.Max(IssueEvent.fetch_index)).scalar() or 0
fetch_index = last_fetch_index + 1
issue_fetch_index = Issue.select(fn.Max(Issue.fetch_index)).scalar() or 0
for project_index, project in enumerate(github_projects, start=1):
# Wrap a callback that will save fetched events
save_events_callback = functools.partial(
save_events,
project=project,
fetch_index=fetch_index,
issue_fetch_index=issue_fetch_index,
)
# Fetch all events for all issues for the project
github_get(
start_url=(
GITHUB_API_URL + '/repos/' + project.owner + '/' +
project.repo + '/issues/events'
),
results_callback=save_events_callback,
)
if show_progress:
progress_bar.update(project_index)
if show_progress:
progress_bar.finish()
# Make sure that all records from the batch inserter have been written out
batch_inserter.flush()
示例13: post
def post(self,id):
user = users.get_current_user()
if not user: #don't want someone who is not authenticated to be able to vote
self.redirect(users.create_login_url(self.request.uri))
return
issue = Issue.get_by_id(int(id))
#vote = issue.vote_for_member()
new_choice = Choice.get_by_id(int(self.request.get('choice')))
was_updated = issue.register_vote(new_choice)
if was_updated:
self.redirect('/?success=updated')
else:
self.redirect('/?success=vote')
示例14: later_results
def later_results(k):
issue = Issue.get(k)
issue.update_status()
yes = 0
no = 0
for choice in issue.choices:
if "Yes" in choice.name:
yes = choice.vote_count()
if "No" in choice.name:
no = choice.vote_count()
passed = "Not approved"
if yes > no:
passed = "Purchase Approved"
notify_results(passed,yes,no,issue)
示例15: post
def post(self,urlcode):
user = users.get_current_user()
if user:
logout_url = users.create_logout_url('/')
else:
self.redirect(users.create_login_url(self.request.uri))
issue = Issue.get_issue_by_urlcode(urlcode)
#vote = issue.vote_for_member()
new_choice = Choice.get_by_id(int(self.request.get('choice')))
was_updated = issue.register_vote(new_choice)
if was_updated:
self.redirect('/?success=updated')
else:
self.redirect('/?success=vote')