changeset 564:ba7e24cd4786

refactor codes and setup for python 2.5 readme update
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 09 Oct 2010 16:05:14 +0200
parents 1a77a0c350f5
children ad2e97c6f17f
files README.rst rhodecode/controllers/admin/permissions.py rhodecode/controllers/admin/repos.py rhodecode/controllers/admin/settings.py rhodecode/controllers/admin/users.py rhodecode/controllers/login.py rhodecode/controllers/settings.py rhodecode/lib/auth.py rhodecode/lib/celerylib/tasks.py setup.py
diffstat 10 files changed, 65 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/README.rst	Sat Oct 09 01:38:10 2010 +0200
+++ b/README.rst	Sat Oct 09 16:05:14 2010 +0200
@@ -1,33 +1,33 @@
---------------------------------------------------------------
-Pylons based repository management for mercurial (and soon git)
---------------------------------------------------------------
-
-Fully customizable, with authentication, permissions. Based on vcs library.
+------------------------------------------------
+Pylons based repository management for mercurial
+------------------------------------------------
 
 **Overview**
 
-- has it's own middleware to handle mercurial protocol request each request can 
-  be logged and authenticated + threaded performance unlikely to hgweb
-- full permissions per project read/write/admin access even on mercurial request
-- mako templates let's you customize look and feel of application.
-- diffs annotations and source code all colored by pygments.
-- mercurial branch graph and yui-flot powered graphs with zooming and statistics
-- admin interface for performing user/permission managements as well as repository
-  management.
-- server side forks, it's possible to fork a project and hack it free without
+- Has it's own middleware to handle mercurial protocol request. Each request can 
+  be logged and authenticated. Runs on threads unlikely to hgweb You can make
+  multiple pulls/pushes simultaneous
+- Full permissions and authentication per project private/read/write/admin. 
+  One account for web interface and mercurial push/pull/clone.
+- Mako templates let's you customize look and feel of application.
+- Beautiful diffs, annotations and source codes all colored by pygments.
+- Mercurial branch graph and yui-flot powered graphs with zooming and statistics
+- Admin interface with user/permission management. User activity journal logs
+  pulls, pushes, forks,registrations. Possible to disable built in hooks
+- Server side forks, it's possible to fork a project and hack it free without
   breaking the main.   
-- full text search of source codes with indexing daemons using whoosh
+- Full text search on source codes, search on file names. All powered by whoosh
+  and build in indexing daemons
   (no external search servers required all in one application)
-- async tasks for speed and performance using celery (works without them too)  
-- Additional settings for mercurial web, (hooks editable from admin
-  panel !) also manage paths, archive, remote messages  
-- backup scripts can do backup of whole app and send it over scp to desired location
-- setup project descriptions and info inside built in db for easy, non 
+- Rss / atom feeds, gravatar support, download sources as zip/tarballs  
+- Async tasks for speed and performance using celery (works without them too)  
+- Backup scripts can do backup of whole app and send it over scp to desired 
+  location
+- Setup project descriptions and info inside built in db for easy, non 
   file-system operations
-- added cache with invalidation on push/repo management for high performance and
+- Added cache with invalidation on push/repo management for high performance and
   always up to date data. 
-- rss / atom feeds, gravatar support
-- based on pylons 1.0 / sqlalchemy 0.6
+- Based on pylons 1.0 / sqlalchemy 0.6 / sqlite
 
 **Incoming**
 
@@ -36,19 +36,14 @@
 - commit based wikis
 - clonning from remote repositories into rhodecode (git/mercurial)
 - other cools stuff that i can figure out (or You can help me figure out)
-
-.. note::
-   This software is still in beta mode. 
-   I don't guarantee that it'll work correctly.
    
+------------
+Installation
+------------
 
--------------
-Installation
--------------
-
-quick setup
+**quick setup**
  
-- pip install -E rhodecode-venv http://bitbucket.org/marcinkuzminski/rhodecode/get/tip.zip
+- pip install -E rhodecode-venv rhodecode
 - activate virtualenv
 - run `paster make-config RhodeCode production.ini`
 - run `paster setup-app production.ini`
@@ -56,8 +51,7 @@
 
 You're ready to go.
 
-
-MORE DETAILED INSTRUCTIONS
+**MORE DETAILED INSTRUCTIONS**
 
 - I highly recommend to install new virtualenv for rhodecode see 
   http://pypi.python.org/pypi/virtualenv for more details.
@@ -66,7 +60,7 @@
   Activate the virtualenv by running 
   `source activate /var/www/rhodecode-venv/bin/activate`   
 - Make a folder for rhodecode somewhere on the filesystem for example /var/www/rhodecode  
-- Run easy_install http://bitbucket.org/marcinkuzminski/rhodecode/get/tip.zip.
+- Run easy_install rhodecode
 - Run `paster make-config RhodeCode production.inii` in order to install 
   the application config. You can play with the app settings later 
 - Run `paster setup-app production.ini` it should create all needed tables 
