Commits

Anonymous committed 3a32b61 Merge

merge

Comments (0)

Files changed (18)

apps/accounts/forms.py

     name = forms.CharField(max_length=30, required=False, label=_(u'Name'))
     email = forms.EmailField(max_length=128, required=False, label=_(u'Email'), help_text=_(u"Changing email requires activation"))
     site = forms.CharField(max_length=200, required=False, label=_(u'Site'))
-    current_password = forms.CharField(widget=forms.PasswordInput(), label=_(u'Current password'))
     password1 = forms.CharField(widget=forms.PasswordInput(), required=False, label=_(u'Password'), help_text=_(u"Leave blank to keep current"))
     password2 = forms.CharField(widget=forms.PasswordInput(), required=False, label=_(u'Password'), help_text=_(u"Repeat, to catch typos"))
 
         else:
             return self.cleaned_data['email']
 
-    def clean_current_password(self):
-        if not self.user.email:
-            return self.cleaned_data['current_password']
-
-        if not self.user.check_password(self.cleaned_data['current_password']):
-            raise forms.ValidationError(_('Wrong password'))
-
-        return self.cleaned_data['current_password']
-
     def clean_password2(self):
         """Validates that the two password inputs match."""
         if self.cleaned_data['password1'] == self.cleaned_data['password2']:
         newuser = authenticate(email=self.cleaned_data['email'], password=self.cleaned_data['password'])
         olduser = self.request.user
         from blog.models import Post
-        Post.objects.filter(author=olduser).update(author=newuser)
+        Post.plain_manager.filter(author=olduser).update(author=newuser)
         from discussion.models import CommentNode
-        CommentNode.objects.filter(user=olduser).update(user=newuser)
+        CommentNode.all_objects.filter(user=olduser).update(user=newuser)
         from watchlist.models import Subscription
         Subscription.objects.filter(user=olduser).update(user=newuser)
         from openidconsumer.models import UserAssociation

apps/blog/managers.py

 # -*- mode: python; coding: utf-8; -*-
 
+from datetime import datetime as dt
+
 from django.db import models
 from django.contrib.sites.models import Site
 
 class PublicPostManager(SitePostManager):
     def get_query_set(self):
         qs = super(PublicPostManager, self).get_query_set()
-        qs = qs.filter(is_draft=False)
+        qs = qs.filter(date__lte=dt.now(), is_draft=False)
         return qs

apps/blog/sitemaps.py

     priority = 0.8
 
     def items(self):
-        return Post.objects.exclude(date__gt=dt.now())
+        return Post.objects.all()
 
     def lastmod(self, obj):
         return obj.date
 
     def lastmod(self, obj):
         if obj == "post_list":
-            return Post.objects.exclude(date__gt=dt.now()).latest('date').date
+            return Post.objects.all().latest('date').date
 
 
 class BlogTagsSitemap(Sitemap):
     priority = 0.5
 
     def items(self):
-        return Tag.objects.usage_for_queryset(Post.objects.exclude(date__gt=dt.now()))
+        return Tag.objects.usage_for_queryset(Post.objects.all())
 
     def location(self, obj):
         return reverse('post_by_tag', tag=obj.name)
 
     def lastmod(self, obj):
-        return TaggedItem.objects.get_by_model(Post.objects.exclude(
-                date__gt=dt.now()), [obj.name]).latest('date').date
+        return TaggedItem.objects.get_by_model(Post.objects.all(),
+                [obj.name]).latest('date').date

apps/blog/templatetags/sidebar.py

 
 @register.inclusion_tag('blog/sidebar.html', takes_context=True)
 def sidebar(context):
-    all_posts = Post.objects.filter(date__lte=dt.now()).order_by('-date')
+    all_posts = Post.objects.order_by('-date')
     comments = CommentNode.objects.for_similar_objects(all_posts)
     if comments:
         comments = comments.select_related().order_by('-pub_date')[:5]

