Skip to content

Commit

Permalink
Fix help text in settings UI of auto link key terms
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarun committed Sep 24, 2011
1 parent d188a4a commit 85ceec2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
27 changes: 14 additions & 13 deletions askbot/conf/markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ def regex_settings_validation(*args):
'PATTERN',
description=_('Regex to detect the pattern'),
help_text=_(
'Enter a valid regular expression to '
'detect the pattern. For example to'
'detect something like #rhbz 637402 '
'use a regular expression like #rhbz\s(\d+)'
'If you want to process multiple regex enter'
' them line by line'
' Enter valid regular expressions to'
' detect patterns. If you want to auto'
' link more than one key terms enter them'
' line by line. For example to'
' detect a bug pattern like #rhbz 637402'
' you will have use the following regex #rhbz\s(\d+)'
),
update_callback=regex_settings_validation,
default = ''
Expand All @@ -131,13 +131,14 @@ def regex_settings_validation(*args):
'AUTO_LINK_URL',
description=_('URL for autolinking'),
help_text=_(
'Let us assume that to detect a pattern #rhbz 637402'
' the regex is #rhbz\s(\d+) '
'then the autolink URL should be https://bugzilla.redhat.com/show_bug.cgi?id=\1'
' Where \1 is the saved match (bugid) from the regular expression'
' If you want to process multiple regex enter'
' them line by line. The URL in first line will be used to link the'
' pattern on the first line'
' The regex to detect pattern #rhbz 637402'
' is #rhbz\s(\d+), If you want to auto link it to the actual bug'
' then the autolink URL should be entered here. Example URL can be'
' https://bugzilla.redhat.com/show_bug.cgi?id=\\1'
' where \\1 is the saved match (bugid) from the regular expression.'
' Multiple URLs should be entered in separate lines.'
' The URL entered in first line'
' will be used to auto link the first pattern or key term'
),
default = ''
)
Expand Down
4 changes: 3 additions & 1 deletion askbot/utils/markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def get_parser():
pattern_list = askbot_settings.PATTERN.split('\n')
url_list = askbot_settings.AUTO_LINK_URL.split('\n')

# Check whether we have matching links for all key terms, Other wise we ignore the key terms
# Check whether we have matching links for all key terms, Other wise we ignore the key terms
# May be we should do this test in update_callback?
print len(pattern_list), len(url_list)
if len(pattern_list) == len(url_list):
for i in range(0,len(pattern_list)):
LINK_PATTERNS.append((re.compile(pattern_list[i].strip()),url_list[i].strip()))
Expand Down

0 comments on commit 85ceec2

Please sign in to comment.