changeset 861:fd2ea6ceadc8 beta

updated docs on every controller
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 18 Dec 2010 16:55:28 +0100
parents 5f7731e3ab4d
children 4bdd0bf1b1f4
files rhodecode/controllers/admin/ldap_settings.py rhodecode/controllers/branches.py rhodecode/controllers/changelog.py rhodecode/controllers/feed.py rhodecode/controllers/home.py rhodecode/controllers/journal.py rhodecode/controllers/login.py rhodecode/controllers/search.py rhodecode/controllers/settings.py rhodecode/controllers/shortlog.py rhodecode/controllers/tags.py
diffstat 11 files changed, 212 insertions(+), 147 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/admin/ldap_settings.py	Sat Dec 18 16:39:46 2010 +0100
+++ b/rhodecode/controllers/admin/ldap_settings.py	Sat Dec 18 16:55:28 2010 +0100
@@ -1,9 +1,10 @@
 # -*- coding: utf-8 -*-
 """
-    package.rhodecode.controllers.admin.ldap_settings
-    ~~~~~~~~~~~~~~
+    rhodecode.controllers.admin.ldap_settings
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
     ldap controller for RhodeCode
+    
     :created_on: Nov 26, 2010
     :author: marcink
     :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
--- a/rhodecode/controllers/branches.py	Sat Dec 18 16:39:46 2010 +0100
+++ b/rhodecode/controllers/branches.py	Sat Dec 18 16:55:28 2010 +0100
@@ -1,8 +1,15 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# branches controller for pylons
-# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
-# 
+# -*- coding: utf-8 -*-
+"""
+    rhodecode.controllers.branches
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    branches controller for rhodecode
+    
+    :created_on: Apr 21, 2010
+    :author: marcink
+    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
+    :license: GPLv3, see COPYING for more details.
+"""
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2
@@ -17,31 +24,31 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
-"""
-Created on April 21, 2010
-branches controller for pylons
-@author: marcink
-"""
+
+import logging
+
 from pylons import tmpl_context as c
+
 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 from rhodecode.lib.base import BaseController, render
 from rhodecode.lib.utils import OrderedDict
 from rhodecode.model.scm import ScmModel
-import logging
+
 log = logging.getLogger(__name__)
 
 class BranchesController(BaseController):
-    
+
     @LoginRequired()
-    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', 'repository.admin')
+    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
+                                   'repository.admin')
     def __before__(self):
         super(BranchesController, self).__before__()
-    
+
     def index(self):
         hg_model = ScmModel()
         c.repo_info = hg_model.get_repo(c.repo_name)
         c.repo_branches = OrderedDict()
         for name, hash_ in c.repo_info.branches.items():
             c.repo_branches[name] = c.repo_info.get_changeset(hash_)
-                
+
         return render('branches/branches.html')
--- a/rhodecode/controllers/changelog.py	Sat Dec 18 16:39:46 2010 +0100
+++ b/rhodecode/controllers/changelog.py	Sat Dec 18 16:55:28 2010 +0100
@@ -1,8 +1,15 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# changelog controller for pylons
-# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
-# 
+# -*- coding: utf-8 -*-
+"""
+    rhodecode.controllers.changelog
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    changelog controller for rhodecode
+    
+    :created_on: Apr 21, 2010
+    :author: marcink
+    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
+    :license: GPLv3, see COPYING for more details.
+"""
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2
@@ -17,24 +24,24 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
-"""
-Created on April 21, 2010
-changelog controller for pylons
-@author: marcink
-"""
+
+import logging
 
 try:
     import json
 except ImportError:
     #python 2.5 compatibility
     import simplejson as json
+
 from mercurial.graphmod import colored, CHANGESET, revisions as graph_rev
 from pylons import request, session, tmpl_context as c
+
 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 from rhodecode.lib.base import BaseController, render
 from rhodecode.model.scm import ScmModel
+
 from webhelpers.paginate import Page
-import logging
+
 log = logging.getLogger(__name__)
 
 class ChangelogController(BaseController):
--- a/rhodecode/controllers/feed.py	Sat Dec 18 16:39:46 2010 +0100
+++ b/rhodecode/controllers/feed.py	Sat Dec 18 16:55:28 2010 +0100
@@ -1,8 +1,15 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# feed controller for pylons
-# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
- 
+# -*- coding: utf-8 -*-
+"""
+    rhodecode.controllers.feed
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    Feed controller for rhodecode
+    
+    :created_on: Apr 23, 2010
+    :author: marcink
+    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
+    :license: GPLv3, see COPYING for more details.
+"""
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2
@@ -17,20 +24,19 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
-"""
-Created on April 23, 2010
-feed controller for pylons
-@author: marcink
-"""
-from pylons import tmpl_context as c, url, response
-from rhodecode.lib.base import BaseController, render
+
+
+import logging
+
+from pylons import url, response
+from rhodecode.lib.base import BaseController
 from rhodecode.model.scm import ScmModel
 from webhelpers.feedgenerator import Atom1Feed, Rss201rev2Feed
-import logging
+
 log = logging.getLogger(__name__)
 
 class FeedController(BaseController):
-    
+
     #secure it or not ?
     def __before__(self):
         super(FeedController, self).__before__()
@@ -48,7 +54,7 @@
                          description=self.description % repo_name,
                          language=self.language,
                          ttl=self.ttl)
-        
+
         changesets = ScmModel().get_repo(repo_name)
 
         for cs in changesets[:self.feed_nr]:
@@ -56,11 +62,11 @@
                           link=url('changeset_home', repo_name=repo_name,
                                    revision=cs.raw_id, qualified=True),
                                    description=str(cs.date))
-        
+
         response.content_type = feed.mime_type
         return feed.writeString('utf-8')
 
-    
+
     def rss(self, repo_name):
         """Produce an rss2 feed via feedgenerator module"""
         feed = Rss201rev2Feed(title=self.title % repo_name,
@@ -68,13 +74,13 @@
                          description=self.description % repo_name,
                          language=self.language,
                          ttl=self.ttl)
-        
+
         changesets = ScmModel().get_repo(repo_name)
         for cs in changesets[:self.feed_nr]:
             feed.add_item(title=cs.message,
                           link=url('changeset_home', repo_name=repo_name,
                                    revision=cs.raw_id, qualified=True),
                           description=str(cs.date))
-            
+
         response.content_type = feed.mime_type
         return feed.writeString('utf-8')
--- a/rhodecode/controllers/home.py	Sat Dec 18 16:39:46 2010 +0100
+++ b/rhodecode/controllers/home.py	Sat Dec 18 16:55:28 2010 +0100
@@ -1,8 +1,15 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# hg controller for pylons
-# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
-# 
+# -*- coding: utf-8 -*-
+"""
+    rhodecode.controllers.home
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    Home controller for Rhodecode
+    
+    :created_on: Feb 18, 2010
+    :author: marcink
+    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
+    :license: GPLv3, see COPYING for more details.
+"""
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2
@@ -17,17 +24,16 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
-"""
-Created on February 18, 2010
-hg controller for pylons
-@author: marcink
-"""
+
+import logging
 from operator import itemgetter
+
 from pylons import tmpl_context as c, request
+
 from rhodecode.lib.auth import LoginRequired
 from rhodecode.lib.base import BaseController, render
 from rhodecode.model.scm import ScmModel
-import logging
+
 log = logging.getLogger(__name__)
 
 class HomeController(BaseController):
@@ -51,8 +57,10 @@
 
         sort_key = current_sort_slug + '_sort'
         if c.sort_by.startswith('-'):
-            c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=True)
+            c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key),
+                                  reverse=True)
         else:
-            c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=False)
+            c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key),
+                                  reverse=False)
 
         return render('/index.html')
--- a/rhodecode/controllers/journal.py	Sat Dec 18 16:39:46 2010 +0100
+++ b/rhodecode/controllers/journal.py	Sat Dec 18 16:55:28 2010 +0100
@@ -1,8 +1,15 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# journal controller for pylons
-# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
-# 
+# -*- coding: utf-8 -*-
+"""
+    rhodecode.controllers.journal
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    Journal controller for pylons
+    
+    :created_on: Nov 21, 2010
+    :author: marcink
+    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
+    :license: GPLv3, see COPYING for more details.
+"""
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2
@@ -17,22 +24,19 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
-"""
-Created on November 21, 2010
-journal controller for pylons
-@author: marcink
-"""
+
+import logging
+from sqlalchemy import or_
 
 from pylons import request, response, session, tmpl_context as c, url
-from pylons.controllers.util import abort, redirect
+
 from rhodecode.lib.auth import LoginRequired, NotAnonymous
 from rhodecode.lib.base import BaseController, render
 from rhodecode.lib.helpers import get_token
 from rhodecode.model.db import UserLog, UserFollowing
 from rhodecode.model.scm import ScmModel
-from sqlalchemy import or_
-import logging
-from paste.httpexceptions import HTTPInternalServerError, HTTPNotFound
+
+from paste.httpexceptions import HTTPInternalServerError
 
 log = logging.getLogger(__name__)
 
--- a/rhodecode/controllers/login.py	Sat Dec 18 16:39:46 2010 +0100
+++ b/rhodecode/controllers/login.py	Sat Dec 18 16:55:28 2010 +0100
@@ -1,8 +1,15 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# login controller for pylons
-# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
-# 
+# -*- coding: utf-8 -*-
+"""
+    rhodecode.controllers.login
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    Login controller for rhodeocode
+    
+    :created_on: Apr 22, 2010
+    :author: marcink
+    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
+    :license: GPLv3, see COPYING for more details.
+"""
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2
@@ -18,22 +25,21 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
 
-"""
-Created on April 22, 2010
-login controller for pylons
-@author: marcink
-"""
+import logging
+import formencode
+
 from formencode import htmlfill
+
+from pylons.i18n.translation import _
+from pylons.controllers.util import abort, redirect
 from pylons import request, response, session, tmpl_context as c, url
-from pylons.controllers.util import abort, redirect
+
+import rhodecode.lib.helpers as h
 from rhodecode.lib.auth import AuthUser, HasPermissionAnyDecorator
 from rhodecode.lib.base import BaseController, render
-import rhodecode.lib.helpers as h
-from pylons.i18n.translation import _
 from rhodecode.model.forms import LoginForm, RegisterForm, PasswordResetForm
 from rhodecode.model.user import UserModel
-import formencode
-import logging
+
 
 log = logging.getLogger(__name__)
 
--- a/rhodecode/controllers/search.py	Sat Dec 18 16:39:46 2010 +0100
+++ b/rhodecode/controllers/search.py	Sat Dec 18 16:55:28 2010 +0100
@@ -1,8 +1,15 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# search controller for pylons
-# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
-# 
+# -*- coding: utf-8 -*-
+"""
+    rhodecode.controllers.search
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    Search controller for rhodecode
+    
+    :created_on: Aug 7, 2010
+    :author: marcink
+    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
+    :license: GPLv3, see COPYING for more details.
+"""
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2
@@ -17,24 +24,23 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
-"""
-Created on Aug 7, 2010
-search controller for pylons
-@author: marcink
-"""
+import logging
+import traceback
+
+from pylons.i18n.translation import _
 from pylons import request, response, config, session, tmpl_context as c, url
 from pylons.controllers.util import abort, redirect
+
 from rhodecode.lib.auth import LoginRequired
 from rhodecode.lib.base import BaseController, render
 from rhodecode.lib.indexers import SCHEMA, IDX_NAME, ResultWrapper
+
 from webhelpers.paginate import Page
 from webhelpers.util import update_params
-from pylons.i18n.translation import _
+
 from whoosh.index import open_dir, EmptyIndexError
 from whoosh.qparser import QueryParser, QueryParserError
 from whoosh.query import Phrase
-import logging
-import traceback
 
 log = logging.getLogger(__name__)
 
@@ -107,7 +113,8 @@
             except (EmptyIndexError, IOError):
                 log.error(traceback.format_exc())
                 log.error('Empty Index data')
-                c.runtime = _('There is no index to search in. Please run whoosh indexer')
+                c.runtime = _('There is no index to search in. '
+                              'Please run whoosh indexer')
 
         # Return a rendered template
         return render('/search/search.html')
--- a/rhodecode/controllers/settings.py	Sat Dec 18 16:39:46 2010 +0100
+++ b/rhodecode/controllers/settings.py	Sat Dec 18 16:55:28 2010 +0100
@@ -1,8 +1,15 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# settings controller for pylons
-# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
-# 
+# -*- coding: utf-8 -*-
+"""
+    rhodecode.controllers.settings
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    Settings controller for rhodecode
+    
+    :created_on: Jun 30, 2010
+    :author: marcink
+    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
+    :license: GPLv3, see COPYING for more details.
+"""
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2
@@ -17,24 +24,23 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
-"""
-Created on June 30, 2010
-settings controller for pylons
-@author: marcink
-"""
+
+import logging
+import traceback
+
+import formencode
 from formencode import htmlfill
+
 from pylons import tmpl_context as c, request, url
 from pylons.controllers.util import redirect
 from pylons.i18n.translation import _
+
+import rhodecode.lib.helpers as h
 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAllDecorator
 from rhodecode.lib.base import BaseController, render
 from rhodecode.lib.utils import invalidate_cache, action_logger
 from rhodecode.model.forms import RepoSettingsForm, RepoForkForm
 from rhodecode.model.repo import RepoModel
-import formencode
-import logging
-import rhodecode.lib.helpers as h
-import traceback
 
 log = logging.getLogger(__name__)
 
--- a/rhodecode/controllers/shortlog.py	Sat Dec 18 16:39:46 2010 +0100
+++ b/rhodecode/controllers/shortlog.py	Sat Dec 18 16:55:28 2010 +0100
@@ -1,8 +1,15 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# shortlog controller for pylons
-# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
- 
+# -*- coding: utf-8 -*-
+"""
+    rhodecode.controllers.shortlog
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    Shortlog controller for rhodecode
+    
+    :created_on: Apr 18, 2010
+    :author: marcink
+    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
+    :license: GPLv3, see COPYING for more details.
+"""
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2
@@ -17,27 +24,27 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
-"""
-Created on April 18, 2010
-shortlog controller for pylons
-@author: marcink
-"""
+
+import logging
+
 from pylons import tmpl_context as c, request
+
+from webhelpers.paginate import Page
+
 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 from rhodecode.lib.base import BaseController, render
 from rhodecode.model.scm import ScmModel
-from webhelpers.paginate import Page
-import logging
+
 log = logging.getLogger(__name__)
 
 class ShortlogController(BaseController):
-    
+
     @LoginRequired()
     @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
-                                   'repository.admin')       
+                                   'repository.admin')
     def __before__(self):
         super(ShortlogController, self).__before__()
-        
+
     def index(self):
         p = int(request.params.get('page', 1))
         repo = ScmModel().get_repo(c.repo_name)
--- a/rhodecode/controllers/tags.py	Sat Dec 18 16:39:46 2010 +0100
+++ b/rhodecode/controllers/tags.py	Sat Dec 18 16:55:28 2010 +0100
@@ -1,8 +1,15 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# tags controller for pylons
-# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
-# 
+# -*- coding: utf-8 -*-
+"""
+    rhodecode.controllers.tags
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    Tags controller for rhodecode
+    
+    :created_on: Apr 21, 2010
+    :author: marcink
+    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
+    :license: GPLv3, see COPYING for more details.
+"""
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2
@@ -17,31 +24,30 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
-"""
-Created on April 21, 2010
-tags controller for pylons
-@author: marcink
-"""
+import logging
+
 from pylons import tmpl_context as c
+
 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 from rhodecode.lib.base import BaseController, render
 from rhodecode.lib.utils import OrderedDict
 from rhodecode.model.scm import ScmModel
-import logging
+
 log = logging.getLogger(__name__)
 
 class TagsController(BaseController):
-    
+
     @LoginRequired()
-    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', 'repository.admin')       
+    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
+                                   'repository.admin')
     def __before__(self):
         super(TagsController, self).__before__()
-        
+
     def index(self):
         hg_model = ScmModel()
         c.repo_info = hg_model.get_repo(c.repo_name)
         c.repo_tags = OrderedDict()
         for name, hash_ in c.repo_info.tags.items():
             c.repo_tags[name] = c.repo_info.get_changeset(hash_)
-        
+
         return render('tags/tags.html')