Changeset - d982ed8e32d8
[Not reviewed]
pylons_app/config/routing.py
Show inline comments
 
@@ -16,24 +16,25 @@ def make_map(config):
 
    # The ErrorController route (handles 404/500 error pages); it should
 
    # likely stay at the top, ensuring it can always be resolved
 
    map.connect('/error/{action}', controller='error')
 
    map.connect('/error/{action}/{id}', controller='error')
 

	
 
    # CUSTOM ROUTES HERE
 
    map.connect('hg_home', '/', controller='hg', action='index')
 
    
 
    
 
    #REST controllers
 
    map.resource('repo', 'repos', path_prefix='/_admin')
 
    map.resource('user', 'users', path_prefix='/_admin')
 
    map.resource('permission', 'permissions', path_prefix='/_admin')
 
    
 
    #ADMIN
 
    with map.submapper(path_prefix='/_admin', controller='admin') as m:
 
        m.connect('admin_home', '/', action='index')#main page
 
        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')
pylons_app/controllers/permissions.py
Show inline comments
 
new file 100644
 
import logging
 

	
 
from pylons import request, response, session, tmpl_context as c, url
 
from pylons.controllers.util import abort, redirect
 

	
 
from pylons_app.lib.base import BaseController, render
 

	
 
log = logging.getLogger(__name__)
 

	
 
class PermissionsController(BaseController):
 
    """REST Controller styled on the Atom Publishing Protocol"""
 
    # To properly map this controller, ensure your config/routing.py
 
    # file has a resource setup:
 
    #     map.resource('permission', 'permissions')
 

	
 
    def index(self, format='html'):
 
        """GET /permissions: All items in the collection"""
 
        # url('permissions')
 
        return render('admin/permissions/permissions.html')
 

	
 
    def create(self):
 
        """POST /permissions: Create a new item"""
 
        # url('permissions')
 

	
 
    def new(self, format='html'):
 
        """GET /permissions/new: Form to create a new item"""
 
        # url('new_permission')
 

	
 
    def update(self, id):
 
        """PUT /permissions/id: Update an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="PUT" />
 
        # Or using helpers:
 
        #    h.form(url('permission', id=ID),
 
        #           method='put')
 
        # url('permission', id=ID)
 

	
 
    def delete(self, id):
 
        """DELETE /permissions/id: Delete an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="DELETE" />
 
        # Or using helpers:
 
        #    h.form(url('permission', id=ID),
 
        #           method='delete')
 
        # url('permission', id=ID)
 

	
 
    def show(self, id, format='html'):
 
        """GET /permissions/id: Show a specific item"""
 
        # url('permission', id=ID)
 

	
 
    def edit(self, id, format='html'):
 
        """GET /permissions/id/edit: Form to edit an existing item"""
 
        # url('edit_permission', id=ID)
pylons_app/public/css/monoblue_custom.css
Show inline comments
 
@@ -112,30 +112,30 @@ div#container {
 
div.page-header {
 
	padding: 50px 20px 0;
 
	background: #556cb5 top left repeat-x;
 
	position: relative;
 
}
 

	
 
div.page-header h1 {
 
	margin: 10px 0 30px;
 
	font-size: 1.8em;
 
	font-weight: bold;
 
	font-family: sans-serif;
 
	letter-spacing: 1px;
 
	color: #DDD;
 
	color: #FFFFFF;
 
}
 

	
 
div.page-header h1 a {
 
	font-weight: bold;
 
	color: #FFF;
 
	color: #FFFFFF;
 
}
 

	
 
div.page-header a {
 
	text-decoration: none;
 
}
 

	
 
div.page-header form {
 
	position: absolute;
 
	margin-bottom: 2px;
 
	bottom: 0;
 
	right: 20px;
 
}
pylons_app/templates/admin/admin.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${_('Administration')}
 
</%def>
 
<%def name="breadcrumbs()">
 
	${h.link_to(u'Admin',h.url('admin_home'))}
 
	 /  
 
</%def>
 
<%def name="page_nav()">
 
	${self.menu('admin')}
 
	${self.submenu('')}
 
</%def>
 
<%def name="main()">
 
    %if c.admin_user:
 
	    <div>
 
	        <h2>Welcome ${c.admin_username}</h2>
 
			    <div id="user_log">
 
					${c.log_data}
 
				</div>
pylons_app/templates/admin/permissions/permissions.html
Show inline comments
 
new file 100644
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${_('Permissions administration')}
 
</%def>
 
<%def name="breadcrumbs()">
 
	${h.link_to(u'Admin',h.url('admin_home'))}
 
	 /  
 
	 ${_('Permissions')}
 
</%def>
 
<%def name="page_nav()">
 
	${self.menu('admin')}
 
	${self.submenu('permissions')}
 
</%def>
 
<%def name="main()">
 
	<div>
 
	<h2>${_('Permissions')}</h2>
 
	todo :) 
 
    </div>
 
</%def>    
pylons_app/templates/admin/repos/repo_add.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${_('Repositories administration')}
 
</%def>
 
<%def name="breadcrumbs()">
 
	${h.link_to(u'Admin',h.url('admin_home'))}
 
	 /  
 
	${_('Repos')}
 
</%def>
 
<%def name="page_nav()">
 
	${self.menu('admin')}
 
	${self.submenu('repos')}
 
</%def>
 
<%def name="main()">
 
	<div>
 
        <h2>${_('Repositories')} - ${_('add new')}</h2>
 
        ${h.form(url('repos'))}
 
        <table>
 
        	<tr>
 
        		<td>${_('Name')}</td>
