##// END OF EJS Templates
Fixed tag problems with python3 (related to the 'map' function that was...
neko259 -
r766:10f4d0f7 default
parent child Browse files
Show More
@@ -48,6 +48,9 b' class PostManager(models.Manager):'
48 Creates new post
48 Creates new post
49 """
49 """
50
50
51 if not tags:
52 tags = []
53
51 posting_time = timezone.now()
54 posting_time = timezone.now()
52 if not thread:
55 if not thread:
53 thread = Thread.objects.create(bump_time=posting_time,
56 thread = Thread.objects.create(bump_time=posting_time,
@@ -75,8 +78,8 b' class PostManager(models.Manager):'
75 post.id))
78 post.id))
76
79
77 thread.replies.add(post)
80 thread.replies.add(post)
78 if tags:
81 for tag in tags:
79 map(thread.add_tag, tags)
82 thread.add_tag(tag)
80
83
81 if new_thread:
84 if new_thread:
82 Thread.objects.process_oldest_threads()
85 Thread.objects.process_oldest_threads()
@@ -112,7 +115,8 b' class PostManager(models.Manager):'
112 """
115 """
113
116
114 posts = self.filter(poster_ip=ip)
117 posts = self.filter(poster_ip=ip)
115 map(self.delete_post, posts)
118 for post in posts:
119 self.delete_post(post)
116
120
117 def connect_replies(self, post):
121 def connect_replies(self, post):
118 """
122 """
@@ -182,10 +182,6 b' class PagesTest(TestCase):'
182
182
183 class FormTest(TestCase):
183 class FormTest(TestCase):
184 def test_post_validation(self):
184 def test_post_validation(self):
185 # Disable captcha for the test
186 captcha_enabled = neboard.settings.ENABLE_CAPTCHA
187 neboard.settings.ENABLE_CAPTCHA = False
188
189 client = Client()
185 client = Client()
190
186
191 valid_tags = u'tag1 tag_2 тег_3'
187 valid_tags = u'tag1 tag_2 тег_3'
@@ -222,9 +218,6 b' class FormTest(TestCase):'
222 self.assertEqual(2, Post.objects.count(),
218 self.assertEqual(2, Post.objects.count(),
223 msg=u'No posts were created')
219 msg=u'No posts were created')
224
220
225 # Restore captcha setting
226 settings.ENABLE_CAPTCHA = captcha_enabled
227
228
221
229 class ViewTest(TestCase):
222 class ViewTest(TestCase):
230
223
@@ -86,7 +86,7 b' class AllThreadsView(PostMixin, BaseBoar'
86 if tag_strings:
86 if tag_strings:
87 tag_strings = tag_strings.split(TAG_DELIMITER)
87 tag_strings = tag_strings.split(TAG_DELIMITER)
88 for tag_name in tag_strings:
88 for tag_name in tag_strings:
89 tag_name = string.lower(tag_name.strip())
89 tag_name = tag_name.strip().lower()
90 if len(tag_name) > 0:
90 if len(tag_name) > 0:
91 tag, created = Tag.objects.get_or_create(name=tag_name)
91 tag, created = Tag.objects.get_or_create(name=tag_name)
92 tags.append(tag)
92 tags.append(tag)
@@ -148,8 +148,6 b' INSTALLED_APPS = ('
148 'south',
148 'south',
149 'debug_toolbar',
149 'debug_toolbar',
150
150
151 'captcha',
152
153 # Search
151 # Search
154 'haystack',
152 'haystack',
155
153
@@ -168,11 +166,6 b' DEBUG_TOOLBAR_PANELS = ('
168 'debug_toolbar.panels.logger.LoggingPanel',
166 'debug_toolbar.panels.logger.LoggingPanel',
169 )
167 )
170
168
171 # TODO: NEED DESIGN FIXES
172 CAPTCHA_OUTPUT_FORMAT = (u' %(hidden_field)s '
173 u'<div class="form-label">%(image)s</div>'
174 u'<div class="form-text">%(text_field)s</div>')
175
176 # A sample logging configuration. The only tangible logging
169 # A sample logging configuration. The only tangible logging
177 # performed by this configuration is to send an email to
170 # performed by this configuration is to send an email to
178 # the site admins on every HTTP 500 error when DEBUG=False.
171 # the site admins on every HTTP 500 error when DEBUG=False.
@@ -229,9 +222,6 b' THEMES = ['
229
222
230 POPULAR_TAGS = 10
223 POPULAR_TAGS = 10
231
224
232 ENABLE_CAPTCHA = False
233 # if user tries to post before CAPTCHA_DEFAULT_SAFE_TIME. Captcha will be shown
234 CAPTCHA_DEFAULT_SAFE_TIME = 30 # seconds
235 POSTING_DELAY = 20 # seconds
225 POSTING_DELAY = 20 # seconds
236
226
237 COMPRESS_HTML = True
227 COMPRESS_HTML = True
General Comments 0
You need to be logged in to leave comments. Login now