Commits

Marcin Kuzminski committed 66b20f5

Added feed controllers, urls,and changed index page to use them.

  • Participants
  • Parent commits a8ea3ce

Comments (0)

Files changed (4)

File pylons_app/config/routing.py

         m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}',
                   action='add_repo')
     
+    #FEEDS
+    map.connect('rss_feed_home', '/{repo_name}/feed/rss',
+                controller='feed', action='rss')
+    map.connect('atom_feed_home', '/{repo_name}/feed/atom',
+                controller='feed', action='atom')
+    
     map.connect('login_home', '/login', controller='login')
     map.connect('logout_home', '/logout', controller='login', action='logout')
     
                 controller='changeset', revision='tip')
     map.connect('summary_home', '/{repo_name}/summary',
                 controller='summary')
-    map.connect('shortlog_home', '/{repo_name}/shortlog/',
+    map.connect('shortlog_home', '/{repo_name}/shortlog',
                 controller='shortlog')
     map.connect('branches_home', '/{repo_name}/branches',
                 controller='branches')

File pylons_app/controllers/feed.py

+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+import logging
+from operator import itemgetter
+from pylons import tmpl_context as c, request, config
+from pylons_app.lib.base import BaseController, render
+from pylons_app.lib.utils import get_repo_slug
+from pylons_app.model.hg_model import HgModel
+from pylons_app.lib.auth import LoginRequired
+log = logging.getLogger(__name__)
+
+class FeedController(BaseController):
+    
+    #secure it or not ?
+    def __before__(self):
+        super(FeedController, self).__before__()
+        
+    def atom(self):
+        return 'Hello Atom'
+    
+    def rss(self):
+        return 'Hello rss'

File pylons_app/templates/index.html

 		%else:
 			<span style="font-weight: bold">${name}</span>
 		%endif
-		
 		<a href="?sort=${name_slug}">&darr;</a>
 		<a href="?sort=-${name_slug}">&uarr;</a>
-		
 	</%def>
 	<table>
 	  <tr>
 				%endfor
 	        </td>
 			<td>
-				<a  class="rss_logo" href="/${repo['name']}/rss-log">RSS</a>
+				${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=repo['name']),class_='rss_logo')}
 			</td>        
 			<td>
-				<a  class="atom_logo" href="/${repo['name']}/atom-log">Atom</a>
+				${h.link_to(_('Atom'),h.url('rss_feed_home',repo_name=repo['name']),class_='atom_logo')}
 			</td>
 		</tr>
 	%endfor

File pylons_app/tests/functional/test_feed.py

+from pylons_app.tests import *
+
+class TestFeedController(TestController):
+
+    def test_index(self):
+        response = self.app.get(url(controller='feed', action='index'))
+        # Test response...