@@ -83,12 +77,11 @@
   The app should gain a lot of speed and become much more responsible. 
   For installation instructions You can visit: 
   http://ask.github.com/celery/getting-started/index.html. 
-- All needed configs are inside rhodecode ie. celeryconfig.py , production.ini
-  You can configure the email, ports, loggers, workers from there.
+- All needed configs are inside rhodecode sources ie. celeryconfig.py, 
+  development.ini, production.ini You can configure the email, ports, loggers, 
+  workers from there.
 - For full text search You can either put crontab entry for 
   `python /var/www/rhodecode/rhodecode/lib/indexers/daemon.py incremental <path_to_repos>`
   or run indexer from admin panel. This will scann the repos given in the 
   application setup or given path for daemon.py and each scann in incremental 
-  mode will scann only changed files, 
-  Hg Update hook must be activated to index the content it's enabled by default
-  after setup
\ No newline at end of file
+  mode will scann only changed files.
\ No newline at end of file
--- a/rhodecode/controllers/admin/permissions.py	Sat Oct 09 01:38:10 2010 +0200
+++ b/rhodecode/controllers/admin/permissions.py	Sat Oct 09 16:05:14 2010 +0200
@@ -102,7 +102,7 @@
             h.flash(_('Default permissions updated succesfully'),
                     category='success')
                            
-        except formencode.Invalid as errors:
+        except formencode.Invalid, errors:
             c.perms_choices = self.perms_choices
             c.register_choices = self.register_choices
             c.create_choices = self.create_choices
--- a/rhodecode/controllers/admin/repos.py	Sat Oct 09 01:38:10 2010 +0200
+++ b/rhodecode/controllers/admin/repos.py	Sat Oct 09 16:05:14 2010 +0200
@@ -79,13 +79,13 @@
                     category='success')
 
             if request.POST.get('user_created'):
