diff --git a/boards/models/post.py b/boards/models/post.py --- a/boards/models/post.py +++ b/boards/models/post.py @@ -48,6 +48,9 @@ class PostManager(models.Manager): Creates new post """ + if not tags: + tags = [] + posting_time = timezone.now() if not thread: thread = Thread.objects.create(bump_time=posting_time, @@ -75,8 +78,8 @@ class PostManager(models.Manager): post.id)) thread.replies.add(post) - if tags: - map(thread.add_tag, tags) + for tag in tags: + thread.add_tag(tag) if new_thread: Thread.objects.process_oldest_threads() @@ -112,7 +115,8 @@ class PostManager(models.Manager): """ posts = self.filter(poster_ip=ip) - map(self.delete_post, posts) + for post in posts: + self.delete_post(post) def connect_replies(self, post): """ diff --git a/boards/tests.py b/boards/tests.py --- a/boards/tests.py +++ b/boards/tests.py @@ -182,10 +182,6 @@ class PagesTest(TestCase): class FormTest(TestCase): def test_post_validation(self): - # Disable captcha for the test - captcha_enabled = neboard.settings.ENABLE_CAPTCHA - neboard.settings.ENABLE_CAPTCHA = False - client = Client() valid_tags = u'tag1 tag_2 тег_3' @@ -222,9 +218,6 @@ class FormTest(TestCase): self.assertEqual(2, Post.objects.count(), msg=u'No posts were created') - # Restore captcha setting - settings.ENABLE_CAPTCHA = captcha_enabled - class ViewTest(TestCase): diff --git a/boards/views/all_threads.py b/boards/views/all_threads.py --- a/boards/views/all_threads.py +++ b/boards/views/all_threads.py @@ -86,7 +86,7 @@ class AllThreadsView(PostMixin, BaseBoar if tag_strings: tag_strings = tag_strings.split(TAG_DELIMITER) for tag_name in tag_strings: - tag_name = string.lower(tag_name.strip()) + tag_name = tag_name.strip().lower() if len(tag_name) > 0: tag, created = Tag.objects.get_or_create(name=tag_name) tags.append(tag) diff --git a/neboard/settings.py b/neboard/settings.py --- a/neboard/settings.py +++ b/neboard/settings.py @@ -148,8 +148,6 @@ INSTALLED_APPS = ( 'south', 'debug_toolbar', - 'captcha', - # Search 'haystack', @@ -168,11 +166,6 @@ DEBUG_TOOLBAR_PANELS = ( 'debug_toolbar.panels.logger.LoggingPanel', ) -# TODO: NEED DESIGN FIXES -CAPTCHA_OUTPUT_FORMAT = (u' %(hidden_field)s ' - u'
%(image)s
' - u'
%(text_field)s
') - # A sample logging configuration. The only tangible logging # performed by this configuration is to send an email to # the site admins on every HTTP 500 error when DEBUG=False. @@ -229,9 +222,6 @@ THEMES = [ POPULAR_TAGS = 10 -ENABLE_CAPTCHA = False -# if user tries to post before CAPTCHA_DEFAULT_SAFE_TIME. Captcha will be shown -CAPTCHA_DEFAULT_SAFE_TIME = 30 # seconds POSTING_DELAY = 20 # seconds COMPRESS_HTML = True