[feedjack commit] r66 - in branches/0.9: . feedjack feedjack/bin

1 view
Skip to first unread message

codesite...@google.com

unread,
Aug 18, 2008, 12:32:00 AM8/18/08
to feedjack...@googlegroups.com
Author: gpicon
Date: Sun Aug 17 21:31:32 2008
New Revision: 66

Added:
branches/0.9/feedjack/admin.py
- copied unchanged from r65, /trunk/feedjack/admin.py
Modified:
branches/0.9/CHANGES
branches/0.9/feedjack/bin/feedjack_update.py
branches/0.9/feedjack/fjlib.py
branches/0.9/feedjack/models.py
branches/0.9/feedjack/urls.py
branches/0.9/setup.py

Log:
Merging trunk to 0.9 branch


Modified: branches/0.9/CHANGES
==============================================================================
--- branches/0.9/CHANGES (original)
+++ branches/0.9/CHANGES Sun Aug 17 21:31:32 2008
@@ -1,5 +1,8 @@
CHANGES:

+Feedjack 0.9.16
+* Added compatibility with Django 1.0 beta 1: newforms admin and pagination
+
Feedjack 0.9.15
* Fixing feedjack_update for posts without a modified date (yay rss 0.92!)

Modified: branches/0.9/feedjack/bin/feedjack_update.py
==============================================================================
--- branches/0.9/feedjack/bin/feedjack_update.py (original)
+++ branches/0.9/feedjack/bin/feedjack_update.py Sun Aug 17 21:31:32 2008
@@ -22,7 +22,7 @@
except ImportError:
threadpool = None

-VERSION = '0.9.15'
+VERSION = '0.9.16'
URL = 'http://www.feedjack.org/'
USER_AGENT = 'Feedjack %s - %s' % (VERSION, URL)
SLOWFEED_WARNING = 10

Modified: branches/0.9/feedjack/fjlib.py
==============================================================================
--- branches/0.9/feedjack/fjlib.py (original)
+++ branches/0.9/feedjack/fjlib.py Sun Aug 17 21:31:32 2008
@@ -8,12 +8,77 @@

from django.conf import settings
from django.db import connection
-from django.core.paginator import ObjectPaginator, InvalidPage
+from django.core.paginator import Paginator, InvalidPage
from django.http import Http404
from django.utils.encoding import smart_unicode

from feedjack import models
from feedjack import fjcache
+
+
+# this is taken from django, it was removed in r8191
+class ObjectPaginator(Paginator):
+ """
+ Legacy ObjectPaginator class, for backwards compatibility.
+
+ Note that each method on this class that takes page_number expects a
+ zero-based page number, whereas the new API (Paginator/Page) uses one-based
+ page numbers.
+ """
+ def __init__(self, query_set, num_per_page, orphans=0):
+ Paginator.__init__(self, query_set, num_per_page, orphans)
+ import warnings
+ warnings.warn("The ObjectPaginator is deprecated. Use django.core.paginator.Paginator instead.", DeprecationWarning)
+
+ # Keep these attributes around for backwards compatibility.
+ self.query_set = query_set
+ self.num_per_page = num_per_page
+ self._hits = self._pages = None
+
+ def validate_page_number(self, page_number):
+ try:
+ page_number = int(page_number) + 1
+ except ValueError:
+ raise PageNotAnInteger
+ return self.validate_number(page_number)
+
+ def get_page(self, page_number):
+ try:
+ page_number = int(page_number) + 1
+ except ValueError:
+ raise PageNotAnInteger
+ return self.page(page_number).object_list
+
+ def has_next_page(self, page_number):
+ return page_number < self.pages - 1
+
+ def has_previous_page(self, page_number):
+ return page_number > 0
+
+ def first_on_page(self, page_number):
+ """
+ Returns the 1-based index of the first object on the given page,
+ relative to total objects found (hits).
+ """
+ page_number = self.validate_page_number(page_number)
+ return (self.num_per_page * (page_number - 1)) + 1
+
+ def last_on_page(self, page_number):
+ """
+ Returns the 1-based index of the last object on the given page,
+ relative to total objects found (hits).
+ """
+ page_number = self.validate_page_number(page_number)
+ if page_number == self.num_pages:
+ return self.count
+ return page_number * self.num_per_page
+
+ # The old API called it "hits" instead of "count".
+ hits = Paginator.count
+
+ # The old API called it "pages" instead of "num_pages".
+ pages = Paginator.num_pages
+

