Changeset - 6832ef664673
[Not reviewed]
beta
! ! !
Marcin Kuzminski - 15 years ago 2011-04-03 18:23:15
marcin@python-works.com
source code cleanup: remove trailing white space, normalize file endings
83 files changed with 475 insertions and 537 deletions:
0 comments (0 inline, 0 general)
ez_setup.py
Show inline comments
 
@@ -92,7 +92,7 @@ def use_setuptools(
 
    try:
 
        import pkg_resources
 
    except ImportError:
 
        return do_download()       
 
        return do_download()
 
    try:
 
        pkg_resources.require("setuptools>="+version); return
 
    except pkg_resources.VersionConflict, e:
 
@@ -268,9 +268,3 @@ if __name__=='__main__':
 
        update_md5(sys.argv[2:])
 
    else:
 
        main(sys.argv[1:])
 

	
 

	
 

	
 

	
 

	
 

	
rhodecode/__init__.py
Show inline comments
 
@@ -8,19 +8,19 @@
 

	
 
    :created_on: Apr 9, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/config/middleware.py
Show inline comments
 
@@ -76,4 +76,3 @@ def make_app(global_conf, full_stack=Tru
 
    app.config = config
 

	
 
    return app
 

	
rhodecode/config/routing.py
Show inline comments
 
@@ -19,7 +19,7 @@ def make_map(config):
 
    def check_repo(environ, match_dict):
 
        """
 
        check for valid repository for proper 404 handling
 
        
 

	
 
        :param environ:
 
        :param match_dict:
 
        """
rhodecode/controllers/admin/admin.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Controller for Admin panel of Rhodecode
 
    
 

	
 
    :created_on: Apr 7, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -57,4 +57,3 @@ class AdminController(BaseController):
 
        if request.params.get('partial'):
 
            return c.log_data
 
        return render('admin/admin.html')
 

	
rhodecode/controllers/admin/ldap_settings.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    ldap controller for RhodeCode
 
    
 

	
 
    :created_on: Nov 26, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/controllers/admin/permissions.py
Show inline comments
 
@@ -2,24 +2,24 @@
 
"""
 
    rhodecode.controllers.admin.permissions
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
    
 

	
 
    permissions controller for Rhodecode
 
    
 

	
 
    :created_on: Apr 27, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/controllers/admin/repos.py
Show inline comments
 
@@ -2,24 +2,24 @@
 
"""
 
    rhodecode.controllers.admin.repos
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
    
 

	
 
    Admin controller for RhodeCode
 
    
 

	
 
    :created_on: Apr 7, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -82,7 +82,7 @@ class ReposController(BaseController):
 
    def __load_data(self, repo_name=None):
 
        """
 
        Load defaults settings for edit, and update
 
        
 

	
 
        :param repo_name:
 
        """
 
        self.__load_defaults()
 
@@ -301,7 +301,7 @@ class ReposController(BaseController):
 
    def delete_perm_user(self, repo_name):
 
        """
 
        DELETE an existing repository permission user
 
        
 

	
 
        :param repo_name:
 
        """
 

	
 
@@ -317,7 +317,7 @@ class ReposController(BaseController):
 
    def delete_perm_users_group(self, repo_name):
 
        """
 
        DELETE an existing repository permission users group
 
        
 

	
 
        :param repo_name:
 
        """
 
        try:
 
@@ -333,7 +333,7 @@ class ReposController(BaseController):
 
    def repo_stats(self, repo_name):
 
        """
 
        DELETE an existing repository statistics
 
        
 

	
 
        :param repo_name:
 
        """
 

	
 
@@ -349,7 +349,7 @@ class ReposController(BaseController):
 
    def repo_cache(self, repo_name):
 
        """
 
        INVALIDATE existing repository cache
 
        
 

	
 
        :param repo_name:
 
        """
 

	
 
@@ -365,7 +365,7 @@ class ReposController(BaseController):
 
        """
 
        Set's this repository to be visible in public journal,
 
        in other words assing default user to follow this repo
 
        
 

	
 
        :param repo_name:
 
        """
 

	
 
@@ -392,7 +392,7 @@ class ReposController(BaseController):
 
        """
 
        Runs task to update given repository with remote changes,
 
        ie. make pull on remote location
 
        
 

	
 
        :param repo_name:
 
        """
 
        try:
rhodecode/controllers/admin/settings.py
Show inline comments
 
@@ -2,24 +2,24 @@
 
"""
 
    rhodecode.controllers.admin.settings
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
    
 

	
 
    settings controller for rhodecode admin
 
        
 

	
 
    :created_on: Jul 14, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -56,7 +56,7 @@ class SettingsController(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('setting', 'settings', controller='admin/settings', 
 
    #     map.resource('setting', 'settings', controller='admin/settings',
 
    #         path_prefix='/admin', name_prefix='admin_')
 

	
 

	
 
@@ -251,7 +251,7 @@ class SettingsController(BaseController)
 
    @NotAnonymous()
 
    def my_account(self):
 
        """
 
        GET /_admin/my_account Displays info about my account 
 
        GET /_admin/my_account Displays info about my account
 
        """
 
        # url('admin_settings_my_account')
 

	
rhodecode/controllers/admin/users.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Users crud controller for pylons
 
    
 

	
 
    :created_on: Apr 4, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/controllers/admin/users_groups.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Users Groups crud controller for pylons
 
    
 

	
 
    :created_on: Jan 25, 2011
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/controllers/branches.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    branches controller for rhodecode
 
    
 

	
 
    :created_on: Apr 21, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/controllers/changelog.py
Show inline comments
 
@@ -7,19 +7,19 @@
 

	
 
    :created_on: Apr 21, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -80,7 +80,7 @@ class ChangelogController(BaseRepoContro
 
    def _graph(self, repo, repo_size, size, p):
 
        """
 
        Generates a DAG graph for mercurial
 
        
 

	
 
        :param repo: repo instance
 
        :param size: number of commits to show
 
        :param p: page number
 
@@ -103,4 +103,3 @@ class ChangelogController(BaseRepoContro
 
            data.append(('', vtx, edges))
 

	
 
        c.jsdata = json.dumps(data)
 

	
rhodecode/controllers/changeset.py
Show inline comments
 
@@ -3,24 +3,24 @@
 
    rhodecode.controllers.changeset
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    changeset controller for pylons showoing changes beetween 
 
    changeset controller for pylons showoing changes beetween
 
    revisions
 
    
 

	
 
    :created_on: Apr 25, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -150,7 +150,7 @@ class ChangesetController(BaseRepoContro
 
                    c.changes[changeset.raw_id].append(('changed', node, diff, cs1, cs2))
 

	
 
            #==================================================================
 
            # REMOVED FILES    
 
            # REMOVED FILES
 
            #==================================================================
 
            if not c.cut_off:
 
                for node in changeset.removed:
rhodecode/controllers/error.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    RhodeCode error controller
 
    
 

	
 
    :created_on: Dec 8, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -107,5 +107,3 @@ class ErrorController(BaseController):
 
            return _('The resource could not be found')
 
        if code == 500:
 
            return _('The server encountered an unexpected condition which prevented it from fulfilling the request.')
 

	
 

	
rhodecode/controllers/feed.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Feed controller for rhodecode
 
    
 

	
 
    :created_on: Apr 23, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/controllers/files.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Files controller for RhodeCode
 
    
 

	
 
    :created_on: Apr 21, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -60,7 +60,7 @@ class FilesController(BaseRepoController
 
        """
 
        Safe way to get changeset if error occur it redirects to tip with
 
        proper message
 
        
 

	
 
        :param rev: revision to fetch
 
        :param repo_name: repo name to redirect after
 
        """
 
@@ -80,7 +80,7 @@ class FilesController(BaseRepoController
 
        """
 
        Returns file_node, if error occurs or given path is directory,
 
        it'll redirect to top level path
 
        
 

	
 
        :param repo_name: repo_name
 
        :param cs: given changeset
 
        :param path: path to lookup
 
@@ -301,4 +301,3 @@ class FilesController(BaseRepoController
 
        hist_l.append(tags_group)
 

	
 
        return hist_l
 

	
rhodecode/controllers/home.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Home controller for Rhodecode
 
    
 

	
 
    :created_on: Feb 18, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/controllers/journal.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Journal controller for pylons
 
    
 

	
 
    :created_on: Nov 21, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -238,11 +238,3 @@ class JournalController(BaseController):
 

	
 
        response.content_type = feed.mime_type
 
        return feed.writeString('utf-8')
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
rhodecode/controllers/login.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Login controller for rhodeocode
 
    
 

	
 
    :created_on: Apr 22, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/controllers/search.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Search controller for rhodecode
 
    
 

	
 
    :created_on: Aug 7, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/controllers/settings.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Settings controller for rhodecode
 
    
 

	
 
    :created_on: Jun 30, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/controllers/shortlog.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Shortlog controller for rhodecode
 
    
 

	
 
    :created_on: Apr 18, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/controllers/summary.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Summary controller for Rhodecode
 
    
 

	
 
    :created_on: Apr 18, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/controllers/tags.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Tags controller for rhodecode
 
    
 

	
 
    :created_on: Apr 21, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/lib/__init__.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Some simple helper functions
 
    
 

	
 
    :created_on: Jan 5, 2011
 
    :author: marcink
 
    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
 
    :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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -36,7 +36,7 @@ def str2bool(s):
 
def generate_api_key(username, salt=None):
 
    """
 
    Generates uniq API key for given username
 
    
 

	
 
    :param username: username as string
 
    :param salt: salt to hash generate KEY
 
    """
 
@@ -51,8 +51,8 @@ def generate_api_key(username, salt=None
 
def safe_unicode(_str):
 
    """
 
    safe unicode function. In case of UnicodeDecode error we try to return
 
    unicode with errors replace, if this fails we return unicode with 
 
    string_escape decoding 
 
    unicode with errors replace, if this fails we return unicode with
 
    string_escape decoding
 
    """
 

	
 
    if isinstance(_str, unicode):
rhodecode/lib/auth.py
Show inline comments
 
@@ -2,9 +2,9 @@
 
"""
 
    rhodecode.lib.auth
 
    ~~~~~~~~~~~~~~~~~~
 
    
 

	
 
    authentication and permission libraries
 
    
 

	
 
    :created_on: Apr 4, 2010
 
    :copyright: (c) 2010 by marcink.
 
    :license: LICENSE_NAME, see LICENSE_FILE for more details.
 
@@ -13,12 +13,12 @@
 
# modify it under the terms of the GNU General Public License
 
# as published by the Free Software Foundation; version 2
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -61,7 +61,7 @@ class PasswordGenerator(object):
 
        usage:
 
        passwd_gen = PasswordGenerator()
 
        #print 8-letter password containing only big and small letters of alphabet
 
        print passwd_gen.gen_password(8, passwd_gen.ALPHABETS_BIG_SMALL)        
 
        print passwd_gen.gen_password(8, passwd_gen.ALPHABETS_BIG_SMALL)
 
    """
 
    ALPHABETS_NUM = r'''1234567890'''#[0]
 
    ALPHABETS_SMALL = r'''qwertyuiopasdfghjklzxcvbnm'''#[1]
 
@@ -87,7 +87,7 @@ class RhodeCodeCrypto(object):
 
        """
 
        Cryptographic function used for password hashing based on pybcrypt
 
        or pycrypto in windows
 
        
 

	
 
        :param password: password to hash
 
        """
 
        if __platform__ in PLATFORM_WIN:
 
@@ -102,7 +102,7 @@ class RhodeCodeCrypto(object):
 
        """
 
        Checks matching password with it's hashed value, runs different
 
        implementation based on platform it runs on
 
        
 

	
 
        :param password: password
 
        :param hashed: password in hashed form
 
        """
 
@@ -129,7 +129,7 @@ def generate_api_key(username, salt=None
 

	
 
def authfunc(environ, username, password):
 
    """Dummy authentication function used in Mercurial/Git/ and access control,
 
    
 

	
 
    :param environ: needed only for using in Basic auth
 
    """
 
    return authenticate(username, password)
 
@@ -139,7 +139,7 @@ def authenticate(username, password):
 
    """Authentication function used for access control,
 
    firstly checks for db authentication then if ldap is enabled for ldap
 
    authentication, also creates ldap user if not in database
 
    
 

	
 
    :param username: username
 
    :param password: password
 
    """
 
@@ -174,7 +174,7 @@ def authenticate(username, password):
 
        ldap_settings = SettingsModel().get_ldap_settings()
 

	
 
        #======================================================================
 
        # FALLBACK TO LDAP AUTH IF ENABLE                
 
        # FALLBACK TO LDAP AUTH IF ENABLE
 
        #======================================================================
 
        if str2bool(ldap_settings.get('ldap_active')):
 
            log.debug("Authenticating user using ldap")
 
@@ -217,9 +217,9 @@ def authenticate(username, password):
 
class  AuthUser(object):
 
    """
 
    A simple object that handles all attributes of user in RhodeCode
 
    
 

	
 
    It does lookup based on API key,given user, or user present in session
 
    Then it fills all required information for such user. It also checks if 
 
    Then it fills all required information for such user. It also checks if
 
    anonymous access is enabled and if so, it returns default user as logged
 
    in
 
    """
 
@@ -278,12 +278,12 @@ class  AuthUser(object):
 

	
 
def set_available_permissions(config):
 
    """This function will propagate pylons globals with all available defined
 
    permission given in db. We don't want to check each time from db for new 
 
    permission given in db. We don't want to check each time from db for new
 
    permissions since adding a new permission also requires application restart
 
    ie. to decorate new views with the newly created permission
 
    
 

	
 
    :param config: current pylons config instance
 
    
 

	
 
    """
 
    log.info('getting information about all available permissions')
 
    try:
 
@@ -301,9 +301,9 @@ def set_available_permissions(config):
 
#===============================================================================
 
class LoginRequired(object):
 
    """
 
    Must be logged in to execute this function else 
 
    Must be logged in to execute this function else
 
    redirect to login page
 
    
 

	
 
    :param api_access: if enabled this checks only for valid auth token
 
        and grants access based on valid token
 
    """
 
@@ -345,7 +345,7 @@ class LoginRequired(object):
 
            return redirect(url('login_home', came_from=p))
 

	
 
class NotAnonymous(object):
 
    """Must be logged in to execute this function else 
 
    """Must be logged in to execute this function else
 
    redirect to login page"""
 

	
 
    def __call__(self, func):
 
@@ -414,7 +414,7 @@ class PermsDecorator(object):
 
        raise Exception('You have to write this function in child class')
 

	
 
class HasPermissionAllDecorator(PermsDecorator):
 
    """Checks for access permission for all given predicates. All of them 
 
    """Checks for access permission for all given predicates. All of them
 
    have to be meet in order to fulfill the request
 
    """
 

	
 
@@ -425,7 +425,7 @@ class HasPermissionAllDecorator(PermsDec
 

	
 

	
 
class HasPermissionAnyDecorator(PermsDecorator):
 
    """Checks for access permission for any of given predicates. In order to 
 
    """Checks for access permission for any of given predicates. In order to
 
    fulfill the request any of predicates must be meet
 
    """
 

	
 
@@ -435,7 +435,7 @@ class HasPermissionAnyDecorator(PermsDec
 
        return False
 

	
 
class HasRepoPermissionAllDecorator(PermsDecorator):
 
    """Checks for access permission for all given predicates for specific 
 
    """Checks for access permission for all given predicates for specific
 
    repository. All of them have to be meet in order to fulfill the request
 
    """
 

	
 
@@ -451,7 +451,7 @@ class HasRepoPermissionAllDecorator(Perm
 

	
 

	
 
class HasRepoPermissionAnyDecorator(PermsDecorator):
 
    """Checks for access permission for any of given predicates for specific 
 
    """Checks for access permission for any of given predicates for specific
 
    repository. In order to fulfill the request any of predicates must be meet
 
    """
 

	
rhodecode/lib/auth_ldap.py
Show inline comments
 
@@ -7,12 +7,12 @@
 
# modify it under the terms of the GNU General Public License
 
# as published by the Free Software Foundation; version 2
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -66,10 +66,10 @@ class AuthLdap(object):
 

	
 
    def authenticate_ldap(self, username, password):
 
        """Authenticate a user via LDAP and return his/her LDAP properties.
 
    
 

	
 
        Raises AuthenticationError if the credentials are rejected, or
 
        EnvironmentError if the LDAP server can't be reached.
 
        
 

	
 
        :param username: username
 
        :param password: password
 
        """
rhodecode/lib/backup_manager.py
Show inline comments
 
@@ -2,17 +2,17 @@
 
# encoding: utf-8
 
# mercurial repository backup manager
 
# Copyright (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
 
 
 

	
 
# 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -38,7 +38,7 @@ class BackupManager(object):
 
    def __init__(self, repos_location, rsa_key, backup_server):
 
        today = datetime.datetime.now().weekday() + 1
 
        self.backup_file_name = "mercurial_repos.%s.tar.gz" % today
 
        
 

	
 
        self.id_rsa_path = self.get_id_rsa(rsa_key)
 
        self.repos_path = self.get_repos_path(repos_location)
 
        self.backup_server = backup_server
 
@@ -54,7 +54,7 @@ class BackupManager(object):
 
            logging.error('Could not load id_rsa key file in %s', rsa_key)
 
            sys.exit()
 
        return rsa_key
 
    
 

	
 
    def get_repos_path(self, path):
 
        if not os.path.isdir(path):
 
            logging.error('Wrong location for repositories in %s', path)
 
@@ -86,23 +86,21 @@ class BackupManager(object):
 

	
 
        subprocess.call(cmd)
 
        logging.info('Transfered file %s to %s', self.backup_file_name, cmd[4])
 
        
 
    
 

	
 

	
 
    def rm_file(self):
 
        logging.info('Removing file %s', self.backup_file_name)
 
        os.remove(os.path.join(self.backup_file_path, self.backup_file_name))
 
    
 

	
 

	
 

	
 
if __name__ == "__main__":
 
    
 

	
 
    repo_location = '/home/repo_path'
 
    backup_server = 'root@192.168.1.100:/backups/mercurial'
 
    rsa_key = '/home/id_rsa'
 
    
 

	
 
    B_MANAGER = BackupManager(repo_location, rsa_key, backup_server)
 
    B_MANAGER.backup_repos()
 
    B_MANAGER.transfer_files()
 
    B_MANAGER.rm_file()
 

	
 

	
rhodecode/lib/base.py
Show inline comments
 
@@ -51,9 +51,9 @@ class BaseRepoController(BaseController)
 
    """
 
    Base class for controllers responsible for loading all needed data
 
    for those controllers, loaded items are
 
    
 

	
 
    c.rhodecode_repo: instance of scm repository (taken from cache)
 
     
 

	
 
    """
 

	
 
    def __before__(self):
rhodecode/lib/celerylib/__init__.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    celery libs for RhodeCode
 
    
 

	
 
    :created_on: Nov 27, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -97,11 +97,3 @@ def locked_task(func):
 
            return 'Task with key %s already running' % lockkey
 

	
 
    return decorator(__wrapper, func)
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
rhodecode/lib/celerylib/tasks.py
Show inline comments
 
@@ -5,22 +5,22 @@
 

	
 
    RhodeCode task modules, containing all task that suppose to be run
 
    by celery daemon
 
    
 

	
 
    :created_on: Oct 6, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -124,7 +124,7 @@ def get_commits_stats(repo_name, ts_min_
 
        return True
 

	
 
    if last_rev == repo.get_changeset().revision and len(repo.revisions) > 1:
 
        #pass silently without any work if we're not on first revision or 
 
        #pass silently without any work if we're not on first revision or
 
        #current state of parsing revision(from db marker) is the last revision
 
        return True
 

	
 
@@ -272,8 +272,8 @@ def reset_user_password(user_email):
 
def send_email(recipients, subject, body):
 
    """
 
    Sends an email with defined parameters from the .ini files.
 
    
 
    
 

	
 

	
 
    :param recipients: list of recipients, it this is empty the defined email
 
        address from field 'email_to' is used instead
 
    :param subject: subject of the mail
 
@@ -404,7 +404,3 @@ def __get_codes_stats(repo_name):
 
    map(aggregate, tip.walk('/'))
 

	
 
    return code_stats or {}
 

	
 

	
 

	
 

	
rhodecode/lib/colored_formatter.py
Show inline comments
 
@@ -3,7 +3,7 @@ import logging
 

	
 
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = xrange(30, 38)
 

	
 
# Sequences 
 
# Sequences
 
RESET_SEQ = "\033[0m"
 
COLOR_SEQ = "\033[1;%dm"
 
BOLD_SEQ = "\033[1m"
 
@@ -80,4 +80,3 @@ class ColorFormatterSql(logging.Formatte
 

	
 
        colored_record = start + def_record + end
 
        return colored_record
 

	
rhodecode/lib/db_manage.py
Show inline comments
 
@@ -5,22 +5,22 @@
 

	
 
    Database creation, and setup module for RhodeCode. Used for creation
 
    of database as well as for migration operations
 
    
 

	
 
    :created_on: Apr 10, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -95,9 +95,9 @@ class DbManage(object):
 

	
 

	
 
    def upgrade(self):
 
        """Upgrades given database schema to given revision following 
 
        """Upgrades given database schema to given revision following
 
        all needed steps, to perform the upgrade
 
        
 

	
 
        """
 

	
 
        from rhodecode.lib.dbmigrate.migrate.versioning import api
 
@@ -134,7 +134,7 @@ class DbManage(object):
 
        # UPGRADE STEPS
 
        #======================================================================
 
        class UpgradeSteps(object):
 
            """Those steps follow schema versions so for example schema 
 
            """Those steps follow schema versions so for example schema
 
            for example schema with seq 002 == step_2 and so on.
 
            """
 

	
 
@@ -261,7 +261,7 @@ class DbManage(object):
 
    def create_ui_settings(self):
 
        """Creates ui settings, fills out hooks
 
        and disables dotencode
 
        
 

	
 
        """
 
        #HOOKS
 
        hooks1_key = 'changegroup.update'
 
@@ -516,4 +516,3 @@ class DbManage(object):
 
        except:
 
            self.sa.rollback()
 
            raise
 

	
rhodecode/lib/dbmigrate/__init__.py
Show inline comments
 
@@ -2,24 +2,24 @@
 
"""
 
    rhodecode.lib.dbmigrate.__init__
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
    
 

	
 
    Database migration modules
 
    
 

	
 
    :created_on: Dec 11, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/lib/dbmigrate/migrate/changeset/ansisql.py
Show inline comments
 
@@ -59,7 +59,7 @@ class AlterTableVisitor(SchemaVisitor):
 
            # adapt to 0.6 which uses a string-returning
 
            # object
 
            self.append(" %s" % ret)
 
            
 

	
 
    def _to_table(self, param):
 
        """Returns the table object for the given param object."""
 
        if isinstance(param, (sa.Column, sa.Index, sa.schema.Constraint)):
 
@@ -297,10 +297,10 @@ else:
 

	
 
        def get_constraint_specification(self, cons, **kwargs):
 
            """Constaint SQL generators.
 
        
 

	
 
            We cannot use SA visitors because they append comma.
 
            """
 
        
 

	
 
            if isinstance(cons, PrimaryKeyConstraint):
 
                if cons.name is not None:
 
                    self.append("CONSTRAINT %s " % self.preparer.format_constraint(cons))
 
@@ -327,13 +327,13 @@ else:
 
                raise exceptions.InvalidConstraintError(cons)
 

	
 
        def _visit_constraint(self, constraint):
 
        
 

	
 
            table = self.start_alter_table(constraint)
 
            constraint.name = self.get_constraint_name(constraint)
 
            self.append("ADD ")
 
            self.get_constraint_specification(constraint)
 
            self.execute()
 
    
 

	
 

	
 
    class ANSIConstraintDropper(ANSIConstraintCommon, SchemaDropper):
 

	
rhodecode/lib/dbmigrate/migrate/changeset/databases/firebird.py
Show inline comments
 
@@ -34,7 +34,7 @@ class FBColumnDropper(ansisql.ANSIColumn
 
            if column.name in [col.name for col in index.columns]:
 
                index.drop()
 
                # TODO: recreate index if it references more than this column
 
        
 

	
 
        for cons in column.table.constraints:
 
            if isinstance(cons,PrimaryKeyConstraint):
 
                # will be deleted only when the column its on
rhodecode/lib/dbmigrate/migrate/changeset/databases/sqlite.py
Show inline comments
 
@@ -44,7 +44,7 @@ class SQLiteHelper(SQLiteCommon):
 
        self.execute()
 
        self.append('DROP TABLE migration_tmp')
 
        self.execute()
 
        
 

	
 
    def visit_column(self, delta):
 
        if isinstance(delta, DictMixin):
 
            column = delta.result_column
 
@@ -54,7 +54,7 @@ class SQLiteHelper(SQLiteCommon):
 
            table = self._to_table(column.table)
 
        self.recreate_table(table,column,delta)
 

	
 
class SQLiteColumnGenerator(SQLiteSchemaGenerator, 
 
class SQLiteColumnGenerator(SQLiteSchemaGenerator,
 
                            ansisql.ANSIColumnGenerator,
 
                            # at the end so we get the normal
 
                            # visit_column by default
 
@@ -80,7 +80,7 @@ class SQLiteColumnDropper(SQLiteHelper, 
 
    """SQLite ColumnDropper"""
 

	
 
    def _modify_table(self, table, column, delta):
 
        
 

	
 
        columns = ' ,'.join(map(self.preparer.format_column, table.columns))
 
        return 'INSERT INTO %(table_name)s SELECT ' + columns + \
 
            ' from migration_tmp'
rhodecode/lib/dbmigrate/migrate/changeset/schema.py
Show inline comments
 
@@ -31,7 +31,7 @@ __all__ = [
 

	
 
def create_column(column, table=None, *p, **kw):
 
    """Create a column, given the table.
 
    
 

	
 
    API to :meth:`ChangesetColumn.create`.
 
    """
 
    if table is not None:
 
@@ -41,7 +41,7 @@ def create_column(column, table=None, *p
 

	
 
def drop_column(column, table=None, *p, **kw):
 
    """Drop a column, given the table.
 
    
 

	
 
    API to :meth:`ChangesetColumn.drop`.
 
    """
 
    if table is not None:
 
@@ -105,12 +105,12 @@ def alter_column(*p, **k):
 
    :param engine:
 
      The :class:`~sqlalchemy.engine.base.Engine` to use for table
 
      reflection and schema alterations.
 
    
 

	
 
    :returns: A :class:`ColumnDelta` instance representing the change.
 

	
 
    
 

	
 
    """
 
    
 

	
 
    if 'table' not in k and isinstance(p[0], sqlalchemy.Column):
 
        k['table'] = p[0].table
 
    if 'engine' not in k:
 
@@ -129,7 +129,7 @@ def alter_column(*p, **k):
 
    # that this crutch has to be left in until they can be sorted
 
    # out
 
    k['alter_metadata']=True
 
    
 

	
 
    delta = ColumnDelta(*p, **k)
 

	
 
    visitorcallable = get_engine_visitor(engine, 'schemachanger')
 
@@ -183,10 +183,10 @@ class ColumnDelta(DictMixin, sqlalchemy.
 
        :param table: Table at which current Column should be bound to.\
 
        If table name is given, reflection will be used.
 
        :type table: string or Table instance
 
        
 

	
 
        :param metadata: A :class:`MetaData` instance to store
 
                         reflected table names
 
                         
 

	
 
        :param engine: When reflecting tables, either engine or metadata must \
 
        be specified to acquire engine object.
 
        :type engine: :class:`Engine` instance
 
@@ -211,7 +211,7 @@ class ColumnDelta(DictMixin, sqlalchemy.
 
        # as a crutch until the tests that fail when 'alter_metadata'
 
        # behaviour always happens can be sorted out
 
        self.alter_metadata = kw.pop("alter_metadata", False)
 
        
 

	
 
        self.meta = kw.pop("metadata", None)
 
        self.engine = kw.pop("engine", None)
 

	
 
@@ -239,7 +239,7 @@ class ColumnDelta(DictMixin, sqlalchemy.
 
            self.alter_metadata,
 
            super(ColumnDelta, self).__repr__()
 
            )
 
    
 

	
 
    def __getitem__(self, key):
 
        if key not in self.keys():
 
            raise KeyError("No such diff key, available: %s" % self.diffs )
 
@@ -278,7 +278,7 @@ class ColumnDelta(DictMixin, sqlalchemy.
 
        """Compares two Column objects"""
 
        self.process_column(new_col)
 
        self.table = k.pop('table', None)
 
        # we cannot use bool() on table in SA06 
 
        # we cannot use bool() on table in SA06
 
        if self.table is None:
 
            self.table = old_col.table
 
        if self.table is None:
 
@@ -367,7 +367,7 @@ class ColumnDelta(DictMixin, sqlalchemy.
 
                                            for_update=True))
 
        if toinit:
 
            column._init_items(*toinit)
 
            
 

	
 
        if not SQLA_06:
 
            column.args = []
 

	
 
@@ -484,7 +484,7 @@ class ChangesetColumn(object):
 

	
 
    def alter(self, *p, **k):
 
        """Makes a call to :func:`alter_column` for the column this
 
        method is called on. 
 
        method is called on.
 
        """
 
        if 'table' not in k:
 
            k['table'] = self.table
 
@@ -559,12 +559,12 @@ populated with defaults
 

	
 
    def _col_name_in_constraint(self,cons,name):
 
        return False
 
    
 

	
 
    def remove_from_table(self, table, unset_table=True):
 
        # TODO: remove primary keys, constraints, etc
 
        if unset_table:
 
            self.table = None
 
            
 

	
 
        to_drop = set()
 
        for index in table.indexes:
 
            columns = []
 
@@ -576,7 +576,7 @@ populated with defaults
 
            else:
 
                to_drop.add(index)
 
        table.indexes = table.indexes - to_drop
 
        
 

	
 
        to_drop = set()
 
        for cons in table.constraints:
 
            # TODO: deal with other types of constraint
 
@@ -588,7 +588,7 @@ populated with defaults
 
                    if self.name==col_name:
 
                        to_drop.add(cons)
 
        table.constraints = table.constraints - to_drop
 
        
 

	
 
        if table.c.contains_column(self):
 
            table.c.remove(self)
 

	
rhodecode/lib/dbmigrate/migrate/versioning/genmodel.py
Show inline comments
 
@@ -207,9 +207,9 @@ class ModelGenerator(object):
 
            dbTable = self.diff.metadataB.tables[tableName]
 

	
 
            td = self.diff.tables_different[tableName]
 
            
 

	
 
            if self._db_can_handle_this_change(td):
 
                
 

	
 
                for col in td.columns_missing_from_B:
 
                    modelTable.columns[col].create()
 
                for col in td.columns_missing_from_A:
rhodecode/lib/dbmigrate/migrate/versioning/repository.py
Show inline comments
 
@@ -218,7 +218,7 @@ class Repository(pathed.Pathed):
 
    @classmethod
 
    def create_manage_file(cls, file_, **opts):
 
        """Create a project management script (manage.py)
 
        
 

	
 
        :param file_: Destination file to be written
 
        :param opts: Options that are passed to :func:`migrate.versioning.shell.main`
 
        """
rhodecode/lib/dbmigrate/migrate/versioning/schema.py
Show inline comments
 
@@ -64,7 +64,7 @@ class ControlledSchema(object):
 

	
 
    def changeset(self, version=None):
 
        """API to Changeset creation.
 
        
 

	
 
        Uses self.version for start version and engine.name
 
        to get database name.
 
        """
rhodecode/lib/dbmigrate/migrate/versioning/schemadiff.py
Show inline comments
 
@@ -39,11 +39,11 @@ class ColDiff(object):
 
    Container for differences in one :class:`~sqlalchemy.schema.Column`
 
    between two :class:`~sqlalchemy.schema.Table` instances, ``A``
 
    and ``B``.
 
    
 

	
 
    .. attribute:: col_A
 

	
 
      The :class:`~sqlalchemy.schema.Column` object for A.
 
      
 

	
 
    .. attribute:: col_B
 

	
 
      The :class:`~sqlalchemy.schema.Column` object for B.
 
@@ -51,15 +51,15 @@ class ColDiff(object):
 
    .. attribute:: type_A
 

	
 
      The most generic type of the :class:`~sqlalchemy.schema.Column`
 
      object in A. 
 
      
 
      object in A.
 

	
 
    .. attribute:: type_B
 

	
 
      The most generic type of the :class:`~sqlalchemy.schema.Column`
 
      object in A. 
 
      
 
      object in A.
 

	
 
    """
 
    
 

	
 
    diff = False
 

	
 
    def __init__(self,col_A,col_B):
 
@@ -87,10 +87,10 @@ class ColDiff(object):
 
            if not (A is None or B is None) and A!=B:
 
                self.diff=True
 
                return
 
        
 

	
 
    def __nonzero__(self):
 
        return self.diff
 
    
 

	
 
class TableDiff(object):
 
    """
 
    Container for differences in one :class:`~sqlalchemy.schema.Table`
 
@@ -101,12 +101,12 @@ class TableDiff(object):
 

	
 
      A sequence of column names that were found in B but weren't in
 
      A.
 
      
 

	
 
    .. attribute:: columns_missing_from_B
 

	
 
      A sequence of column names that were found in A but weren't in
 
      B.
 
      
 

	
 
    .. attribute:: columns_different
 

	
 
      A dictionary containing information about columns that were
 
@@ -126,7 +126,7 @@ class TableDiff(object):
 
            self.columns_missing_from_B or
 
            self.columns_different
 
            )
 
    
 

	
 
class SchemaDiff(object):
 
    """
 
    Compute the difference between two :class:`~sqlalchemy.schema.MetaData`
 
@@ -139,34 +139,34 @@ class SchemaDiff(object):
 
    The length of a :class:`SchemaDiff` will give the number of
 
    changes found, enabling it to be used much like a boolean in
 
    expressions.
 
        
 

	
 
    :param metadataA:
 
      First :class:`~sqlalchemy.schema.MetaData` to compare.
 
      
 

	
 
    :param metadataB:
 
      Second :class:`~sqlalchemy.schema.MetaData` to compare.
 
      
 

	
 
    :param labelA:
 
      The label to use in messages about the first
 
      :class:`~sqlalchemy.schema.MetaData`. 
 
    
 
    :param labelB: 
 
      :class:`~sqlalchemy.schema.MetaData`.
 

	
 
    :param labelB:
 
      The label to use in messages about the second
 
      :class:`~sqlalchemy.schema.MetaData`. 
 
    
 
      :class:`~sqlalchemy.schema.MetaData`.
 

	
 
    :param excludeTables:
 
      A sequence of table names to exclude.
 
      
 

	
 
    .. attribute:: tables_missing_from_A
 

	
 
      A sequence of table names that were found in B but weren't in
 
      A.
 
      
 

	
 
    .. attribute:: tables_missing_from_B
 

	
 
      A sequence of table names that were found in A but weren't in
 
      B.
 
      
 

	
 
    .. attribute:: tables_different
 

	
 
      A dictionary containing information about tables that were found
 
@@ -195,26 +195,26 @@ class SchemaDiff(object):
 
        self.tables_missing_from_B = sorted(
 
            A_table_names - B_table_names - excludeTables
 
            )
 
        
 

	
 
        self.tables_different = {}
 
        for table_name in A_table_names.intersection(B_table_names):
 

	
 
            td = TableDiff()
 
            
 

	
 
            A_table = metadataA.tables[table_name]
 
            B_table = metadataB.tables[table_name]
 
            
 

	
 
            A_column_names = set(A_table.columns.keys())
 
            B_column_names = set(B_table.columns.keys())
 

	
 
            td.columns_missing_from_A = sorted(
 
                B_column_names - A_column_names
 
                )
 
            
 

	
 
            td.columns_missing_from_B = sorted(
 
                A_column_names - B_column_names
 
                )
 
            
 

	
 
            td.columns_different = {}
 

	
 
            for col_name in A_column_names.intersection(B_column_names):
 
@@ -226,7 +226,7 @@ class SchemaDiff(object):
 

	
 
                if cd:
 
                    td.columns_different[col_name]=cd
 
                
 

	
 
            # XXX - index and constraint differences should
 
            #       be checked for here
 

	
 
@@ -237,7 +237,7 @@ class SchemaDiff(object):
 
        ''' Summarize differences. '''
 
        out = []
 
        column_template ='      %%%is: %%r' % self.label_width
 
        
 

	
 
        for names,label in (
 
            (self.tables_missing_from_A,self.labelA),
 
            (self.tables_missing_from_B,self.labelB),
 
@@ -248,7 +248,7 @@ class SchemaDiff(object):
 
                        label,', '.join(sorted(names))
 
                        )
 
                    )
 
                
 

	
 
        for name,td in sorted(self.tables_different.items()):
 
            out.append(
 
               '  table with differences: %s' % name
 
@@ -267,7 +267,7 @@ class SchemaDiff(object):
 
                out.append('    column with differences: %s' % name)
 
                out.append(column_template % (self.labelA,cd.col_A))
 
                out.append(column_template % (self.labelB,cd.col_B))
 
                
 

	
 
        if out:
 
            out.insert(0, 'Schema diffs:')
 
            return '\n'.join(out)
rhodecode/lib/dbmigrate/migrate/versioning/script/base.py
Show inline comments
 
@@ -28,7 +28,7 @@ class BaseScript(pathed.Pathed):
 
        self.verify(path)
 
        super(BaseScript, self).__init__(path)
 
        log.debug('Script %s loaded successfully' % path)
 
    
 

	
 
    @classmethod
 
    def verify(cls, path):
 
        """Ensure this is a valid script
rhodecode/lib/dbmigrate/migrate/versioning/script/py.py
Show inline comments
 
@@ -25,7 +25,7 @@ class PythonScript(base.BaseScript):
 
    @classmethod
 
    def create(cls, path, **opts):
 
        """Create an empty migration script at specified path
 
        
 

	
 
        :returns: :class:`PythonScript instance <migrate.versioning.script.py.PythonScript>`"""
 
        cls.require_notfound(path)
 

	
 
@@ -38,7 +38,7 @@ class PythonScript(base.BaseScript):
 
    def make_update_script_for_model(cls, engine, oldmodel,
 
                                     model, repository, **opts):
 
        """Create a migration script based on difference between two SA models.
 
        
 

	
 
        :param repository: path to migrate repository
 
        :param oldmodel: dotted.module.name:SAClass or SAClass object
 
        :param model: dotted.module.name:SAClass or SAClass object
 
@@ -50,7 +50,7 @@ class PythonScript(base.BaseScript):
 
        :returns: Upgrade / Downgrade script
 
        :rtype: string
 
        """
 
        
 

	
 
        if isinstance(repository, basestring):
 
            # oh dear, an import cycle!
 
            from rhodecode.lib.dbmigrate.migrate.versioning.repository import Repository
 
@@ -86,7 +86,7 @@ class PythonScript(base.BaseScript):
 
    @classmethod
 
    def verify_module(cls, path):
 
        """Ensure path is a valid script
 
        
 

	
 
        :param path: Script location
 
        :type path: string
 
        :raises: :exc:`InvalidScriptError <migrate.exceptions.InvalidScriptError>`
 
@@ -101,7 +101,7 @@ class PythonScript(base.BaseScript):
 
        return module
 

	
 
    def preview_sql(self, url, step, **args):
 
        """Mocks SQLAlchemy Engine to store all executed calls in a string 
 
        """Mocks SQLAlchemy Engine to store all executed calls in a string
 
        and runs :meth:`PythonScript.run <migrate.versioning.script.py.PythonScript.run>`
 

	
 
        :returns: SQL file
 
@@ -119,7 +119,7 @@ class PythonScript(base.BaseScript):
 
        return go(url, step, **args)
 

	
 
    def run(self, engine, step):
 
        """Core method of Script file. 
 
        """Core method of Script file.
 
        Exectues :func:`update` or :func:`downgrade` functions
 

	
 
        :param engine: SQLAlchemy Engine
rhodecode/lib/dbmigrate/migrate/versioning/script/sql.py
Show inline comments
 
@@ -15,7 +15,7 @@ class SqlScript(base.BaseScript):
 
    @classmethod
 
    def create(cls, path, **opts):
 
        """Create an empty migration script at specified path
 
        
 

	
 
        :returns: :class:`SqlScript instance <migrate.versioning.script.sql.SqlScript>`"""
 
        cls.require_notfound(path)
 

	
rhodecode/lib/dbmigrate/migrate/versioning/template.py
Show inline comments
 
@@ -33,7 +33,7 @@ class SQLScriptCollection(Collection):
 

	
 
class Template(pathed.Pathed):
 
    """Finds the paths/packages of various Migrate templates.
 
    
 

	
 
    :param path: Templates are loaded from rhodecode.lib.dbmigrate.migrate package
 
    if `path` is not provided.
 
    """
 
@@ -66,7 +66,7 @@ class Template(pathed.Pathed):
 

	
 
    def _get_item(self, collection, theme=None):
 
        """Locates and returns collection.
 
        
 

	
 
        :param collection: name of collection to locate
 
        :param type_: type of subfolder in collection (defaults to "_default")
 
        :returns: (package, source)
 
@@ -80,7 +80,7 @@ class Template(pathed.Pathed):
 
    def get_repository(self, *a, **kw):
 
        """Calls self._get_item('repository', *a, **kw)"""
 
        return self._get_item('repository', *a, **kw)
 
    
 

	
 
    def get_script(self, *a, **kw):
 
        """Calls self._get_item('script', *a, **kw)"""
 
        return self._get_item('script', *a, **kw)
rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py
Show inline comments
 
@@ -22,7 +22,7 @@ def load_model(dotted_name):
 
    """Import module and use module-level variable".
 

	
 
    :param dotted_name: path to model in form of string: ``some.python.module:Class``
 
    
 

	
 
    .. versionchanged:: 0.5.4
 

	
 
    """
 
@@ -54,9 +54,9 @@ def asbool(obj):
 

	
 
def guess_obj_type(obj):
 
    """Do everything to guess object type from string
 
    
 

	
 
    Tries to convert to `int`, `bool` and finally returns if not succeded.
 
    
 

	
 
    .. versionadded: 0.5.4
 
    """
 

	
 
@@ -81,7 +81,7 @@ def guess_obj_type(obj):
 
@decorator
 
def catch_known_errors(f, *a, **kw):
 
    """Decorator that catches known api errors
 
    
 

	
 
    .. versionadded: 0.5.4
 
    """
 

	
rhodecode/lib/dbmigrate/migrate/versioning/util/importpath.py
Show inline comments
 
@@ -3,7 +3,7 @@ import sys
 

	
 
def import_path(fullpath):
 
    """ Import a file with full path specification. Allows one to
 
        import from anywhere, something __import__ does not do. 
 
        import from anywhere, something __import__ does not do.
 
    """
 
    # http://zephyrfalcon.org/weblog/arch_d7_2002_08_31.html
 
    path, filename = os.path.split(fullpath)
 
@@ -13,4 +13,3 @@ def import_path(fullpath):
 
    reload(module) # Might be out of date during tests
 
    del sys.path[-1]
 
    return module
 

	
rhodecode/lib/dbmigrate/migrate/versioning/util/keyedinstance.py
Show inline comments
 
@@ -4,7 +4,7 @@
 
class KeyedInstance(object):
 
    """A class whose instances have a unique identifier of some sort
 
    No two instances with the same unique ID should exist - if we try to create
 
    a second instance, the first should be returned. 
 
    a second instance, the first should be returned.
 
    """
 

	
 
    _instances = dict()
 
@@ -24,7 +24,7 @@ class KeyedInstance(object):
 
    @classmethod
 
    def _key(cls, *p, **k):
 
        """Given a unique identifier, return a dictionary key
 
        This should be overridden by child classes, to specify which parameters 
 
        This should be overridden by child classes, to specify which parameters
 
        should determine an object's uniqueness
 
        """
 
        raise NotImplementedError()
rhodecode/lib/dbmigrate/migrate/versioning/version.py
Show inline comments
 
@@ -59,7 +59,7 @@ class Collection(pathed.Pathed):
 
        and store them in self.versions
 
        """
 
        super(Collection, self).__init__(path)
 
        
 

	
 
        # Create temporary list of files, allowing skipped version numbers.
 
        files = os.listdir(path)
 
        if '1' in files:
 
@@ -104,7 +104,7 @@ class Collection(pathed.Pathed):
 

	
 
        script.PythonScript.create(filepath, **k)
 
        self.versions[ver] = Version(ver, self.path, [filename])
 
        
 

	
 
    def create_new_sql_version(self, database, **k):
 
        """Create SQL files for new version"""
 
        ver = self.latest + 1
 
@@ -116,7 +116,7 @@ class Collection(pathed.Pathed):
 
            filepath = self._version_path(filename)
 
            script.SqlScript.create(filepath, **k)
 
            self.versions[ver].add_script(filepath)
 
        
 

	
 
    def version(self, vernum=None):
 
        """Returns latest Version if vernum is not given.
 
        Otherwise, returns wanted version"""
 
@@ -135,7 +135,7 @@ class Collection(pathed.Pathed):
 

	
 
class Version(object):
 
    """A single version in a collection
 
    :param vernum: Version Number 
 
    :param vernum: Version Number
 
    :param path: Path to script files
 
    :param filelist: List of scripts
 
    :type vernum: int, VerNum
 
@@ -152,7 +152,7 @@ class Version(object):
 

	
 
        for script in filelist:
 
            self.add_script(os.path.join(path, script))
 
    
 

	
 
    def script(self, database=None, operation=None):
 
        """Returns SQL or Python Script"""
 
        for db in (database, 'default'):
rhodecode/lib/dbmigrate/versions/002_version_1_1_0.py
Show inline comments
 
@@ -13,7 +13,7 @@ from rhodecode.lib.dbmigrate.migrate.cha
 
log = logging.getLogger(__name__)
 

	
 
def upgrade(migrate_engine):
 
    """ Upgrade operations go here. 
 
    """ Upgrade operations go here.
 
    Don't create your own engine; bind migrate_engine to your metadata
 
    """
 

	
 
@@ -32,7 +32,7 @@ def upgrade(migrate_engine):
 

	
 
    #==========================================================================
 
    # Upgrade of `user_logs` table
 
    #==========================================================================    
 
    #==========================================================================
 

	
 
    tblname = 'users'
 
    tbl = Table(tblname, MetaData(bind=migrate_engine), autoload=True,
 
@@ -48,7 +48,7 @@ def upgrade(migrate_engine):
 

	
 
    #==========================================================================
 
    # Upgrade of `repositories` table
 
    #==========================================================================    
 
    #==========================================================================
 
    tblname = 'repositories'
 
    tbl = Table(tblname, MetaData(bind=migrate_engine), autoload=True,
 
                    autoload_with=migrate_engine)
 
@@ -84,7 +84,7 @@ def upgrade(migrate_engine):
 

	
 
        follows_user = relation('User', primaryjoin='User.user_id==UserFollowing.follows_user_id')
 
        follows_repository = relation('Repository')
 
        
 

	
 
    UserFollowing().__table__.create()
 

	
 
    #==========================================================================
 
@@ -113,5 +113,3 @@ def upgrade(migrate_engine):
 
def downgrade(migrate_engine):
 
    meta = MetaData()
 
    meta.bind = migrate_engine
 

	
 

	
rhodecode/lib/dbmigrate/versions/003_version_1_2_0.py
Show inline comments
 
@@ -15,7 +15,7 @@ from rhodecode.model.db import BaseModel
 
log = logging.getLogger(__name__)
 

	
 
def upgrade(migrate_engine):
 
    """ Upgrade operations go here. 
 
    """ Upgrade operations go here.
 
    Don't create your own engine; bind migrate_engine to your metadata
 
    """
 

	
 
@@ -69,7 +69,7 @@ def upgrade(migrate_engine):
 

	
 
    #==========================================================================
 
    # Upgrade of `repositories` table
 
    #==========================================================================    
 
    #==========================================================================
 
    from rhodecode.model.db import Repository
 

	
 
    #ADD downloads column#
 
@@ -96,5 +96,3 @@ def upgrade(migrate_engine):
 
def downgrade(migrate_engine):
 
    meta = MetaData()
 
    meta.bind = migrate_engine
 

	
 

	
rhodecode/lib/dbmigrate/versions/__init__.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Package containing new versions of database models
 
    
 

	
 
    :created_on: Dec 11, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/lib/exceptions.py
Show inline comments
 
@@ -7,12 +7,12 @@
 
# modify it under the terms of the GNU General Public License
 
# as published by the Free Software Foundation; version 2
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/lib/helpers.py
Show inline comments
 
@@ -69,7 +69,7 @@ def get_token():
 
class _GetError(object):
 
    """Get error from form_errors, and represent it as span wrapped error
 
    message
 
    
 

	
 
    :param field_name: field to fetch errors for
 
    :param form_errors: form errors dict
 
    """
 
@@ -84,9 +84,9 @@ get_error = _GetError()
 
class _ToolTip(object):
 

	
 
    def __call__(self, tooltip_title, trim_at=50):
 
        """Special function just to wrap our text into nice formatted 
 
        """Special function just to wrap our text into nice formatted
 
        autowrapped text
 
        
 

	
 
        :param tooltip_title:
 
        """
 

	
 
@@ -94,7 +94,7 @@ class _ToolTip(object):
 
                       .replace('\n', '<br/>')
 

	
 
    def activate(self):
 
        """Adds tooltip mechanism to the given Html all tooltips have to have 
 
        """Adds tooltip mechanism to the given Html all tooltips have to have
 
        set class `tooltip` and set attribute `tooltip_title`.
 
        Then a tooltip will be generated based on that. All with yui js tooltip
 
        """
 
@@ -104,18 +104,18 @@ class _ToolTip(object):
 
            function toolTipsId(){
 
                var ids = [];
 
                var tts = YAHOO.util.Dom.getElementsByClassName('tooltip');
 
                
 

	
 
                for (var i = 0; i < tts.length; i++) {
 
                    //if element doesn't not have and id autogenerate one for tooltip
 
                    
 

	
 
                    if (!tts[i].id){
 
                        tts[i].id='tt'+i*100;
 
                    }
 
                    ids.push(tts[i].id);
 
                }
 
                return ids        
 
                return ids
 
            };
 
            var myToolTips = new YAHOO.widget.Tooltip("tooltip", { 
 
            var myToolTips = new YAHOO.widget.Tooltip("tooltip", {
 
                context: [[toolTipsId()],"tl","bl",null,[0,5]],
 
                monitorresize:false,
 
                xyoffset :[0,0],
 
@@ -123,7 +123,7 @@ class _ToolTip(object):
 
                hidedelay:5,
 
                showdelay:20,
 
            });
 
            
 

	
 
        });
 
        '''
 
        return literal(js)
 
@@ -228,7 +228,7 @@ class CodeHtmlFormatter(HtmlFormatter):
 

	
 
def pygmentize(filenode, **kwargs):
 
    """pygmentize function using pygments
 
    
 

	
 
    :param filenode:
 
    """
 

	
 
@@ -237,15 +237,15 @@ def pygmentize(filenode, **kwargs):
 

	
 
def pygmentize_annotation(repo_name, filenode, **kwargs):
 
    """pygmentize function for annotation
 
    
 

	
 
    :param filenode:
 
    """
 

	
 
    color_dict = {}
 
    def gen_color(n=10000):
 
        """generator for getting n of evenly distributed colors using 
 
        """generator for getting n of evenly distributed colors using
 
        hsv color and golden ratio. It always return same order of colors
 
        
 

	
 
        :returns: RGB tuple
 
        """
 
        import colorsys
 
@@ -356,7 +356,7 @@ short_id = lambda x: x[:12]
 
def bool2icon(value):
 
    """Returns True/False values represented as small html image of true/false
 
    icons
 
    
 

	
 
    :param value: bool value
 
    """
 

	
 
@@ -374,7 +374,7 @@ def bool2icon(value):
 
def action_parser(user_log, feed=False):
 
    """This helper will action_map the specified string action into translated
 
    fancy names with icons and links
 
    
 

	
 
    :param user_log: user log instance
 
    :param feed: use output for feeds (no html and fancy icons)
 
    """
 
@@ -638,5 +638,3 @@ def repo_link(groups_and_repos):
 
            return link_to(group.group_name, url('repos_group', id=group.group_id))
 
        return literal(' &raquo; '.join(map(make_link, groups)) + \
 
                       " &raquo; " + repo_name)
 

	
 

	
rhodecode/lib/hooks.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~
 

	
 
    Hooks runned by rhodecode
 
    
 

	
 
    :created_on: Aug 6, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -36,7 +36,7 @@ from rhodecode.lib.utils import action_l
 

	
 
def repo_size(ui, repo, hooktype=None, **kwargs):
 
    """Presents size of repository after push
 
    
 

	
 
    :param ui:
 
    :param repo:
 
    :param hooktype:
 
@@ -67,7 +67,7 @@ def repo_size(ui, repo, hooktype=None, *
 

	
 
def log_pull_action(ui, repo, **kwargs):
 
    """Logs user last pull action
 
    
 

	
 
    :param ui:
 
    :param repo:
 
    """
 
@@ -83,7 +83,7 @@ def log_pull_action(ui, repo, **kwargs):
 

	
 
def log_push_action(ui, repo, **kwargs):
 
    """Maps user last push action to new changeset id, from mercurial
 
    
 

	
 
    :param ui:
 
    :param repo:
 
    """
 
@@ -113,4 +113,3 @@ def log_push_action(ui, repo, **kwargs):
 
    action_logger(username, action, repository, extra_params['ip'])
 

	
 
    return 0
 

	
rhodecode/lib/indexers/__init__.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Whoosh indexing module for RhodeCode
 
    
 

	
 
    :created_on: Aug 17, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
 
    :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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/lib/middleware/https_fixup.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    middleware to handle https correctly
 
    
 

	
 
    :created_on: May 23, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -39,7 +39,7 @@ class HttpsFixup(object):
 

	
 
    def __fixup(self, environ):
 
        """Function to fixup the environ as needed. In order to use this
 
        middleware you should set this header inside your 
 
        middleware you should set this header inside your
 
        proxy ie. nginx, apache etc.
 
        """
 
        proto = environ.get('HTTP_X_URL_SCHEME')
rhodecode/lib/middleware/simplegit.py
Show inline comments
 
@@ -4,23 +4,23 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    SimpleGit middleware for handling git protocol request (push/clone etc.)
 
    It's implemented with basic auth function    
 
    
 
    It's implemented with basic auth function
 

	
 
    :created_on: Apr 28, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
 
    :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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -78,9 +78,9 @@ from webob.exc import HTTPNotFound, HTTP
 
log = logging.getLogger(__name__)
 

	
 
def is_git(environ):
 
    """Returns True if request's target is git server. 
 
    """Returns True if request's target is git server.
 
    ``HTTP_USER_AGENT`` would then have git client version given.
 
    
 

	
 
    :param environ:
 
    """
 
    http_user_agent = environ.get('HTTP_USER_AGENT')
 
@@ -93,7 +93,7 @@ class SimpleGit(object):
 
    def __init__(self, application, config):
 
        self.application = application
 
        self.config = config
 
        #authenticate this git request using 
 
        #authenticate this git request using
 
        self.authenticate = AuthBasicAuthenticator('', authfunc)
 
        self.ipaddr = '0.0.0.0'
 
        self.repository = None
 
@@ -117,7 +117,7 @@ class SimpleGit(object):
 
        try:
 
            #==================================================================
 
            # GET REPOSITORY NAME
 
            #==================================================================            
 
            #==================================================================
 
            self.repo_name = self.__get_repository(environ)
 
        except:
 
            return HTTPInternalServerError()(environ, start_response)
 
@@ -139,7 +139,7 @@ class SimpleGit(object):
 
                    log.debug('Anonymous access is disabled, running '
 
                              'authentication')
 
                #==============================================================
 
                # DEFAULT PERM FAILED OR ANONYMOUS ACCESS IS DISABLED SO WE 
 
                # DEFAULT PERM FAILED OR ANONYMOUS ACCESS IS DISABLED SO WE
 
                # NEED TO AUTHENTICATE AND ASK FOR AUTH USER PERMISSIONS
 
                #==============================================================
 

	
 
@@ -211,7 +211,7 @@ class SimpleGit(object):
 
    def __check_permission(self, action, user, repo_name):
 
        """Checks permissions using action (push/pull) user and repository
 
        name
 
        
 

	
 
        :param action: push or pull action
 
        :param user: user instance
 
        :param repo_name: repository name
 
@@ -235,7 +235,7 @@ class SimpleGit(object):
 

	
 
    def __get_repository(self, environ):
 
        """Get's repository name out of PATH_INFO header
 
        
 

	
 
        :param environ: environ where PATH_INFO is stored
 
        """
 
        try:
 
@@ -254,7 +254,7 @@ class SimpleGit(object):
 

	
 
    def __get_action(self, environ):
 
        """Maps git request commands into a pull or push command.
 
        
 

	
 
        :param environ:
 
        """
 
        service = environ['QUERY_STRING'].split('=')
rhodecode/lib/middleware/simplehg.py
Show inline comments
 
@@ -3,24 +3,24 @@
 
    rhodecode.lib.middleware.simplehg
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    SimpleHG middleware for handling mercurial protocol request 
 
    SimpleHG middleware for handling mercurial protocol request
 
    (push/clone etc.). It's implemented with basic auth function
 
    
 

	
 
    :created_on: Apr 28, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
 
    :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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -84,7 +84,7 @@ class SimpleHg(object):
 
        try:
 
            #==================================================================
 
            # GET REPOSITORY NAME
 
            #==================================================================            
 
            #==================================================================
 
            self.repo_name = self.__get_repository(environ)
 
        except:
 
            return HTTPInternalServerError()(environ, start_response)
 
@@ -106,7 +106,7 @@ class SimpleHg(object):
 
                    log.debug('Anonymous access is disabled, running '
 
                              'authentication')
 
                #==============================================================
 
                # DEFAULT PERM FAILED OR ANONYMOUS ACCESS IS DISABLED SO WE 
 
                # DEFAULT PERM FAILED OR ANONYMOUS ACCESS IS DISABLED SO WE
 
                # NEED TO AUTHENTICATE AND ASK FOR AUTH USER PERMISSIONS
 
                #==============================================================
 

	
 
@@ -183,7 +183,7 @@ class SimpleHg(object):
 
    def __check_permission(self, action, user, repo_name):
 
        """Checks permissions using action (push/pull) user and repository
 
        name
 
        
 

	
 
        :param action: push or pull action
 
        :param user: user instance
 
        :param repo_name: repository name
 
@@ -207,7 +207,7 @@ class SimpleHg(object):
 

	
 
    def __get_repository(self, environ):
 
        """Get's repository name out of PATH_INFO header
 
        
 

	
 
        :param environ: environ where PATH_INFO is stored
 
        """
 
        try:
 
@@ -226,7 +226,7 @@ class SimpleHg(object):
 
    def __get_action(self, environ):
 
        """Maps mercurial request commands into a clone,pull or push command.
 
        This should always return a valid command string
 
        
 

	
 
        :param environ:
 
        """
 
        mapping = {'changegroup': 'pull',
rhodecode/lib/profiler.py
Show inline comments
 
@@ -12,8 +12,8 @@ class ProfilingMiddleware(object):
 
    def __init__(self, app):
 
        self.lock = threading.Lock()
 
        self.app = app
 
    
 
    
 

	
 

	
 
    def __call__(self, environ, start_response):
 
        with self.lock:
 
            profiler = cProfile.Profile()
 
@@ -41,13 +41,11 @@ class ProfilingMiddleware(object):
 
                ##  Browsers don't mind this.
 
                resp += '<pre style="text-align:left; border-top: 4px dashed red; padding: 1em;">'
 
                resp += cgi.escape(out.getvalue(), True)
 
                
 

	
 
                output = StringIO()
 
                pprint.pprint(environ, output, depth=3)
 
                
 

	
 
                resp += cgi.escape(output.getvalue(), True)
 
                resp += '</pre>'
 
                
 

	
 
            return resp
 
    
 

	
rhodecode/lib/smtp_mailer.py
Show inline comments
 
@@ -2,9 +2,9 @@
 
"""
 
    rhodecode.lib.smtp_mailer
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~
 
    
 

	
 
    Simple smtp mailer used in RhodeCode
 
    
 

	
 
    :created_on: Sep 13, 2010
 
    :copyright: (c) 2011 by marcink.
 
    :license: LICENSE_NAME, see LICENSE_FILE for more details.
 
@@ -25,14 +25,14 @@ from email import encoders
 

	
 
class SmtpMailer(object):
 
    """SMTP mailer class
 
    
 

	
 
    mailer = SmtpMailer(mail_from, user, passwd, mail_server, mail_port, ssl, tls)
 
    mailer.send(recipients, subject, body, attachment_files)    
 
    
 
    mailer.send(recipients, subject, body, attachment_files)
 

	
 
    :param recipients might be a list of string or single string
 
    :param attachment_files is a dict of {filename:location} 
 
        it tries to guess the mimetype and attach the file 
 
    
 
    :param attachment_files is a dict of {filename:location}
 
        it tries to guess the mimetype and attach the file
 

	
 
    """
 

	
 
    def __init__(self, mail_from, user, passwd, mail_server,
 
@@ -132,7 +132,7 @@ class SmtpMailer(object):
 
    def get_content(self, msg_file):
 
        """Get content based on type, if content is a string do open first
 
        else just read because it's a probably open file object
 
        
 

	
 
        :param msg_file:
 
        """
 
        if isinstance(msg_file, str):
rhodecode/lib/utils.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~
 

	
 
    Utilities library for RhodeCode
 
    
 

	
 
    :created_on: Apr 18, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -55,10 +55,10 @@ log = logging.getLogger(__name__)
 

	
 
def recursive_replace(str, replace=' '):
 
    """Recursive replace of given sign to just one instance
 
    
 

	
 
    :param str: given string
 
    :param replace: char to find and replace multiple instances
 
        
 

	
 
    Examples::
 
    >>> recursive_replace("Mighty---Mighty-Bo--sstones",'-')
 
    'Mighty-Mighty-Bo-sstones'
 
@@ -91,7 +91,7 @@ def get_repo_slug(request):
 
def action_logger(user, action, repo, ipaddr='', sa=None):
 
    """
 
    Action logger for various actions made by users
 
    
 

	
 
    :param user: user that made this action, can be a unique username string or
 
        object containing user_id attribute
 
    :param action: action to log, should be on of predefined unique actions for
 
@@ -100,7 +100,7 @@ def action_logger(user, action, repo, ip
 
        that action was made on
 
    :param ipaddr: optional ip address from what the action was made
 
    :param sa: optional sqlalchemy session
 
    
 

	
 
    """
 

	
 
    if not sa:
 
@@ -146,10 +146,10 @@ def action_logger(user, action, repo, ip
 

	
 
def get_repos(path, recursive=False):
 
    """
 
    Scans given path for repos and return (name,(type,path)) tuple 
 
    
 
    Scans given path for repos and return (name,(type,path)) tuple
 

	
 
    :param path: path to scann for repositories
 
    :param recursive: recursive search and return names with subdirs in front 
 
    :param recursive: recursive search and return names with subdirs in front
 
    """
 
    from vcs.utils.helpers import get_scm
 
    from vcs.exceptions import VCSError
 
@@ -182,7 +182,7 @@ def check_repo_fast(repo_name, base_path
 
    Check given path for existence of directory
 
    :param repo_name:
 
    :param base_path:
 
    
 

	
 
    :return False: if this directory is present
 
    """
 
    if os.path.isdir(os.path.join(base_path, repo_name)):return False
 
@@ -230,7 +230,7 @@ ui_sections = ['alias', 'auth',
 
def make_ui(read_from='file', path=None, checkpaths=True):
 
    """A function that will read python rc files or database
 
    and make an mercurial ui object from read options
 
    
 

	
 
    :param path: path to mercurial config file
 
    :param checkpaths: check the path
 
    :param read_from: read from 'file' or 'db'
 
@@ -275,7 +275,7 @@ def make_ui(read_from='file', path=None,
 

	
 
def set_rhodecode_config(config):
 
    """Updates pylons config with new settings from database
 
    
 

	
 
    :param config:
 
    """
 
    from rhodecode.model.settings import SettingsModel
 
@@ -285,7 +285,7 @@ def set_rhodecode_config(config):
 
        config[k] = v
 

	
 
def invalidate_cache(cache_key, *args):
 
    """Puts cache invalidation task into db for 
 
    """Puts cache invalidation task into db for
 
    further global cache invalidation
 
    """
 

	
 
@@ -332,7 +332,7 @@ class EmptyChangeset(BaseChangeset):
 
def map_groups(groups):
 
    """Checks for groups existence, and creates groups structures.
 
    It returns last group in structure
 
    
 

	
 
    :param groups: list of groups structure
 
    """
 
    sa = meta.Session()
 
@@ -355,7 +355,7 @@ def repo2db_mapper(initial_repo_list, re
 
    """maps all repos given in initial_repo_list, non existing repositories
 
    are created, if remove_obsolete is True it also check for db entries
 
    that are not in initial_repo_list and removes them.
 
    
 

	
 
    :param initial_repo_list: list of repositories found by scanning methods
 
    :param remove_obsolete: check for obsolete entries in database
 
    """
 
@@ -562,7 +562,7 @@ def create_test_index(repo_location, ful
 
        pass
 

	
 
def create_test_env(repos_test_path, config):
 
    """Makes a fresh database and 
 
    """Makes a fresh database and
 
    install test repository into tmp dir
 
    """
 
    from rhodecode.lib.db_manage import DbManage
 
@@ -641,10 +641,10 @@ class BasePasterCommand(Command):
 
    def notify_msg(self, msg, log=False):
 
        """Make a notification to user, additionally if logger is passed
 
        it logs this action using given logger
 
        
 

	
 
        :param msg: message that will be printed to user
 
        :param log: logging instance, to use to additionally log this message
 
        
 

	
 
        """
 
        if log and isinstance(log, logging):
 
            log(msg)
 
@@ -653,7 +653,7 @@ class BasePasterCommand(Command):
 
    def run(self, args):
 
        """
 
        Overrides Command.run
 
        
 

	
 
        Checks for a config file argument and loads it.
 
        """
 
        if len(args) < self.min_args:
rhodecode/model/__init__.py
Show inline comments
 
@@ -2,42 +2,42 @@
 
"""
 
    rhodecode.model.__init__
 
    ~~~~~~~~~~~~~~~~~~~~~~~~
 
    
 

	
 
    The application's model objects
 
    
 

	
 
    :created_on: Nov 25, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
    
 
    
 

	
 

	
 
    :example:
 
    
 

	
 
        .. code-block:: python
 
    
 

	
 
           from paste.deploy import appconfig
 
           from pylons import config
 
           from sqlalchemy import engine_from_config
 
           from rhodecode.config.environment import load_environment
 
           
 

	
 
           conf = appconfig('config:development.ini', relative_to = './../../')
 
           load_environment(conf.global_conf, conf.local_conf)
 
           
 

	
 
           engine = engine_from_config(config, 'sqlalchemy.')
 
           init_model(engine)
 
           # RUN YOUR CODE HERE
 
    
 

	
 
"""
 
# 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -53,7 +53,7 @@ def init_model(engine):
 
    """Initializes db session, bind the engine with the metadata,
 
    Call this before using any of the tables or classes in the model, preferably
 
    once in application start
 
    
 

	
 
    :param engine: engine to bind to
 
    """
 
    log.info("initializing db for %s", engine)
 
@@ -62,7 +62,7 @@ def init_model(engine):
 
class BaseModel(object):
 
    """Base Model for all RhodeCode models, it adds sql alchemy session
 
    into instance of model
 
    
 

	
 
    :param sa: If passed it reuses this session instead of creating a new one
 
    """
 

	
rhodecode/model/caching_query.py
Show inline comments
 
@@ -11,12 +11,12 @@ The three new concepts introduced here a
 
   parameters on a Query
 
 * RelationshipCache - a variant of FromCache which is specific
 
   to a query invoked during a lazy load.
 
 * _params_from_query - extracts value parameters from 
 
 * _params_from_query - extracts value parameters from
 
   a Query.
 

	
 
The rest of what's here are standard SQLAlchemy and
 
Beaker constructs.
 
   
 

	
 
"""
 
from beaker.exceptions import BeakerException
 
from sqlalchemy.orm.interfaces import MapperOption
 
@@ -25,30 +25,30 @@ from sqlalchemy.sql import visitors
 
import beaker
 

	
 
class CachingQuery(Query):
 
    """A Query subclass which optionally loads full results from a Beaker 
 
    """A Query subclass which optionally loads full results from a Beaker
 
    cache region.
 
    
 

	
 
    The CachingQuery stores additional state that allows it to consult
 
    a Beaker cache before accessing the database:
 
    
 
    * A "region", which is a cache region argument passed to a 
 

	
 
    * A "region", which is a cache region argument passed to a
 
      Beaker CacheManager, specifies a particular cache configuration
 
      (including backend implementation, expiration times, etc.)
 
    * A "namespace", which is a qualifying name that identifies a
 
      group of keys within the cache.  A query that filters on a name 
 
      might use the name "by_name", a query that filters on a date range 
 
      group of keys within the cache.  A query that filters on a name
 
      might use the name "by_name", a query that filters on a date range
 
      to a joined table might use the name "related_date_range".
 
      
 

	
 
    When the above state is present, a Beaker cache is retrieved.
 
    
 
    The "namespace" name is first concatenated with 
 
    a string composed of the individual entities and columns the Query 
 

	
 
    The "namespace" name is first concatenated with
 
    a string composed of the individual entities and columns the Query
 
    requests, i.e. such as ``Query(User.id, User.name)``.
 
    
 

	
 
    The Beaker cache is then loaded from the cache manager based
 
    on the region and composed namespace.  The key within the cache
 
    itself is then constructed against the bind parameters specified
 
    by this query, which are usually literals defined in the 
 
    by this query, which are usually literals defined in the
 
    WHERE clause.
 

	
 
    The FromCache and RelationshipCache mapper options below represent
 
@@ -63,7 +63,7 @@ class CachingQuery(Query):
 
    def __iter__(self):
 
        """override __iter__ to pull results from Beaker
 
           if particular attributes have been configured.
 
           
 

	
 
           Note that this approach does *not* detach the loaded objects from
 
           the current session. If the cache backend is an in-process cache
 
           (like "memory") and lives beyond the scope of the current session's
 
@@ -71,7 +71,7 @@ class CachingQuery(Query):
 
           modified to first expunge() each loaded item from the current
 
           session before returning the list of items, so that the items
 
           in the cache are not the same ones in the current Session.
 
           
 

	
 
        """
 
        if hasattr(self, '_cache_parameters'):
 
            return self.get_value(createfunc=lambda: list(Query.__iter__(self)))
 
@@ -143,7 +143,7 @@ def _get_cache_parameters(query):
 
    return cache, cache_key
 

	
 
def _namespace_from_query(namespace, query):
 
    # cache namespace - the token handed in by the 
 
    # cache namespace - the token handed in by the
 
    # option + class we're querying against
 
    namespace = " ".join([namespace] + [str(x) for x in query._entities])
 

	
 
@@ -169,18 +169,18 @@ class FromCache(MapperOption):
 

	
 
    def __init__(self, region, namespace, cache_key=None):
 
        """Construct a new FromCache.
 
        
 

	
 
        :param region: the cache region.  Should be a
 
        region configured in the Beaker CacheManager.
 
        
 

	
 
        :param namespace: the cache namespace.  Should
 
        be a name uniquely describing the target Query's
 
        lexical structure.
 
        
 
        :param cache_key: optional.  A string cache key 
 

	
 
        :param cache_key: optional.  A string cache key
 
        that will serve as the key to the query.   Use this
 
        if your query has a huge amount of parameters (such
 
        as when using in_()) which correspond more simply to 
 
        as when using in_()) which correspond more simply to
 
        some other identifier.
 

	
 
        """
 
@@ -194,25 +194,25 @@ class FromCache(MapperOption):
 
        _set_cache_parameters(query, self.region, self.namespace, self.cache_key)
 

	
 
class RelationshipCache(MapperOption):
 
    """Specifies that a Query as called within a "lazy load" 
 
    """Specifies that a Query as called within a "lazy load"
 
       should load results from a cache."""
 

	
 
    propagate_to_loaders = True
 

	
 
    def __init__(self, region, namespace, attribute):
 
        """Construct a new RelationshipCache.
 
        
 

	
 
        :param region: the cache region.  Should be a
 
        region configured in the Beaker CacheManager.
 
        
 

	
 
        :param namespace: the cache namespace.  Should
 
        be a name uniquely describing the target Query's
 
        lexical structure.
 
        
 

	
 
        :param attribute: A Class.attribute which
 
        indicates a particular class relationship() whose
 
        lazy loader should be pulled from the cache.
 
        
 

	
 
        """
 
        self.region = region
 
        self.namespace = namespace
 
@@ -241,11 +241,11 @@ class RelationshipCache(MapperOption):
 

	
 
    def and_(self, option):
 
        """Chain another RelationshipCache option to this one.
 
        
 

	
 
        While many RelationshipCache objects can be specified on a single
 
        Query separately, chaining them together allows for a more efficient
 
        lookup during load.
 
        
 

	
 
        """
 
        self._relationship_options.update(option._relationship_options)
 
        return self
 
@@ -253,12 +253,12 @@ class RelationshipCache(MapperOption):
 

	
 
def _params_from_query(query):
 
    """Pull the bind parameter values from a query.
 
    
 

	
 
    This takes into account any scalar attribute bindparam set up.
 
    
 

	
 
    E.g. params_from_query(query.filter(Cls.foo==5).filter(Cls.bar==7)))
 
    would return [5, 7].
 
    
 

	
 
    """
 
    v = []
 
    def visit_bindparam(bind):
rhodecode/model/db.py
Show inline comments
 
@@ -2,24 +2,24 @@
 
"""
 
    rhodecode.model.db
 
    ~~~~~~~~~~~~~~~~~~
 
    
 

	
 
    Database Models for RhodeCode
 
    
 

	
 
    :created_on: Apr 08, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -387,4 +387,3 @@ class DbMigrateVersion(Base):
 
    repository_id = Column('repository_id', String(250), primary_key=True)
 
    repository_path = Column('repository_path', Text)
 
    version = Column('version', Integer)
 

	
rhodecode/model/forms.py
Show inline comments
 
@@ -10,14 +10,14 @@ chained_validators      []     These val
 
allow_extra_fields      False     If True, then it is not an error when keys that aren't associated with a validator are present
 
filter_extra_fields     False     If True, then keys that aren't associated with a validator are removed
 
if_key_missing          NoDefault If this is given, then any keys that aren't available but are expected will be replaced with this value (and then validated). This does not override a present .if_missing attribute on validators. NoDefault is a special FormEncode class to mean that no default values has been specified and therefore missing keys shouldn't take a default value.
 
ignore_key_missing      False     If True, then missing keys will be missing in the result, if the validator doesn't have .if_missing on it already    
 
  
 
  
 
ignore_key_missing      False     If True, then missing keys will be missing in the result, if the validator doesn't have .if_missing on it already
 

	
 

	
 
<name> = formencode.validators.<name of validator>
 
<name> must equal form name
 
list=[1,2,3,4,5]
 
for SELECT use formencode.All(OneOf(list), Int())
 
    
 

	
 
"""
 
import os
 
import re
 
@@ -361,7 +361,7 @@ class AttrLoginValidator(formencode.vali
 
        return value
 

	
 
#===============================================================================
 
# FORMS        
 
# FORMS
 
#===============================================================================
 
class LoginForm(formencode.Schema):
 
    allow_extra_fields = True
rhodecode/model/meta.py
Show inline comments
 
@@ -21,7 +21,7 @@ Session = scoped_session(
 

	
 
class BaseModel(object):
 
    """Base Model for all classess
 
    
 

	
 
    """
 

	
 
    @classmethod
 
@@ -30,7 +30,7 @@ class BaseModel(object):
 
        return class_mapper(cls).c.keys()
 

	
 
    def get_dict(self):
 
        """return dict with keys and values corresponding 
 
        """return dict with keys and values corresponding
 
        to this model data """
 

	
 
        d = {}
 
@@ -39,7 +39,7 @@ class BaseModel(object):
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding 
 
        """return list with keys and values tupples corresponding
 
        to this model data """
 

	
 
        l = []
rhodecode/model/permission.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    permissions model for RhodeCode
 
    
 

	
 
    :created_on: Aug 20, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -43,7 +43,7 @@ class PermissionModel(BaseModel):
 

	
 
    def get_permission(self, permission_id, cache=False):
 
        """Get's permissions by id
 
        
 

	
 
        :param permission_id: id of permission to get from database
 
        :param cache: use Cache for this query
 
        """
 
@@ -55,7 +55,7 @@ class PermissionModel(BaseModel):
 

	
 
    def get_permission_by_name(self, name, cache=False):
 
        """Get's permissions by given name
 
        
 

	
 
        :param name: name to fetch
 
        :param cache: Use cache for this query
 
        """
 
@@ -76,7 +76,7 @@ class PermissionModel(BaseModel):
 
                            ' your database' % len(u2p))
 

	
 
        try:
 
            #stage 1 change defaults    
 
            #stage 1 change defaults
 
            for p in u2p:
 
                if p.permission.permission_name.startswith('repository.'):
 
                    p.permission = self.get_permission_by_name(
rhodecode/model/repo.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~
 

	
 
    Repository model for rhodecode
 
    
 

	
 
    :created_on: Jun 5, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -304,7 +304,7 @@ class RepoModel(BaseModel):
 
    def __create_repo(self, repo_name, alias, clone_uri=False):
 
        """
 
        makes repository on filesystem
 
        
 

	
 
        :param repo_name:
 
        :param alias:
 
        """
 
@@ -319,7 +319,7 @@ class RepoModel(BaseModel):
 
    def __rename_repo(self, old, new):
 
        """
 
        renames repository on filesystem
 
        
 

	
 
        :param old: old name
 
        :param new: new name
 
        """
 
@@ -338,7 +338,7 @@ class RepoModel(BaseModel):
 
        added rm__ prefix into dir, and rename internat .hg/.git dirs so this
 
        repository is no longer valid for rhodecode, can be undeleted later on
 
        by reverting the renames on this repository
 
        
 

	
 
        :param repo: repo object
 
        """
 
        rm_path = os.path.join(self.repos_path, repo.repo_name)
rhodecode/model/scm.py
Show inline comments
 
@@ -7,19 +7,19 @@
 

	
 
    :created_on: Apr 9, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -84,9 +84,9 @@ class ScmModel(BaseModel):
 
        return q.ui_value
 

	
 
    def repo_scan(self, repos_path=None):
 
        """Listing of repositories in given path. This path should not be a 
 
        """Listing of repositories in given path. This path should not be a
 
        repository itself. Return a dictionary of repository objects
 
        
 

	
 
        :param repos_path: path to directory containing repositories
 
        """
 

	
 
@@ -120,7 +120,7 @@ class ScmModel(BaseModel):
 
    def get_repos(self, all_repos=None):
 
        """Get all repos from db and for each repo create it's backend instance.
 
        and fill that backed with information from database
 
        
 

	
 
        :param all_repos: give specific repositories list, good for filtering
 
            this have to be a list of  just the repository names
 
        """
 
@@ -166,10 +166,10 @@ class ScmModel(BaseModel):
 
        """Returns a tuple of Repository,DbRepository,
 
        Get's repository from given name, creates BackendInstance and
 
        propagates it's data from database with all additional information
 
        
 

	
 
        :param repo_name:
 
        :param invalidation_list: if a invalidation list is given the get
 
            method should not manually check if this repository needs 
 
            method should not manually check if this repository needs
 
            invalidation and just invalidate the repositories in list
 
        :param retval: string specifing what to return one of 'repo','dbrepo',
 
            'all'if repo or dbrepo is given it'll just lazy load chosen type
 
@@ -234,9 +234,9 @@ class ScmModel(BaseModel):
 
        return r, dbr
 

	
 
    def mark_for_invalidation(self, repo_name):
 
        """Puts cache invalidation task into db for 
 
        """Puts cache invalidation task into db for
 
        further global cache invalidation
 
        
 

	
 
        :param repo_name: this repo that should invalidation take place
 
        """
 

	
 
@@ -367,7 +367,7 @@ class ScmModel(BaseModel):
 
                      'action':'push_remote',
 
                      'repository':repo_name}
 

	
 
            #inject ui extra param to log this action via push logger        
 
            #inject ui extra param to log this action via push logger
 
            for k, v in extras.items():
 
                repo._repo.ui.setconfig('rhodecode_extras', k, v)
 

	
 
@@ -383,7 +383,7 @@ class ScmModel(BaseModel):
 

	
 
    def _should_invalidate(self, repo_name):
 
        """Looks up database for invalidation signals for this repo_name
 
        
 

	
 
        :param repo_name:
 
        """
 

	
 
@@ -395,9 +395,9 @@ class ScmModel(BaseModel):
 
        return ret
 

	
 
    def _mark_invalidated(self, cache_key):
 
        """ Marks all occurrences of cache to invalidation as already 
 
        """ Marks all occurrences of cache to invalidation as already
 
        invalidated
 
        
 

	
 
        :param cache_key:
 
        """
 

	
 
@@ -410,4 +410,3 @@ class ScmModel(BaseModel):
 
        except (DatabaseError,):
 
            log.error(traceback.format_exc())
 
            self.sa.rollback()
 

	
rhodecode/model/settings.py
Show inline comments
 
@@ -7,19 +7,19 @@
 

	
 
    :created on Nov 17, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -47,8 +47,8 @@ class SettingsModel(BaseModel):
 
        return r
 

	
 
    def get_app_settings(self, cache=False):
 
        """Get's config from database, each config key is prefixed with 
 
        'rhodecode_' prefix, than global pylons config is updated with such 
 
        """Get's config from database, each config key is prefixed with
 
        'rhodecode_' prefix, than global pylons config is updated with such
 
        keys
 
        """
 

	
 
@@ -71,11 +71,11 @@ class SettingsModel(BaseModel):
 
        :returns:
 
        ldap_active
 
        ldap_host
 
        ldap_port 
 
        ldap_port
 
        ldap_ldaps
 
        ldap_tls_reqcert
 
        ldap_dn_user 
 
        ldap_dn_pass 
 
        ldap_dn_user
 
        ldap_dn_pass
 
        ldap_base_dn
 
        ldap_filter
 
        ldap_search_scope
rhodecode/model/user.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~
 

	
 
    users model for RhodeCode
 
    
 

	
 
    :created_on: Apr 9, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -223,9 +223,9 @@ class UserModel(BaseModel):
 
        """
 
        Fetches auth_user by user_id,or api_key if present.
 
        Fills auth_user attributes with those taken from database.
 
        Additionally set's is_authenitated if lookup fails 
 
        Additionally set's is_authenitated if lookup fails
 
        present in database
 
        
 

	
 
        :param auth_user: instance of user to set attributes
 
        :param user_id: user id to fetch by
 
        :param api_key: api key to fetch by
 
@@ -255,7 +255,7 @@ class UserModel(BaseModel):
 
        """Fills user permission attribute with permissions taken from database
 
        works for permissions given for repositories, and for permissions that
 
        as part of beeing group member
 
        
 

	
 
        :param user: user instance to fill his perms
 
        """
 

	
 
@@ -274,7 +274,7 @@ class UserModel(BaseModel):
 

	
 
        if user.is_admin:
 
            #=======================================================================
 
            # #admin have all default rights set to admin        
 
            # #admin have all default rights set to admin
 
            #=======================================================================
 
            user.permissions['global'].add('hg.admin')
 

	
 
@@ -325,7 +325,7 @@ class UserModel(BaseModel):
 

	
 

	
 
            #=======================================================================
 
            # check if user is part of groups for this repository and fill in 
 
            # check if user is part of groups for this repository and fill in
 
            # (or replace with higher) permissions
 
            #=======================================================================
 
            user_perms_from_users_groups = self.sa.query(UsersGroupToPerm, Permission, Repository,)\
rhodecode/model/users_group.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    users groups model for RhodeCode
 
    
 

	
 
    :created_on: Jan 25, 2011
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
rhodecode/tests/functional/test_files.py
Show inline comments
 
@@ -311,4 +311,3 @@ removed extra unicode conversion in diff
 
                                    f_path=f_path))
 

	
 
        assert "There is no file nor directory at the given path: %r at revision %r" % (f_path, rev[:12]) in response.session['flash'][0][1], 'No flash message'
 

	
rhodecode/tests/functional/test_login.py
Show inline comments
 
@@ -228,6 +228,3 @@ class TestLoginController(TestController
 
        print response.session['flash']
 
        assert 'You have successfully registered into rhodecode' in response.session['flash'][0], 'No flash message about user registration'
 
        assert 'Your new password was sent' in response.session['flash'][1], 'No flash message about password reset'
 

	
 

	
 

	
rhodecode/tests/functional/test_search.py
Show inline comments
 
@@ -33,4 +33,3 @@ class TestSearchController(TestControlle
 
        print response.body
 
        assert '4 results' in response.body, 'no message about proper search results'
 
        assert 'Permission denied' not in response.body, 'Wrong permissions settings for that repo and user'
 

	
rhodecode/tests/functional/test_settings.py
Show inline comments
 
@@ -47,4 +47,3 @@ class TestSettingsController(TestControl
 
                                    repo_name=fork_name))
 

	
 
        assert 'Fork of %s' % repo_name in response.body, 'no message about that this repo is a fork'
 

	
rhodecode/tests/functional/test_summary.py
Show inline comments
 
@@ -29,4 +29,3 @@ class TestSummaryController(TestControll
 
        r.enable_statistics = True
 
        self.sa.add(r)
 
        self.sa.commit()
 

	
rhodecode/tests/test_hg_operations.py
Show inline comments
 
@@ -4,7 +4,7 @@
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Test suite for making push/pull operations
 
    
 

	
 
    :created_on: Dec 30, 2010
 
    :copyright: (c) 2010 by marcink.
 
    :license: LICENSE_NAME, see LICENSE_FILE for more details.
 
@@ -328,5 +328,3 @@ if __name__ == '__main__':
 
    test_push_new_file(commits=15)
 
    #test_push_wrong_path()
 
    #test_push_wrong_credentials()
 

	
 

	
rhodecode/websetup.py
Show inline comments
 
@@ -4,22 +4,22 @@
 
    ~~~~~~~~~~~~~~~~~~
 

	
 
    Weboperations and setup for rhodecode
 
    
 

	
 
    :created_on: Dec 11, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :copyright: (C) 2009-2011 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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
@@ -47,8 +47,3 @@ def setup_app(command, conf, vars):
 
    dbmanage.populate_default_permissions()
 

	
 
    load_environment(conf.global_conf, conf.local_conf, initial=True)
 

	
 

	
 

	
 

	
 

	
setup.py
Show inline comments
 
@@ -115,6 +115,6 @@ setup(
 
    celerybeat=rhodecode.lib.celerypylons.commands:CeleryBeatCommand
 
    camqadm=rhodecode.lib.celerypylons.commands:CAMQPAdminCommand
 
    celeryev=rhodecode.lib.celerypylons.commands:CeleryEventCommand
 
              
 

	
 
    """,
 
)
0 comments (0 inline, 0 general)