apps/blog/tests.py

 class RootTestCase(test.TestCase):
 
     def testIndexRedirect(self):
-        if settings.SET_URL_ROOT_HANDLER:
-            response = self.client.get('/')
-            self.assertEquals(response.status_code, 302)
-            # Documentation says that we must get response.headers, but
-            # instead we have HttpResponseRedirect object here
-            self.assertEquals(urlparse.urlsplit(response['Location'])[2],
-                              '/' + settings.BLOG_URLCONF_ROOT)
+        if not getattr(settings, 'SET_URL_ROOT_HANDLER', False):
+            settings.SET_URL_ROOT_HANDLER = True
+        response = self.client.get('/')
+        self.assertEquals(response.status_code, 302)
+        # Documentation says that we must get response.headers, but
+        # instead we have HttpResponseRedirect object here
+        self.assertEquals(urlparse.urlsplit(response['Location'])[2],
+                          '/' + settings.BLOG_URLCONF_ROOT)

apps/blog/views.py

 
 def post_list(request, *args, **kwargs):
     """Post listing. Only shows posts that are older than now()"""
-
-
     if request.user.id:
         # the OR clause includes logged-in user's drafts as well
         q_lookup = (Q(is_draft=False) | Q(author=request.user))
-        qs = Post.whole_objects.filter(q_lookup)
+        qs = Post.all_objects.filter(q_lookup).exclude(date__gt=dt.now())
     else:
-        qs = Post.objects
+        qs = Post.objects.all()
 
-    # hide all posts that are not yet published
-    kwargs['queryset'] = qs.exclude(date__gt=dt.now())
-
-    return object_list(request, *args, **kwargs)
+    return object_list(request, queryset=qs, *args, **kwargs)
 
 
 archive_dict = {
 def archive_month(request, year, month):
     if int(year) < 1901: # to exclude all troubles with strftime
         raise Http404
-    qs = Post.objects.filter(site=Site.objects.get_current())
+    qs = Post.objects.all()
     return date_based.archive_month(request, year, month, queryset=qs,
                                     month_format='%m',
                                     template_name='blog/post_list.html',
 def archive_year(request, year):
     if int(year) < 1901:
         raise Http404
-    qs = Post.objects.filter(site=Site.objects.get_current())
+    qs = Post.objects.all()
     return date_based.archive_year(request, year, make_object_list=True,
                                    queryset=qs,
                                    template_name='blog/post_archive_year.html',
 def archive_day(request, year, month, day):
     if int(year) < 1901:
         raise Http404
-    qs = Post.objects.filter(site=Site.objects.get_current())
+    qs = Post.objects.all()
     return date_based.archive_day(request, year, month, day, month_format='%m',
                                   template_name='blog/post_archive_year.html',
                                   queryset=qs, **archive_dict)
 
 def by_tag(request, tag, *args, **kwargs):
     """Post listing. Only shows posts that belong to specified tags"""
-    queryset = Post.objects.filter(date__lte=dt.now())
+    queryset = Post.objects.all()
     if not kwargs.has_key('extra_context'):
         kwargs['extra_context'] = {}
     kwargs['extra_context']['feedurl'] = 'tag/%s' % tag
         user = User.objects.get(username__exact=author)
     except User.DoesNotExist:
         raise Http404
-    queryset = Post.objects.filter(date__lte=dt.now(), author=user)
+    queryset = Post.objects.filter(author=user)
     if not kwargs.has_key('extra_context'):
         kwargs['extra_context'] = {}
     kwargs['extra_context']['feedurl'] = 'author/%s' % user
              'date__year': year,
              'date__month': month,
              'date__day': day}
-    if not request.user.is_staff:
-        filtr['is_draft'] = False
-    post = get_object_or_404(Post.all_objects, **filtr)
+    qs = (request.user.is_staff
+	  and Post.all_objects
+	  or Post.objects)
+    post = get_object_or_404(qs, **filtr)
     if post.comments_open():
         Form = (request.user.is_authenticated()
                 and CommentForm

apps/feed/blog_feeds.py

                     {'rel': u'self', 'href': link(reverse(get_feed_type(type), 'blog'))})
 
         def items(self):
-            return Post.objects.exclude(date__gt=dt.now()).order_by('-date')[:5]
+            return Post.objects.order_by('-date')[:5]
 
         def item_id(self, item):
             return link(item.get_absolute_url())
                             'author/%s' % author.username))})
 
         def items(self, author):