-                action_logger(self.rhodecode_user, 'user_created_repo', 
+                action_logger(self.rhodecode_user, 'user_created_repo',
                               form_result['repo_name'], '', self.sa)
             else:
-                action_logger(self.rhodecode_user, 'admin_created_repo', 
+                action_logger(self.rhodecode_user, 'admin_created_repo',
                               form_result['repo_name'], '', self.sa)                
                                                                              
-        except formencode.Invalid as errors:
+        except formencode.Invalid, errors:
             c.new_repo = errors.value['repo_name']
             
             if request.POST.get('user_created'):
@@ -137,7 +137,7 @@
             h.flash(_('Repository %s updated succesfully' % repo_name),
                     category='success')
             changed_name = form_result['repo_name']
-        except formencode.Invalid as errors:
+        except formencode.Invalid, errors:
             c.repo_info = repo_model.get(repo_name)
             c.users_array = repo_model.get_users_js()
             errors.value.update({'user':c.repo_info.user.username})
@@ -176,7 +176,7 @@
         
             return redirect(url('repos'))
         try:
-            action_logger(self.rhodecode_user, 'admin_deleted_repo', 
+            action_logger(self.rhodecode_user, 'admin_deleted_repo',
                               repo_name, '', self.sa)
             repo_model.delete(repo)            
             invalidate_cache('cached_repo_list')
@@ -199,7 +199,7 @@
         try:
             repo_model = RepoModel()
             repo_model.delete_perm_user(request.POST, repo_name)            
-        except Exception as e:
+        except Exception, e:
             h.flash(_('An error occured during deletion of repository user'),
                     category='error')
             raise HTTPInternalServerError()
--- a/rhodecode/controllers/admin/settings.py	Sat Oct 09 01:38:10 2010 +0200
+++ b/rhodecode/controllers/admin/settings.py	Sat Oct 09 16:05:14 2010 +0200
@@ -140,7 +140,7 @@
                     self.sa.rollback()
                     
 
-            except formencode.Invalid as errors:
+            except formencode.Invalid, errors:
                 return htmlfill.render(
                      render('admin/settings/settings.html'),
                      defaults=errors.value,
@@ -193,7 +193,7 @@
                     self.sa.rollback()
                     
 
-            except formencode.Invalid as errors:
+            except formencode.Invalid, errors:
                 return htmlfill.render(
                      render('admin/settings/settings.html'),
                      defaults=errors.value,
@@ -269,7 +269,7 @@
             h.flash(_('Your account was updated succesfully'),
                     category='success')
                            
-        except formencode.Invalid as errors:
+        except formencode.Invalid, errors:
             c.user = self.sa.query(User).get(c.rhodecode_user.user_id)
             c.user_repos = []
             for repo in c.cached_repo_list.values():
--- a/rhodecode/controllers/admin/users.py	Sat Oct 09 01:38:10 2010 +0200
+++ b/rhodecode/controllers/admin/users.py	Sat Oct 09 16:05:14 2010 +0200
@@ -73,7 +73,7 @@
             h.flash(_('created user %s') % form_result['username'],
                     category='success')
             #action_logger(self.rhodecode_user, 'new_user', '', '', self.sa)
-        except formencode.Invalid as errors:
+        except formencode.Invalid, errors:
             return htmlfill.render(
                 render('admin/users/user_add.html'),
                 defaults=errors.value,
@@ -110,7 +110,7 @@
             user_model.update(id, form_result)
             h.flash(_('User updated succesfully'), category='success')
                            
-        except formencode.Invalid as errors:
+        except formencode.Invalid, errors:
             return htmlfill.render(
                 render('admin/users/user_edit.html'),
                 defaults=errors.value,
@@ -136,7 +136,7 @@
         try:
             user_model.delete(id)
             h.flash(_('sucessfully deleted user'), category='success')
-        except DefaultUserException as e:
+        except DefaultUserException, e:
             h.flash(str(e), category='warning')
         except Exception:
             h.flash(_('An error occured during deletion of user'),
--- a/rhodecode/controllers/login.py	Sat Oct 09 01:38:10 2010 +0200
+++ b/rhodecode/controllers/login.py	Sat Oct 09 16:05:14 2010 +0200
@@ -74,7 +74,7 @@
                 else:
                     return redirect(url('hg_home'))
                                
-            except formencode.Invalid as errors:
+            except formencode.Invalid, errors:
                 return htmlfill.render(
                     render('/login.html'),
                     defaults=errors.value,
@@ -105,7 +105,7 @@
                             category='success')                
                 return redirect(url('login_home'))
                                
-            except formencode.Invalid as errors:
+            except formencode.Invalid, errors:
                 return htmlfill.render(
                     render('/register.html'),
                     defaults=errors.value,
@@ -127,7 +127,7 @@
                             category='success')                 
                 return redirect(url('login_home'))
                                
-            except formencode.Invalid as errors:
+            except formencode.Invalid, errors:
                 return htmlfill.render(
                     render('/password_reset.html'),
                     defaults=errors.value,
--- a/rhodecode/controllers/settings.py	Sat Oct 09 01:38:10 2010 +0200
+++ b/rhodecode/controllers/settings.py	Sat Oct 09 16:05:14 2010 +0200
@@ -82,7 +82,7 @@
             h.flash(_('Repository %s updated successfully' % repo_name),
                     category='success')
             changed_name = form_result['repo_name']               
-        except formencode.Invalid as errors:
+        except formencode.Invalid, errors:
             c.repo_info = repo_model.get(repo_name)
             c.users_array = repo_model.get_users_js()
             errors.value.update({'user':c.repo_info.user.username})
@@ -121,7 +121,7 @@
         
             return redirect(url('hg_home'))
         try:
-            action_logger(self.rhodecode_user, 'user_deleted_repo', 
+            action_logger(self.rhodecode_user, 'user_deleted_repo',
                               repo_name, '', self.sa)            
             repo_model.delete(repo)            
             invalidate_cache('cached_repo_list')
@@ -162,7 +162,7 @@
                     category='success')
             action_logger(self.rhodecode_user, 'user_forked_repo',
                             repo_name, '', self.sa)                                                 
-        except formencode.Invalid as errors:
+        except formencode.Invalid, errors:
             c.new_repo = errors.value['fork_name']
             r = render('settings/repo_fork.html')
             
--- a/rhodecode/lib/auth.py	Sat Oct 09 01:38:10 2010 +0200
+++ b/rhodecode/lib/auth.py	Sat Oct 09 16:05:14 2010 +0200
@@ -85,7 +85,7 @@
 def authfunc(environ, username, password):
     try:
         user = get_user_cached(username)
-    except (NoResultFound, MultipleResultsFound, OperationalError) as e:
+    except (NoResultFound, MultipleResultsFound, OperationalError), e:
         log.error(e)
         user = None
         
--- a/rhodecode/lib/celerylib/tasks.py	Sat Oct 09 01:38:10 2010 +0200
+++ b/rhodecode/lib/celerylib/tasks.py	Sat Oct 09 16:05:14 2010 +0200
@@ -8,10 +8,15 @@
 from rhodecode.lib.utils import OrderedDict
 from time import mktime
 from vcs.backends.hg import MercurialRepository
-import json
 import traceback
 
 try:
+    import json
+except ImportError:
+    #python 2.5 compatibility
+    import simplejson as json
+
+try:
     from celeryconfig import PYLONS_CONFIG as config
     celery_on = True
 except ImportError:
--- a/setup.py	Sat Oct 09 01:38:10 2010 +0200
+++ b/setup.py	Sat Oct 09 16:05:14 2010 +0200
@@ -1,5 +1,6 @@
 from rhodecode import get_version
 import sys
+py_version = sys.version_info
 
 requirements = [
         "Pylons>=1.0.0",
@@ -9,12 +10,15 @@
         "vcs>=0.1.7",
         "pygments>=1.3.0",
         "mercurial>=1.6",
-        "pysqlite",
         "whoosh==1.0.0",
         "py-bcrypt",
         "celery",
     ]
 
+if sys.version_info < (2, 6):
+    requirements.append("simplejson")
+    requirements.append("pysqlite")
+
 #additional files from project that goes somewhere in the filesystem
 #relative to sys.prefix
 data_files = []