Changeset - 66b20f525750
[Not reviewed]
default
0 2 2
Marcin Kuzminski - 15 years ago 2010-05-23 01:03:54
marcin@python-works.com
Added feed controllers, urls,and changed index page to use them.
4 files changed with 38 insertions and 5 deletions:
0 comments (0 inline, 0 general)
pylons_app/config/routing.py
Show inline comments
 
@@ -32,6 +32,12 @@ def make_map(config):
 
        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')
 
    
 
@@ -39,7 +45,7 @@ def make_map(config):
 
                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')
pylons_app/controllers/feed.py
Show inline comments
 
new file 100644
 
#!/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'
pylons_app/templates/index.html
Show inline comments
 
@@ -20,10 +20,8 @@ from pylons_app.lib import filters
 
		%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>
 
@@ -49,10 +47,10 @@ from pylons_app.lib import filters
 
				%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
pylons_app/tests/functional/test_feed.py
Show inline comments
 
new file 100644
 
from pylons_app.tests import *
 

	
 
class TestFeedController(TestController):
 

	
 
    def test_index(self):
 
        response = self.app.get(url(controller='feed', action='index'))
 
        # Test response...
0 comments (0 inline, 0 general)