-            return Post.objects.filter(date__lt=dt.now(), author=author).order_by('-date')[:5]
+            return Post.objects.filter(author=author).order_by('-date')[:5]
 
         def item_id(self, item):
             return link(item.get_absolute_url())
         return Post.featured_objects.order_by('-date')[0].date
 
     def items(self):
-        return Post.featured_objects.exclude(date__gt=dt.now()).order_by('-date')[:5]
+        return Post.featured_objects.order_by('-date')[:5]
 
 class RssFeaturedBlogEntries(RssBlogEntries):
     def feed_updated(self):
         return Post.featured_objects.order_by('-date')[0].date
 
     def items(self):
-        return Post.featured_objects.exclude(date__gt=dt.now()).order_by('-date')[:5]
+        return Post.featured_objects.order_by('-date')[:5]

apps/watchlist/mail.py

 from lib.helpers import signals
 
 
-DEFAULT_COMMENT_SUBJECT = '''New comment for {{ comment.content_type }} "{{ obj.name }}" by "{{ comment.user.first_name|default:comment.user.username }}"'''
+DEFAULT_COMMENT_SUBJECT = '''New comment for {{ comment.content_type }} "{{ obj.name }}"'''
 DEFAULT_COMMENT_BODY = '''Author: {{ comment.user.first_name|default:comment.user.username }}
 
 Comment text:
 
 MANAGERS = ADMINS
 
-# Local time zone for this installation. All choices can be found here:
-# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
-TIME_ZONE = 'Europe/Kiev'
-
-# Language code for this installation. All choices can be found here:
-# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
-# http://blogs.law.harvard.edu/tech/stories/storyReader$15
+# Defaults -- set these in settings_local.py
+TIME_ZONE = 'GMT'
 LANGUAGE_CODE = 'en-us'
 
 SITE_ID = SiteIDHook()

settings_local.py.template

 DATABASE_USER = ''
 DATABASE_PASSWORD = ''
 
+# Local time zone for this installation. All choices can be found here:
+# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
+#TIME_ZONE = 'Europe/Kiev'
+
+# Language code for this installation. All choices can be found here:
+# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
+# http://blogs.law.harvard.edu/tech/stories/storyReader$15
+#LANGUAGE_CODE = 'en-us'
+
 TAGLINE = u'Everyone will like it'
 FOOTER = u'(c) 2007-2009 <a href="/about/">Alexander Solovyov</a>'
 

templates/accounts/profile_edit.html

 {% block content %}
 <p><a href="{% url openid_list %}">{% trans "Associated OpenIDs" %}</a></p>
 <p><a href="{% url merge %}">{% trans "Merge with another account" %}</a></p>
+{% if appcheck.watchlist %}
 <p><a href="{% url wl_list %}">{% trans "Subscriptions list" %}</a></p>
+{% endif %}
 <form action="." method="post">
     <table>
         {{ form }}

templates/footer.html

 </div>
 
 {% if settings.GA_ACC and not user.is_staff %}
-<!-- Google analitics counter -->
-<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script>
-<script type="text/javascript">try {
-var pageTracker = _gat._getTracker("{{ settings.GA_ACC|get_key:site.domain }}");
-pageTracker._trackPageview();
-} catch(err) {}</script>
+<script type="text/javascript">
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', '{{ settings.GA_ACC|get_key:site.domain }}']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script');
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
+        'http://www') + '.google-analytics.com/ga.js';
+    ga.setAttribute('async', 'true');
+    document.documentElement.firstChild.appendChild(ga);
+  })();
+</script>
 {% endif %}

templates/templatetags/text_block.html

-<div class="textblock">
+<div class="textblock">
 {% if text_block.name %}<h4>{{ text_block.name }}</h4>{% endif %}
 {{ text_block.html|safe }}
-</div>
+</div>

themes/andreas08/footer.html

 | {% trans "Original design by " %} <a href="http://andreasviklund.com/">Andreas Viklund</a></p>
 
 {% if settings.GA_ACC %}
-<!-- Google analitics counter -->
-<script type="text/javascript" src="https://ssl.google-analytics.com/ga.js"></script>
 <script type="text/javascript">
-var pageTracker = _gat._getTracker("{{ settings.GA_ACC }}");
-pageTracker._initData();
-pageTracker._trackPageview();
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', '{{ settings.GA_ACC|get_key:site.domain }}']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script');
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 
+        'http://www') + '.google-analytics.com/ga.js';
+    ga.setAttribute('async', 'true');
+    document.documentElement.firstChild.appendChild(ga);
+  })();
 </script>
 {% endif %}

themes/buriy/footer.html

 {% if settings.GA_ACC and not user.is_staff %}
-<!-- Google analitics counter -->
-<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script>
-<script type="text/javascript">try {
-var pageTracker = _gat._getTracker("{{ settings.GA_ACC }}");
-pageTracker._trackPageview();
-} catch(err) {}</script>
+<script type="text/javascript">
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', '{{ settings.GA_ACC|get_key:site.domain }}']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script');
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 
+        'http://www') + '.google-analytics.com/ga.js';
+    ga.setAttribute('async', 'true');
+    document.documentElement.firstChild.appendChild(ga);
+  })();
+</script>
 {% endif %}
 
 {% ifapp debug %}

themes/lite/accounts/profile_edit.html

 
 {% block content %}
 <p><a href="{% url openid_list %}">{% trans "Associated OpenIDs" %}</a></p>
+{% if appcheck.watchlist %}
 <p><a href="{% url wl_list %}">{% trans "Subscriptions list" %}</a></p>
+{% endif %}
 <form action="." method="post">
     <div class="wide">
     {{ form.as_p }}

themes/lite/footer.html

     {% endif %}
 
 {% if settings.GA_ACC and not user.is_staff %}
-<!-- Google analitics counter -->
-<script type="text/javascript" src="https://ssl.google-analytics.com/ga.js"></script>
 <script type="text/javascript">
-var pageTracker = _gat._getTracker("{{ settings.GA_ACC|get_key:site.domain }}");
-pageTracker._initData();
-pageTracker._trackPageview();
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', '{{ settings.GA_ACC|get_key:site.domain }}']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script');
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 
+        'http://www') + '.google-analytics.com/ga.js';
+    ga.setAttribute('async', 'true');
+    document.documentElement.firstChild.appendChild(ga);
+  })();
 </script>
 {% endif %}
 </div>

themes/mirev/footer.html

 </div>
 
 {% if settings.GA_ACC and not user.is_staff %}
-<!-- Google analitics counter -->
-<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script>
-<script type="text/javascript">try {
-var pageTracker = _gat._getTracker("{{ settings.GA_ACC|get_key:site.domain }}");
-pageTracker._trackPageview();
-} catch(err) {}</script>
+<script type="text/javascript">
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', '{{ settings.GA_ACC|get_key:site.domain }}']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script');
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 
+        'http://www') + '.google-analytics.com/ga.js';
+    ga.setAttribute('async', 'true');
+    document.documentElement.firstChild.appendChild(ga);
+  })();
+</script>
 {% endif %}