You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by ma...@apache.org on 2013/05/15 11:01:19 UTC
svn commit: r1482730 - in /bloodhound/trunk:
bloodhound_relations/bhrelations/api.py installer/bloodhound_setup.py
Author: matevz
Date: Wed May 15 09:01:18 2013
New Revision: 1482730
URL: http://svn.apache.org/r1482730
Log:
Ref. #523 - check for self-reference when creating a relation + setup fix for proper bhrelations config
Modified:
bloodhound/trunk/bloodhound_relations/bhrelations/api.py
bloodhound/trunk/installer/bloodhound_setup.py
Modified: bloodhound/trunk/bloodhound_relations/bhrelations/api.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/api.py?rev=1482730&r1=1482729&r2=1482730&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/api.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/api.py Wed May 15 09:01:18 2013
@@ -343,6 +343,8 @@ class RelationsSystem(Component):
return links, labels, validators, blockers, copy_fields
def validate(self, relation):
+ self._validate_self_reference(relation)
+
validator = self._get_validator(relation.type)
if validator:
validator(relation)
@@ -361,6 +363,13 @@ class RelationsSystem(Component):
validator = None
return validator
+ def _validate_self_reference(self, relation):
+ if relation.source == relation.destination:
+ error = CycleValidationError(
+ 'Ticket cannot be self-referenced in a relation.')
+ error.failed_ids = [relation.source]
+ raise error
+
def _validate_no_cycle(self, relation):
"""If a path exists from relation's destination to its source,
adding the relation will create a cycle.
Modified: bloodhound/trunk/installer/bloodhound_setup.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/installer/bloodhound_setup.py?rev=1482730&r1=1482729&r2=1482730&view=diff
==============================================================================
--- bloodhound/trunk/installer/bloodhound_setup.py (original)
+++ bloodhound/trunk/installer/bloodhound_setup.py Wed May 15 09:01:18 2013
@@ -89,13 +89,17 @@ BASE_CONFIG = {'components': {'bhtheme.*
'footer_left_postfix': '',
'footer_right': ''},
'bhsearch': {'is_default': 'true', 'enable_redirect': 'true'},
- 'bhrealations': {
+ 'bhrelations_links': {
+ 'children.label': 'Child',
'dependency': 'dependson,dependent',
'dependency.validator': 'no_cycle',
'dependent.blocks': 'true',
'dependson.label': 'Depends on',
'dependent.label': 'Dependent',
'oneway': 'refersto',
+ 'parent_children': 'parent,children',
+ 'parent_children.validator': 'parent_child',
+ 'refersto.label': 'Refers to',
},
}