Hi guys.
Agilo does not support certain symbols in ticket types, when configuring
links between them. The problematic symbols include the '-' and the ','. So
here is a patch to forbid linking tickets that do not conform to certain
convention ([a-zA-Z0-9_]).
What do you think? Can it make it into agilo?
Note: the attached patch is generated with git.
thaks a lot
--
Follow Agilo on Twitter: http://twitter.com/agiloforscrum
Please support us by reviewing and voting on:
http://userstories.com/products/8-agilo-for-scrum
http://ohloh.net/p/agilo-scrum
http://freshmeat.net/projects/agiloforscrum
You have received this message because you are subscribed to
the "Agilo for Scrum" Google Group. This group is focused on
supporting Agilo for Scrum users and is moderated by
Agilo Software GmbH <http://www.agiloforscrum.com>.
To post to this group, send email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/agilo
diff --git a/agilo/agilo/ticket/links/admin.py
b/agilo/agilo/ticket/links/admin.py
index cdd97db..2c77d8c 100644
--- a/agilo/agilo/ticket/links/admin.py
+++ b/agilo/agilo/ticket/links/admin.py
@@ -17,6 +17,8 @@
# Authors:
# Jonas von Poser (jonas.vonposer__at__agile42.com)
+import re
+
from trac.core import TracError
from trac.util.translation import _
@@ -25,6 +27,7 @@ from agilo.ticket.api import AgiloTicketSystem
from agilo.ticket.links import LinkOption
from agilo.utils.config import AgiloConfig
+from trac.web.chrome import add_warning
class LinksAdminPanel(AgiloAdminPanel):
"""Administration panel for links.
@@ -98,14 +101,30 @@ class LinksAdminPanel(AgiloAdminPanel):
def list_save_view(self, req, cat, page):
source = req.args.get('source')
target = req.args.get('target')
+
+ if re.match('[a-zA-Z0-9_]+$', source) is None:
+ raise TracError('A type can only be linked if it has only numbers
or letters (%s)' % (source))
+ #( or use:
+ # add_warning(req, _('message'))
+ # req.redirect(req.href.admin(cat, page))
+ # return
+ #)
+
+ if re.match('[a-zA-Z0-9_]+$', target) is None:
+ raise TracError('A type can only be linked if it has only numbers
or letters (%s)' % (target))
+
if req.args.get('add') and source and target:
- if (source, target) in self.allowed_links:
+ if '%s-%s' % (source, target) in self.allowed_links:
# link already exists, redirect to it
req.redirect(req.href.admin(cat, page, '%s-%s' % (source,
target)))
# Set, save because there is the redirect
self.links.change_option(LinkOption.ALLOW, '%s, %s-%s' % \
(self.links.get(LinkOption.ALLOW,
default=''),
source, target), save=True)
+
+ # HACK: Link changes do not reload the environment.
+ AgiloTicketSystem(self.env).config.touch()
+
return req.redirect(req.href.admin(cat, page, '%s-%s' % (source,
target)))
# Remove components
@@ -124,4 +143,8 @@ class LinksAdminPanel(AgiloAdminPanel):
self.links.change_option(LinkOption.ALLOW,
', '.join(self.allowed_links.keys()),
save=True)
+
+ # HACK: Link changes do not reload the environment.
+ AgiloTicketSystem(self.env).config.touch()
+
return req.redirect(req.href.admin(cat, page))