summaryrefslogtreecommitdiffstats
path: root/askbot/const
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-06-04 03:59:14 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-06-04 03:59:14 -0400
commit9d1d9b3b72e73c9234aad52f6a864bc756c165ab (patch)
treecdda72a380f62c4a70715d0e8484167406dae3d7 /askbot/const
parent57b8ead6235ddf6f3f77f5850237cb6b09af6fb3 (diff)
downloadaskbot-9d1d9b3b72e73c9234aad52f6a864bc756c165ab.tar.gz
askbot-9d1d9b3b72e73c9234aad52f6a864bc756c165ab.tar.bz2
askbot-9d1d9b3b72e73c9234aad52f6a864bc756c165ab.zip
fancy tag editor now has input validation
Diffstat (limited to 'askbot/const')
-rw-r--r--askbot/const/__init__.py2
-rw-r--r--askbot/const/message_keys.py4
2 files changed, 6 insertions, 0 deletions
diff --git a/askbot/const/__init__.py b/askbot/const/__init__.py
index f3091800..f7255455 100644
--- a/askbot/const/__init__.py
+++ b/askbot/const/__init__.py
@@ -99,11 +99,13 @@ UNANSWERED_QUESTION_MEANING_CHOICES = (
#however it will be hard to expect that people will type
#correct regexes - plus this must be an anchored regex
#to do full string match
+#IMPRTANT: tag related regexes must be portable between js and python
TAG_CHARS = r'\w+.#-'
TAG_REGEX_BARE = r'[%s]+' % TAG_CHARS
TAG_REGEX = r'^%s$' % TAG_REGEX_BARE
TAG_SPLIT_REGEX = r'[ ,]+'
TAG_SEP = ',' # has to be valid TAG_SPLIT_REGEX char and MUST NOT be in const.TAG_CHARS
+#!!! see const.message_keys.TAG_WRONG_CHARS_MESSAGE
EMAIL_REGEX = re.compile(r'\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b', re.I)
TYPE_ACTIVITY_ASK_QUESTION = 1
diff --git a/askbot/const/message_keys.py b/askbot/const/message_keys.py
index 0ee99e0c..caee6b07 100644
--- a/askbot/const/message_keys.py
+++ b/askbot/const/message_keys.py
@@ -33,6 +33,10 @@ _('click to see the most answered questions')
_('click to see least voted questions')
_('by votes')
_('click to see most voted questions')
+TAGS_ARE_REQUIRED_MESSAGE = _('tags are required')
+TAG_WRONG_CHARS_MESSAGE = _(
+ 'please use letters, numbers and characters "-+.#"'
+)
def get_i18n_message(key):
messages = {