[Oi-commits] r1356 - in branches/stable: . forum templates/forum

oi-commits at pardus.org.tr oi-commits at pardus.org.tr
Wed May 7 15:32:51 EEST 2008


Author: jnmbk
Date: Wed May  7 15:32:51 2008
New Revision: 1356

Modified:
   branches/stable/forum/models.py
   branches/stable/forum/settings.py
   branches/stable/forum/views.py
   branches/stable/settings.py
   branches/stable/templates/forum/topic.html
Log:
merge

Modified: branches/stable/forum/models.py
=================================================================
--- branches/stable/forum/models.py	(original)
+++ branches/stable/forum/models.py	Wed May  7 15:32:51 2008
@@ -13,7 +13,7 @@
 from oi.middleware import threadlocals
 from oi.st.models import Tag
 
-from oi.settings import FORUM_FROM_EMAIL
+from oi.forum.settings import FORUM_FROM_EMAIL
 
 import md5
 

Modified: branches/stable/forum/settings.py
=================================================================
--- branches/stable/forum/settings.py	(original)
+++ branches/stable/forum/settings.py	Wed May  7 15:32:51 2008
@@ -5,7 +5,14 @@
 # Licensed under the GNU General Public License, version 3.
 # See the file http://www.gnu.org/copyleft/gpl.txt.
 
+# e-mail
+FORUM_FROM_EMAIL = 'forum at ozgurlukicin.com'
+FORUM_MESSAGE_LIST = 'forum at liste.ozgurlukicin.com'
+
+# paginator
 TOPICS_PER_PAGE = 20
 POSTS_PER_PAGE = 15
 ALL_POSTS_PER_PAGE = 10
+
+# misc
 FLOOD_TIMEOUT = 10

Modified: branches/stable/forum/views.py
=================================================================
--- branches/stable/forum/views.py	(original)
+++ branches/stable/forum/views.py	Wed May  7 15:32:51 2008
@@ -21,11 +21,12 @@
 from oi.forum import customgeneric
 
 from django.core.urlresolvers import reverse
+from django.core.exceptions import ObjectDoesNotExist
 from oi.st.models import Tag, News
 
 # import our function for sending e-mails and setting
 from oi.st.wrappers import send_mail_with_header
-from oi.settings import FORUM_FROM_EMAIL, WEB_URL, FORUM_MESSAGE_LIST
+from oi.settings import WEB_URL
 
 # import bbcode renderer for quotation
 from oi.forum.postmarkup import render_bbcode
@@ -131,19 +132,28 @@
         return HttpResponseRedirect(topic.get_absolute_url())
     posts = topic.post_set.all().order_by('created')
     news_list = News.objects.filter(status=1).order_by('-update')[:3]
+    watching = False
 
     if request.user.is_authenticated():
         request.session["read_topic_dict"][topic.id] = datetime.now()
         request.session["read_forum_dict"][forum.id] = datetime.now()
         request.session.modified = True
 
+        # is the user watching this topic?
+        try:
+            request.user.watchlist_set.get(topic__id=topic_id)
+            watching = True
+        except ObjectDoesNotExist:
+            pass
+
     topic.views += 1
     topic.save()
+
     # we love Django, just 1 line and pagination is ready :)
     return object_list(request, posts,
                        template_name = 'forum/topic.html',
                        template_object_name = 'post',
-                       extra_context = {'forum': forum, 'topic': topic, 'news_list':news_list},
+                       extra_context = {'forum': forum, 'topic': topic, 'news_list':news_list, "watching":watching},
                        paginate_by = POSTS_PER_PAGE,
                        allow_empty = True)
 
@@ -221,21 +231,15 @@
                                       fail_silently = True
                                       )
 
