本文整理汇总了Python中models.Issue.all方法的典型用法代码示例。如果您正苦于以下问题:Python Issue.all方法的具体用法?Python Issue.all怎么用?Python Issue.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Issue
的用法示例。
在下文中一共展示了Issue.all方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Issue [as 别名]
# 或者: from models.Issue import all [as 别名]
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)
示例2: post
# 需要导入模块: from models import Issue [as 别名]
# 或者: from models.Issue import all [as 别名]
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)
示例3: get
# 需要导入模块: from models import Issue [as 别名]
# 或者: from models.Issue import all [as 别名]
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()))
示例4: get
# 需要导入模块: from models import Issue [as 别名]
# 或者: from models.Issue import all [as 别名]
def get(self, slug):
# we want canonocal urls so redirect to add a trailing slash if needed
if self.request.path[-1] != "/":
self.redirect("%s/" % self.request.path, True)
return
user = users.get_current_user()
output = None
# if not logged in then use a cached version
if not user:
output = get_cache("project_%s" % slug)
# if we don't have a cached version or are logged in
if output is None:
try:
project = Project.all().filter('slug =', slug).fetch(1)[0]
issues = Issue.all().filter('project =', project)
files = DatastoreFile.all().filter('project =', project)
except IndexError:
self.render_404()
return
logging.info("Files in this project: %d" % files.count())
# check to see if we have admin rights over this project
if project.user == user or users.is_current_user_admin():
owner = True
else:
owner = False
context = {
'project': project,
'issues': issues,
'owner': owner,
'files': files,
}
output = self.render("project.html", context)
if not user:
# only save a cached version if we're not logged in
# so as to avoid revelaving user details
memcache.add("project_%s" % slug, output, 3600)
self.response.out.write(output)
示例5: post
# 需要导入模块: from models import Issue [as 别名]
# 或者: from models.Issue import all [as 别名]
def post(self, project_slug, issue_slug):
# if we don't have a user then throw
# an unauthorised error
user = users.get_current_user()
if not user:
self.render_403()
return
issue = Issue.all().filter('internal_url =', "/%s/%s/" % (project_slug, issue_slug)).fetch(1)[0]
user = users.get_current_user()
if issue.project.user == user:
try:
name = self.request.get("name")
description = self.request.get("description")
email = self.request.get("email")
fixed = self.request.get("fixed")
priority = self.request.get("priority")
fixed_description = self.request.get("fixed_description")
issue.name = name
issue.description = description
issue.priority = priority
if email:
issue.email = email
else:
issue.email = None
issue.fixed = bool(fixed)
if fixed:
issue.fixed_description = fixed_description
else:
issue.fixed_description = None
issue.put()
logging.info("issue edited: %s in %s" % (issue.name, issue.project.name))
except Exception, e:
logging.info("error editing issue: %s" % e)