--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -8,7 +8,6 @@
import json
# Non-stdlib imports
-from activitystream import director
import pkg_resources
from tg import expose, validate, redirect, flash, url, config
from tg.decorators import with_trailing_slash, without_trailing_slash
@@ -184,7 +183,6 @@
def sidebar_menu(self):
search_bins = []
milestones = []
- ticket = request.path_info.split(self.url)[-1].split('/')[0]
for bin in self.bins:
label = bin.shorthand_id()
search_bins.append(SitemapEntry(
@@ -198,10 +196,6 @@
h.text.truncate(m.name, 72),
self.url + fld.name[1:] + '/' + h.urlquote(m.name) + '/',
small=c.app.globals.milestone_count('%s:%s' % (fld.name, m.name))['hits']))
- if ticket.isdigit():
- ticket = TM.Ticket.query.find(dict(app_config_id=self.config._id,ticket_num=int(ticket))).first()
- else:
- ticket = None
links = []
if has_access(self, 'create')():
@@ -216,17 +210,6 @@
if pending_mod_count and has_access(discussion, 'moderate')():
links.append(SitemapEntry('Moderate', discussion.url() + 'moderate', ui_icon=g.icons['pencil'],
small = pending_mod_count))
- if ticket:
- if ticket.super_id:
- links.append(SitemapEntry('Supertask'))
- super = TM.Ticket.query.get(_id=ticket.super_id, app_config_id=c.app.config._id)
- links.append(SitemapEntry('[#{0}]'.format(super.ticket_num), super.url()))
- if ticket.sub_ids:
- links.append(SitemapEntry('Subtasks'))
- for sub_id in ticket.sub_ids or []:
- sub = TM.Ticket.query.get(_id=sub_id, app_config_id=c.app.config._id)
- links.append(SitemapEntry('[#{0}]'.format(sub.ticket_num), sub.url()))
- #links.append(SitemapEntry('Create New Subtask', '{0}new/?super_id={1}'.format(self.config.url(), ticket._id)))
links += milestones
@@ -526,12 +509,12 @@
@with_trailing_slash
@expose('jinja:forgetracker:templates/tracker/new_ticket.html')
- def new(self, super_id=None, description=None, summary=None, labels=None, **kw):
+ def new(self, description=None, summary=None, labels=None, **kw):
require_access(c.app, 'create')
c.ticket_form = W.ticket_form
help_msg = c.app.config.options.get('TicketHelpNew')
return dict(action=c.app.config.url()+'save_ticket',
- super_id=super_id, help_msg=help_msg,
+ help_msg=help_msg,
description=description, summary=summary, labels=labels)
@expose('jinja:allura:templates/markdown_syntax.html')
@@ -588,7 +571,8 @@
require_access(c.app, 'create')
ticket = TM.Ticket.new()
ticket.update(ticket_form)
- director().create_activity(c.user, 'created', ticket, target=c.project)
+ g.director.create_activity(c.user, 'created', ticket,
+ related_nodes=[c.project])
redirect(str(ticket.ticket_num)+'/')
@with_trailing_slash
@@ -1091,17 +1075,10 @@
if hasattr(attachment, 'file'):
self.ticket.attach(
attachment.filename, attachment.file, content_type=attachment.type)
- any_sums = False
for cf in c.app.globals.custom_fields or []:
if 'custom_fields.' + cf.name in post_data:
value = post_data['custom_fields.' + cf.name]
- if cf.type == 'sum':
- any_sums = True
- try:
- value = float(value)
- except (TypeError, ValueError):
- value = 0
- elif cf.type == 'user':
+ if cf.type == 'user':
# restrict custom user field values to project members
user = c.project.user_in_project(value)
value = user.username \
@@ -1152,10 +1129,10 @@
else:
post.text += '\n\n' + change_text
self.ticket.commit()
- if any_sums:
- self.ticket.dirty_sums()
if comment:
self.ticket.discussion_thread.post(text=comment)
+ g.director.create_activity(c.user, 'modified', self.ticket,
+ related_nodes=[c.project])
redirect('.')
@expose()
@@ -1182,7 +1159,8 @@
return dict(
status=status,
votes_up=self.ticket.votes_up,
- votes_down=self.ticket.votes_down)
+ votes_down=self.ticket.votes_down,
+ votes_percent=self.ticket.votes_up_percent)
class AttachmentController(ac.AttachmentController):
@@ -1433,11 +1411,14 @@
def __init__(self, root, field, milestone):
for fld in c.app.globals.milestone_fields:
- if fld.name[1:] == field: break
+ name_no_underscore = fld.name[1:]
+ if fld.name[1:] == field:
+ break
else:
raise exc.HTTPNotFound()
for m in fld.milestones:
- if m.name == unquote(milestone): break
+ if m.name == unquote(milestone).decode('utf-8'):
+ break
else:
raise exc.HTTPNotFound()
self.root = root