def sitefeeds(siteobj):
""" Returns the active feeds of a site.

Modified: branches/0.9/feedjack/models.py
==============================================================================
--- branches/0.9/feedjack/models.py (original)
+++ branches/0.9/feedjack/models.py Sun Aug 17 21:31:32 2008
@@ -33,6 +33,7 @@
return u'%s (%s)' % (self.name, self.link)


+
class Site(models.Model):
name = models.CharField(_('name'), max_length=100)
url = models.CharField(_('url'),
@@ -48,24 +49,22 @@

default_site = models.BooleanField(_('default site'), default=False)
posts_per_page = models.IntegerField(_('posts per page'), default=20)
- order_posts_by = models.IntegerField(_('order posts by'), default=1, \
- choices=SITE_ORDERBY_CHOICES)
+ order_posts_by = models.IntegerField(_('order posts by'), default=1,
+ choices=SITE_ORDERBY_CHOICES)
tagcloud_levels = models.IntegerField(_('tagcloud level'), default=5)
show_tagcloud = models.BooleanField(_('show tagcloud'), default=True)

use_internal_cache = models.BooleanField(_('use internal cache'), default=True)
- cache_duration = models.IntegerField(_('cache duration'), default=60*60*24, \
- help_text=_('Duration in seconds of the cached pages and data.') )
+ cache_duration = models.IntegerField(_('cache duration'), default=60*60*24,
+ help_text=_('Duration in seconds of the cached pages and data.') )

- links = models.ManyToManyField(Link, verbose_name=_('links'), filter_interface=models.VERTICAL, \
+ links = models.ManyToManyField(Link, verbose_name=_('links'),
null=True, blank=True)
- template = models.CharField(_('template'), max_length=100, null=True, blank=True, \
- help_text=_('This template must be a directory in your feedjack ' \
+ template = models.CharField(_('template'), max_length=100, null=True,
+ blank=True,
+ help_text=_('This template must be a directory in your feedjack '
'templates directory. Leave blank to use the default template.') )

- class Admin:
- list_display = ('url', 'name')
-
class Meta:
verbose_name = _('site')
verbose_name_plural = _('sites')
@@ -92,13 +91,14 @@



+
class Feed(models.Model):
feed_url = models.URLField(_('feed url'), unique=True)

name = models.CharField(_('name'), max_length=100)
shortname = models.CharField(_('shortname'), max_length=50)
- is_active = models.BooleanField(_('is active'), default=True, \
- help_text=_('If disabled, this feed will not be further updated.') )
+ is_active = models.BooleanField(_('is active'), default=True,
+ help_text=_('If disabled, this feed will not be further updated.') )

title = models.CharField(_('title'), max_length=200, blank=True)
tagline = models.TextField(_('tagline'), blank=True)
@@ -109,18 +109,6 @@
last_modified = models.DateTimeField(_('last modified'), null=True, blank=True)
last_checked = models.DateTimeField(_('last checked'), null=True, blank=True)

- class Admin:
- list_display = ('name', 'feed_url', 'title', 'last_modified', \
- 'is_active')
- fields = (
- (None, {'fields':('feed_url', 'name', 'shortname', 'is_active')}),
- (_('Fields updated automatically by Feedjack'), {
- 'classes':'collapse',
- 'fields':('title', 'tagline', 'link', 'etag', 'last_modified', \
- 'last_checked')})
- )
- search_fields = ['feed_url', 'name', 'title']
-
class Meta:
verbose_name = _('feed')
verbose_name_plural = _('feeds')
@@ -132,6 +120,8 @@
def save(self):
super(Feed, self).save()

+
+
class Tag(models.Model):
name = models.CharField(_('name'), max_length=50, unique=True)

@@ -156,14 +146,9 @@
author = models.CharField(_('author'), max_length=50, blank=True)
author_email = models.EmailField(_('author email'), blank=True)
comments = models.URLField(_('comments'), blank=True)
- tags = models.ManyToManyField(Tag, verbose_name=_('tags'), filter_interface=models.VERTICAL)
+ tags = models.ManyToManyField(Tag, verbose_name=_('tags'))
date_created = models.DateField(_('date created'), auto_now_add=True)

- class Admin:
- list_display = ('title', 'link', 'author', 'date_modified')
- search_fields = ['link', 'title']
- date_hierarchy = 'date_modified'
-
class Meta:
verbose_name = _('post')
verbose_name_plural = _('posts')
@@ -180,21 +165,19 @@
return self.link


+
class Subscriber(models.Model):
site = models.ForeignKey(Site, verbose_name=_('site') )
feed = models.ForeignKey(Feed, verbose_name=_('feed') )

- name = models.CharField(_('name'), max_length=100, null=True, blank=True, \
- help_text=_('Keep blank to use the Feed\'s original name.') )
- shortname = models.CharField(_('shortname'), max_length=50, null=True, blank=True, \
+ name = models.CharField(_('name'), max_length=100, null=True, blank=True,
+ help_text=_('Keep blank to use the Feed\'s original name.') )
+ shortname = models.CharField(_('shortname'), max_length=50, null=True,
+ blank=True,
help_text=_('Keep blank to use the Feed\'s original shortname.') )
- is_active = models.BooleanField(_('is active'), default=True, \
- help_text=_('If disabled, this subscriber will not appear in the site or '\
+ is_active = models.BooleanField(_('is active'), default=True,
+ help_text=_('If disabled, this subscriber will not appear in the site or '
'in the site\'s feed.') )
-
- class Admin:
- list_display = ('name', 'site', 'feed')
- list_filter = ('site',)

class Meta:
verbose_name = _('subscriber')

Modified: branches/0.9/feedjack/urls.py
==============================================================================
--- branches/0.9/feedjack/urls.py (original)
+++ branches/0.9/feedjack/urls.py Sun Aug 17 21:31:32 2008
@@ -43,3 +43,5 @@
(r'^foaf/$', views.foaf),
(r'^$', views.mainview),
)
+
+#~

Modified: branches/0.9/setup.py
==============================================================================
--- branches/0.9/setup.py (original)
+++ branches/0.9/setup.py Sun Aug 17 21:31:32 2008
@@ -9,7 +9,7 @@

setup(
name = 'Feedjack',
- version = '0.9.15',
+ version = '0.9.16',
url = 'http://www.feedjack.org/',
author = 'Gustavo Picón',
author_email = 'gpi...@gmail.com',

Reply all
Reply to author
Forward
0 new messages