Commits

Hudarsono Hu  committed 997e9dd

working feed

  • Participants
  • Parent commits cd4e2a9

Comments (0)

Files changed (37)

File appengine_django/__init__.pyc

Binary file modified.

File appengine_django/db/__init__.pyc

Binary file modified.

File appengine_django/db/base.pyc

Binary file modified.

File appengine_django/db/creation.pyc

Binary file modified.

File appengine_django/mail.pyc

Binary file modified.

File appengine_django/models.pyc

Binary file modified.

File appengine_django/replacement_imp.pyc

Binary file modified.

File appengine_django/serializer/__init__.pyc

Binary file modified.

File appengine_django/serializer/json.pyc

Binary file modified.

File appengine_django/serializer/python.pyc

Binary file modified.

File appengine_django/serializer/pyyaml.pyc

Binary file modified.

File appengine_django/sessions/backends/__init__.pyc

Binary file modified.

File context/__init__.pyc

Binary file modified.

File gaesessions/__init__.pyc

Binary file modified.

File markdown/__init__.pyc

Binary file modified.

File markdown/blockparser.pyc

Binary file modified.

File markdown/blockprocessors.pyc

Binary file modified.

File markdown/etree_loader.pyc

Binary file modified.

File markdown/html4.pyc

Binary file modified.

File markdown/inlinepatterns.pyc

Binary file modified.

File markdown/odict.pyc

Binary file modified.

File markdown/postprocessors.pyc

Binary file modified.

File markdown/preprocessors.pyc

Binary file modified.

File markdown/treeprocessors.pyc

Binary file modified.

File pages/__init__.pyc

Binary file modified.

File posts/__init__.pyc

Binary file modified.

File posts/models.pyc

Binary file modified.

File posts/rss.py

+from django.contrib.syndication.views import Feed
+from posts.models import Post
+from django.conf import settings
+
+from google.appengine.api import memcache
+
+
+class LatestFeed(Feed):
+	title = settings.BLOG_TITLE
+	link = settings.SITE_URL
+	description = 'Latest Update'
+	
+	item_author_name = settings.AUTHOR
+	item_author_email = settings.AUTHOR_EMAIL
+	item_author_link = settings.SITE_URL
+	
+	def items(self):
+		if memcache.get('feed_latest'):
+			posts = memcache.get('feed_latest')
+		else:
+			posts = Post.all().order('-pub_date').fetch(10)
+			memcache.set('feed_latest', posts)
+		return posts
+			
+	def item_title(self, item):
+		return item.title
+		
+	def item_description(self, item):
+		return item.trunc_body()

File posts/views.py

 
 from google.appengine.api import memcache
 
-from gaesessions import get_current_session
 
 
 def listPost(request):

File pygments/__init__.pyc

Binary file modified.

File pygments/util.pyc

Binary file modified.
      'context',
      'markdown',
      'pygments',
-     'gaesessions',
 #    'django.contrib.auth',
 #    'django.contrib.contenttypes',
 #    'django.contrib.sessions',
 
 # APP SETTINGS
 PAGESIZE = 5
+BLOG_TITLE = 'Hudarsono\'s Blog'
+SITE_URL = 'localhost'
+AUTHOR = 'Hudarsono'
+AUTHOR_EMAIL = 'hudarsono@gmail.com'

File settings.pyc

Binary file modified.

File templates/feeds/latest_description.html

+{% autoescape off %}
+{{ obj.trunc_body }}
+{% endautoescape %}

File templates/feeds/latest_title.html

+{{ obj.title }}
 
 from django.conf.urls.defaults import *
 from django.conf import settings
+from posts.rss import LatestFeed
+
 
 urlpatterns = patterns('',
     # Example:
 	(r'^media/upload/', 'media.views.upload'),
     (r'^media/download/([-\w]+)', 'media.views.download'),
 
+	(r'^feeds/latest/$', LatestFeed()),
+
     (r'^contact/$', 'pages.views.contact'),
     (r'^([-\w]+)', 'pages.views.render'),
 )

File urls.pyc

Binary file modified.