-
-            email_list = []
-            # send emails to me, at least I'm the only one who are willing to follow the forum via email :)
-            for user in User.objects.filter(is_staff=1):
-                if user.username == 'Eren':
-                    email_list.add(user.email)
-
-            send_mail_with_header('Re: %s' % topic.title,
-                                  '%s\n%s<br /><br /><a href="%s">%s</a>' % (css, render_bbcode(form.cleaned_data['text']), post_url, post_url),
-                                  '%s <%s>' % (request.user.username, FORUM_FROM_EMAIL),
-                                  email_list,
-                                  headers = {'Message-ID': post.get_email_id(),
-                                             'In-Reply-To': in_reply_to},
-                                  fail_silently = True
-                                  )
+            # send mailing list also.
+            # send_mail_with_header('Re: %s' % topic.title,
+            #                       '%s\n%s<br /><br /><a href="%s">%s</a>' % (css, render_bbcode(form.cleaned_data['text']), post_url, post_url),
+            #                       '%s <%s>' % (request.user.username, FORUM_FROM_EMAIL),
+            #                       [FORUM_MESSAGE_LIST],
+            #                       headers = {'Message-ID': post.get_email_id(),
+            #                                  'In-Reply-To': in_reply_to},
+            #                       fail_silently = True
+            #                       )
 
             return HttpResponseRedirect(post.get_absolute_url())
     else:
@@ -320,19 +324,14 @@
             # generate post url
             post_url = WEB_URL + topic.get_absolute_url()
 
-            email_list = []
-            # send emails to me, at least I'm the only one who are willing to follow the forum via email :)
-            for user in User.objects.filter(is_staff=1):
-                if user.username == 'Eren':
-                    email_list.add(user.email)
-
-            send_mail_with_header('[Ozgurlukicin-forum] %s' % topic.title,
-                                  '%s<br /><br /><a href="%s">%s</a>' % (post.text, post_url, post_url),
-                                  '%s <%s>' % (request.user.username, FORUM_FROM_EMAIL),
-                                  email_list,
-                                  headers = {'Message-ID': topic.get_email_id()},
-                                  fail_silently = True
-                                  )
+            # send e-mail to mailing list. We really rock, yeah!
+            # send_mail_with_header('%s' % topic.title,
+            #                       '%s<br /><br /><a href="%s">%s</a>' % (post.text, post_url, post_url),
+            #                       '%s <%s>' % (request.user.username, FORUM_FROM_EMAIL),
+            #                       [FORUM_MESSAGE_LIST],
+            #                       headers = {'Message-ID': topic.get_email_id()},
+            #                       fail_silently = True
+            #                       )
 
             return HttpResponseRedirect(post.get_absolute_url())
     else:

Modified: branches/stable/settings.py
=================================================================
--- branches/stable/settings.py	(original)
+++ branches/stable/settings.py	Wed May  7 15:32:51 2008
@@ -26,8 +26,6 @@
 
 # Email
 DEFAULT_FROM_EMAIL = 'noreply at ozgurlukicin.com'
-FORUM_FROM_EMAIL = 'forum at ozgurlukicin.com'
-FORUM_MESSAGE_LIST = 'forum at liste.ozgurlukicin.com'
 #EMAIL_USE_TLS = True
 
 # Pagination

Modified: branches/stable/templates/forum/topic.html
=================================================================
--- branches/stable/templates/forum/topic.html	(original)
+++ branches/stable/templates/forum/topic.html	Wed May  7 15:32:51 2008
@@ -98,7 +98,7 @@
                 <span style="font-size:x-small; font-style:italic;">Bu ileti {{ post.edit_count }} kez değiştirilmiş olup, son kez {{ post.edited|date:"d-m-Y H:i" }} tarihinde {{ post.last_edited_by }} tarafından değiştirilmiştir.</span><br />
             </div>
             {% endifnotequal %}
-            {% if post.author.get_profile.signature %}<div class="post_message_bottom"><hr />{{ post.author.get_profile.signature }}</div>{% endif %}
+            {% if post.author.get_profile.signature %}<div class="post_message_bottom"><hr />{{ post.author.get_profile.signature|safe }}</div>{% endif %}
         </div>
     </div>
 </div>


More information about the Oi-commits mailing list