pylons_app/templates/admin/repos/repo_edit.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${_('Repositories administration')}
 
</%def>
 
<%def name="breadcrumbs()">
 
	${h.link_to(u'Admin',h.url('admin_home'))}
 
	 /  
 
	 ${_('Repos')}
 
</%def>
 
<%def name="page_nav()">
 
	${self.menu('admin')}
 
	${self.submenu('repos')}
 
</%def>
 
<%def name="main()">
 
	<div>
 
        <h2>${_('Repositories')} - ${_('edit')}</h2>
 
        ${h.form(url('repo', id=ID),method='put'))}
 
        ${h.form(url('repo', id=c.new_repo),method='put')}
 
        <table>
 
        	<tr>
 
        		<td>${_('Name')}</td>
 
        		<td>${h.text('name',c.new_repo)}</td>
 
        	</tr>
 
        	<tr>
 
        		<td>${_('Description')}</td>
 
        		<td>${h.textarea('description',cols=23,rows=5)}</td>
 
        	</tr>
 
        	<tr>
 
        		<td>${_('Private')}</td>
 
        		<td>${h.checkbox('private')}</td>
pylons_app/templates/admin/repos/repos.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${_('Repositories administration')}
 
</%def>
 
<%def name="breadcrumbs()">
 
	${h.link_to(u'Admin',h.url('admin_home'))}
 
	 /  
 
	 ${_('Repos')}
 
</%def>
 
<%def name="page_nav()">
 
	${self.menu('admin')}
 
	${self.submenu('repos')}
 
</%def>
 
<%def name="main()">
 
	<div>
 
        <h2>${_('Repositories administration')}</h2>
 
        <table class="table_disp">
 
        <tr class="header">
 
            <td>${_('name')}</td>
 
            <td>${_('last revision')}</td>
pylons_app/templates/admin/users/user_add.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${_('User administration')}
 
</%def>
 
<%def name="breadcrumbs()">
 
	${h.link_to(u'Admin',h.url('admin_home'))}
 
	 /  
 
	 ${_('Users')}
 
</%def>
 
<%def name="page_nav()">
 
	${self.menu('admin')}
 
	${self.submenu('users')}
 
</%def>
 
<%def name="main()">
 
	<div>
 
        <h2>${_('User')} - ${_('add new')}</h2>
 
        ${h.form(url('users'))}
 
        <table>
 
        	<tr>
 
        		<td>${_('Username')}</td>
pylons_app/templates/admin/users/user_edit.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${_('User administration')}
 
</%def>
 
<%def name="breadcrumbs()">
 
	${h.link_to(u'Admin',h.url('admin_home'))}
 
	 /  
 
	${_('Users')}
 
</%def>
 
<%def name="page_nav()">
 
	${self.menu('admin')}
 
	${self.submenu('users')}
 
</%def>
 
<%def name="main()">
 
	<div>
 
        <h2>${_('User')} - ${c.user.username}</h2>
 
        ${h.form(url('user', id=c.user.user_id),method='put')}
 
        <table>
 
        	<tr>
 
        		<td>${_('Username')}</td>
pylons_app/templates/admin/users/users.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${_('Users administration')}
 
</%def>
 
<%def name="breadcrumbs()">
 
	${h.link_to(u'Admin',h.url('admin_home'))}
 
	 /  
 
	 ${_('Users')}
 
</%def>
 
<%def name="page_nav()">
 
	${self.menu('admin')}
 
	${self.submenu('users')}
 
</%def>
 
<%def name="main()">
 
	<div>
 
        <h2>${_('Mercurial users')}</h2>
 
        <table class="table_disp">
 
         <tr class="header">
 
            <td>${_('id')}</td>
 
            <td>${_('username')}</td>
pylons_app/tests/functional/test_permissions.py
Show inline comments
 
new file 100644
 
from pylons_app.tests import *
 

	
 
class TestPermissionsController(TestController):
 

	
 
    def test_index(self):
 
        response = self.app.get(url('permissions'))
 
        # Test response...
 

	
 
    def test_index_as_xml(self):
 
        response = self.app.get(url('formatted_permissions', format='xml'))
 

	
 
    def test_create(self):
 
        response = self.app.post(url('permissions'))
 

	
 
    def test_new(self):
 
        response = self.app.get(url('new_permission'))
 

	
 
    def test_new_as_xml(self):
 
        response = self.app.get(url('formatted_new_permission', format='xml'))
 

	
 
    def test_update(self):
 
        response = self.app.put(url('permission', id=1))
 

	
 
    def test_update_browser_fakeout(self):
 
        response = self.app.post(url('permission', id=1), params=dict(_method='put'))
 

	
 
    def test_delete(self):
 
        response = self.app.delete(url('permission', id=1))
 

	
 
    def test_delete_browser_fakeout(self):
 
        response = self.app.post(url('permission', id=1), params=dict(_method='delete'))
 

	
 
    def test_show(self):
 
        response = self.app.get(url('permission', id=1))
 

	
 
    def test_show_as_xml(self):
 
        response = self.app.get(url('formatted_permission', id=1, format='xml'))
 

	
 
    def test_edit(self):
 
        response = self.app.get(url('edit_permission', id=1))
 

	
 
    def test_edit_as_xml(self):
 
        response = self.app.get(url('formatted_edit_permission', id=1, format='xml'))
0 comments (0 inline, 0 general)