##// END OF EJS Templates
#37 fixed json imports for python2.5...
marcink -
r592:0a48c1ec default
parent child Browse files
Show More
@@ -1,160 +1,171 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # rhodecode - Pylons environment configuration #
3 # rhodecode - Pylons environment configuration #
4 # #
4 # #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 ################################################################################
6 ################################################################################
7
7
8 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 ################################################################################
10 ################################################################################
11 ## Uncomment and replace with the address which should receive ##
11 ## Uncomment and replace with the address which should receive ##
12 ## any error reports after application crash ##
12 ## any error reports after application crash ##
13 ## Additionally those settings will be used by rhodecode mailing system ##
13 ## Additionally those settings will be used by rhodecode mailing system ##
14 ################################################################################
14 ################################################################################
15 #email_to = admin@localhost
15 #email_to = admin@localhost
16 #error_email_from = paste_error@localhost
16 #error_email_from = paste_error@localhost
17 #app_email_from = rhodecode-noreply@localhost
17 #app_email_from = rhodecode-noreply@localhost
18 #error_message =
18 #error_message =
19
19
20 #smtp_server = mail.server.com
20 #smtp_server = mail.server.com
21 #smtp_username =
21 #smtp_username =
22 #smtp_password =
22 #smtp_password =
23 #smtp_port =
23 #smtp_port =
24 #smtp_use_tls =
24 #smtp_use_tls =
25
25
26 [server:main]
26 [server:main]
27 ##nr of threads to spawn
27 ##nr of threads to spawn
28 threadpool_workers = 5
28 threadpool_workers = 5
29
29
30 ##max request before
30 ##max request before
31 threadpool_max_requests = 6
31 threadpool_max_requests = 6
32
32
33 ##option to use threads of process
33 ##option to use threads of process
34 use_threadpool = false
34 use_threadpool = false
35
35
36 use = egg:Paste#http
36 use = egg:Paste#http
37 host = 127.0.0.1
37 host = 127.0.0.1
38 port = 5000
38 port = 5000
39
39
40 [app:main]
40 [app:main]
41 use = egg:rhodecode
41 use = egg:rhodecode
42 full_stack = true
42 full_stack = true
43 static_files = true
43 static_files = true
44 lang=en
44 lang=en
45 cache_dir = %(here)s/data
45 cache_dir = %(here)s/data
46
46
47 ####################################
47 ####################################
48 ### BEAKER CACHE ####
48 ### BEAKER CACHE ####
49 ####################################
49 ####################################
50 beaker.cache.data_dir=/%(here)s/data/cache/data
50 beaker.cache.data_dir=/%(here)s/data/cache/data
51 beaker.cache.lock_dir=/%(here)s/data/cache/lock
51 beaker.cache.lock_dir=/%(here)s/data/cache/lock
52 beaker.cache.regions=super_short_term,short_term,long_term
52 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
53 beaker.cache.long_term.type=memory
53 beaker.cache.long_term.type=memory
54 beaker.cache.long_term.expire=36000
54 beaker.cache.long_term.expire=36000
55 beaker.cache.short_term.type=memory
55
56 beaker.cache.short_term.expire=60
56 beaker.cache.short_term.type=memory
57 beaker.cache.super_short_term.type=memory
57 beaker.cache.short_term.expire=60
58 beaker.cache.super_short_term.expire=10
58
59 beaker.cache.super_short_term.type=memory
60 beaker.cache.super_short_term.expire=10
61
62 beaker.cache.sql_cache_short.type=memory
63 beaker.cache.sql_cache_short.expire=5
64
65 beaker.cache.sql_cache_med.type=memory
66 beaker.cache.sql_cache_med.expire=360
67
68 beaker.cache.sql_cache_long.type=file
69 beaker.cache.sql_cache_long.expire=3600
59
70
60 ####################################
71 ####################################
61 ### BEAKER SESSION ####
72 ### BEAKER SESSION ####
62 ####################################
73 ####################################
63 ## Type of storage used for the session, current types are
74 ## Type of storage used for the session, current types are
64 ## "dbm", "file", "memcached", "database", and "memory".
75 ## "dbm", "file", "memcached", "database", and "memory".
65 ## The storage uses the Container API
76 ## The storage uses the Container API
66 ##that is also used by the cache system.
77 ##that is also used by the cache system.
67 beaker.session.type = file
78 beaker.session.type = file
68
79
69 beaker.session.key = rhodecode
80 beaker.session.key = rhodecode
70 beaker.session.secret = g654dcno0-9873jhgfreyu
81 beaker.session.secret = g654dcno0-9873jhgfreyu
71 beaker.session.timeout = 36000
82 beaker.session.timeout = 36000
72
83
73 ##auto save the session to not to use .save()
84 ##auto save the session to not to use .save()
74 beaker.session.auto = False
85 beaker.session.auto = False
75
86
76 ##true exire at browser close
87 ##true exire at browser close
77 #beaker.session.cookie_expires = 3600
88 #beaker.session.cookie_expires = 3600
78
89
79
90
80 ################################################################################
91 ################################################################################
81 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
92 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
82 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
93 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
83 ## execute malicious code after an exception is raised. ##
94 ## execute malicious code after an exception is raised. ##
84 ################################################################################
95 ################################################################################
85 #set debug = false
96 #set debug = false
86
97
87 ##################################
98 ##################################
88 ### LOGVIEW CONFIG ###
99 ### LOGVIEW CONFIG ###
89 ##################################
100 ##################################
90 logview.sqlalchemy = #faa
101 logview.sqlalchemy = #faa
91 logview.pylons.templating = #bfb
102 logview.pylons.templating = #bfb
92 logview.pylons.util = #eee
103 logview.pylons.util = #eee
93
104
94 #########################################################
105 #########################################################
95 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
106 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
96 #########################################################
107 #########################################################
97 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
108 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
98 #sqlalchemy.db1.echo = False
109 #sqlalchemy.db1.echo = False
99 #sqlalchemy.db1.pool_recycle = 3600
110 #sqlalchemy.db1.pool_recycle = 3600
100 sqlalchemy.convert_unicode = true
111 sqlalchemy.convert_unicode = true
101
112
102 ################################
113 ################################
103 ### LOGGING CONFIGURATION ####
114 ### LOGGING CONFIGURATION ####
104 ################################
115 ################################
105 [loggers]
116 [loggers]
106 keys = root, routes, rhodecode, sqlalchemy
117 keys = root, routes, rhodecode, sqlalchemy
107
118
108 [handlers]
119 [handlers]
109 keys = console
120 keys = console
110
121
111 [formatters]
122 [formatters]
112 keys = generic,color_formatter
123 keys = generic,color_formatter
113
124
114 #############
125 #############
115 ## LOGGERS ##
126 ## LOGGERS ##
116 #############
127 #############
117 [logger_root]
128 [logger_root]
118 level = NOTSET
129 level = NOTSET
119 handlers = console
130 handlers = console
120
131
121 [logger_routes]
132 [logger_routes]
122 level = DEBUG
133 level = DEBUG
123 handlers = console
134 handlers = console
124 qualname = routes.middleware
135 qualname = routes.middleware
125 # "level = DEBUG" logs the route matched and routing variables.
136 # "level = DEBUG" logs the route matched and routing variables.
126
137
127 [logger_rhodecode]
138 [logger_rhodecode]
128 level = DEBUG
139 level = DEBUG
129 handlers = console
140 handlers = console
130 qualname = rhodecode
141 qualname = rhodecode
131 propagate = 0
142 propagate = 0
132
143
133 [logger_sqlalchemy]
144 [logger_sqlalchemy]
134 level = ERROR
145 level = ERROR
135 handlers = console
146 handlers = console
136 qualname = sqlalchemy.engine
147 qualname = sqlalchemy.engine
137 propagate = 0
148 propagate = 0
138
149
139 ##############
150 ##############
140 ## HANDLERS ##
151 ## HANDLERS ##
141 ##############
152 ##############
142
153
143 [handler_console]
154 [handler_console]
144 class = StreamHandler
155 class = StreamHandler
145 args = (sys.stderr,)
156 args = (sys.stderr,)
146 level = NOTSET
157 level = NOTSET
147 formatter = color_formatter
158 formatter = color_formatter
148
159
149 ################
160 ################
150 ## FORMATTERS ##
161 ## FORMATTERS ##
151 ################
162 ################
152
163
153 [formatter_generic]
164 [formatter_generic]
154 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
165 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
155 datefmt = %Y-%m-%d %H:%M:%S
166 datefmt = %Y-%m-%d %H:%M:%S
156
167
157 [formatter_color_formatter]
168 [formatter_color_formatter]
158 class=rhodecode.lib.colored_formatter.ColorFormatter
169 class=rhodecode.lib.colored_formatter.ColorFormatter
159 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
170 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
160 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
171 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,15 +1,20 b''
1 .. _changelog:
1 .. _changelog:
2
2
3 Changelog
3 Changelog
4 =========
4 =========
5
5
6 1.0.0rc4 (**2010-10-12**)
6
7
7 1.0.0rc3 (**tip**)
8 - fixed python2.5 missing simplejson imports (thanks to Jens BΓ€ckman)
9 - removed cache_manager settings from sqlalchemy meta
10 - added sqlalchemy cache settings to ini files
11
12 1.0.0rc3 (**2010-10-11**)
8
13
9 - fixed i18n during installation.
14 - fixed i18n during installation.
10
15
11 1.0.0rc2 (**tip**)
16 1.0.0rc2 (**2010-10-11**)
12
17
13 - Disabled dirsize in file browser, it's causing nasty bug when dir renames
18 - Disabled dirsize in file browser, it's causing nasty bug when dir renames
14 occure. After vcs is fixed it'll be put back again.
19 occure. After vcs is fixed it'll be put back again.
15 - templating/css rewrites, optimized css.
20 - templating/css rewrites, optimized css.
@@ -1,132 +1,129 b''
1 .. _setup:
1 .. _setup:
2
2
3 Setup
3 Setup
4 =====
4 =====
5
5
6
6
7 Setting up the application
7 Setting up the application
8 --------------------------
8 --------------------------
9
9
10 ::
10 ::
11
11
12 paster make-config RhodeCode production.ini
12 paster make-config RhodeCode production.ini
13
13
14 - This will create `production.ini` config inside the directory
14 - This will create `production.ini` config inside the directory
15 this config contain various settings for rhodecode, e.g port, email settings
15 this config contain various settings for rhodecode, e.g port, email settings
16 static files, cache and logging.
16 static files, cache and logging.
17
17
18 ::
18 ::
19
19
20 paster setup-app production.ini`
20 paster setup-app production.ini`
21
21
22 - This command will create all needed tables and an admin account.
22 - This command will create all needed tables and an admin account.
23 When asked for a path You can either use a new location of one with already
23 When asked for a path You can either use a new location of one with already
24 existing ones. RhodeCode will simply add all new found repositories to
24 existing ones. RhodeCode will simply add all new found repositories to
25 it's database. Also make sure You specify correct path to repositories.
25 it's database. Also make sure You specify correct path to repositories.
26 - Remember that the given path for mercurial_ repositories must be write
26 - Remember that the given path for mercurial_ repositories must be write
27 accessible for the application. It's very important since RhodeCode web interface
27 accessible for the application. It's very important since RhodeCode web interface
28 will work even without such an access but, when trying to do a push it'll
28 will work even without such an access but, when trying to do a push it'll
29 eventually faile with permission denied errors.
29 eventually fail with permission denied errors.
30 - Run
30 - Run
31
31
32 ::
32 ::
33
33
34 paster serve production.ini
34 paster serve production.ini
35
35
36 - This command runs the rhodecode server the app should be available at the
36 - This command runs the rhodecode server the app should be available at the
37 127.0.0.1:5000. This ip and port is configurable via the production.ini
37 127.0.0.1:5000. This ip and port is configurable via the production.ini
38 file created in previos step
38 file created in previous step
39 - Use admin account you created to login.
39 - Use admin account you created to login.
40 - Default permissions on each repository is read, and owner is admin. So
40 - Default permissions on each repository is read, and owner is admin. So
41 remember to update these.
41 remember to update these if needed.
42
43 - All needed configs are inside rhodecode sources ie. celeryconfig.py,
44 development.ini, production.ini You can configure the email, ports, loggers,
45 workers from there.
46
42
43
47 Setting up Whoosh
44 Setting up Whoosh
48 -----------------
45 -----------------
49
46
50 - For full text search You can either put crontab entry for
47 - For full text search You can either put crontab entry for
51
48
52 ::
49 ::
53
50
54 python /var/www/rhodecode/rhodecode/lib/indexers/daemon.py incremental <put_here_path_to_repos>
51 python /var/www/rhodecode/<rhodecode_installation_path>/lib/indexers/daemon.py incremental <put_here_path_to_repos>
55
52
56 When using incremental mode whoosh will check last modification date of each file
53 When using incremental mode whoosh will check last modification date of each file
57 and add it to reindex if newer file is available. Also indexing daemon checks
54 and add it to reindex if newer file is available. Also indexing daemon checks
58 for removed files and removes them from index. Sometime You might want to rebuild
55 for removed files and removes them from index. Sometime You might want to rebuild
59 index from scrach, in admin pannel You can check `build from scratch` flag
56 index from scrach, in admin pannel You can check `build from scratch` flag
60 and in standalone daemon You can pass `full` instead on incremental to build
57 and in standalone daemon You can pass `full` instead on incremental to build
61 remove previos index and build new one.
58 remove previos index and build new one.
62
59
63 Nginx virtual host example
60 Nginx virtual host example
64 --------------------------
61 --------------------------
65
62
66 Sample config for nginx::
63 Sample config for nginx::
67
64
68 server {
65 server {
69 listen 80;
66 listen 80;
70 server_name hg.myserver.com;
67 server_name hg.myserver.com;
71 access_log /var/log/nginx/rhodecode.access.log;
68 access_log /var/log/nginx/rhodecode.access.log;
72 error_log /var/log/nginx/rhodecode.error.log;
69 error_log /var/log/nginx/rhodecode.error.log;
73 location / {
70 location / {
74 root /var/www/rhodecode/rhodecode/public/;
71 root /var/www/rhodecode/rhodecode/public/;
75 if (!-f $request_filename){
72 if (!-f $request_filename){
76 proxy_pass http://127.0.0.1:5000;
73 proxy_pass http://127.0.0.1:5000;
77 }
74 }
78 #this is important for https !!!
75 #this is important for https !!!
79 proxy_set_header X-Url-Scheme $scheme;
76 proxy_set_header X-Url-Scheme $scheme;
80 include /etc/nginx/proxy.conf;
77 include /etc/nginx/proxy.conf;
81 }
78 }
82 }
79 }
83
80
84 Here's the proxy.conf. It's tunned so it'll not timeout on long
81 Here's the proxy.conf. It's tuned so it'll not timeout on long
85 pushes and also on large pushes::
82 pushes and also on large pushes::
86
83
87 proxy_redirect off;
84 proxy_redirect off;
88 proxy_set_header Host $host;
85 proxy_set_header Host $host;
89 proxy_set_header X-Host $http_host;
86 proxy_set_header X-Host $http_host;
90 proxy_set_header X-Real-IP $remote_addr;
87 proxy_set_header X-Real-IP $remote_addr;
91 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
88 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
92 proxy_set_header Proxy-host $proxy_host;
89 proxy_set_header Proxy-host $proxy_host;
93 client_max_body_size 400m;
90 client_max_body_size 400m;
94 client_body_buffer_size 128k;
91 client_body_buffer_size 128k;
95 proxy_buffering off;
92 proxy_buffering off;
96 proxy_connect_timeout 3600;
93 proxy_connect_timeout 3600;
97 proxy_send_timeout 3600;
94 proxy_send_timeout 3600;
98 proxy_read_timeout 3600;
95 proxy_read_timeout 3600;
99 proxy_buffer_size 8k;
96 proxy_buffer_size 8k;
100 proxy_buffers 8 32k;
97 proxy_buffers 8 32k;
101 proxy_busy_buffers_size 64k;
98 proxy_busy_buffers_size 64k;
102 proxy_temp_file_write_size 64k;
99 proxy_temp_file_write_size 64k;
103
100
104 Also when using root path with nginx You might set the static files to false
101 Also when using root path with nginx You might set the static files to false
105 in production.ini file::
102 in production.ini file::
106
103
107 [app:main]
104 [app:main]
108 use = egg:rhodecode
105 use = egg:rhodecode
109 full_stack = true
106 full_stack = true
110 static_files = false
107 static_files = false
111 lang=en
108 lang=en
112 cache_dir = %(here)s/data
109 cache_dir = %(here)s/data
113
110
114 To not have the statics served by the application.
111 To not have the statics served by the application. And improve speed.
115
112
116
113
117 Other configuration files
114 Other configuration files
118 -------------------------
115 -------------------------
119
116
120 Some extra configuration files and examples can be found here:
117 Some extra configuration files and examples can be found here:
121 http://hg.python-works.com/rhodecode/files/tip/init.d
118 http://hg.python-works.com/rhodecode/files/tip/init.d
122
119
123 and also an celeryconfig file can be use from here:
120 and also an celeryconfig file can be use from here:
124 http://hg.python-works.com/rhodecode/files/tip/celeryconfig.py
121 http://hg.python-works.com/rhodecode/files/tip/celeryconfig.py
125
122
126
123
127
124
128 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
125 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
129 .. _python: http://www.python.org/
126 .. _python: http://www.python.org/
130 .. _mercurial: http://mercurial.selenic.com/
127 .. _mercurial: http://mercurial.selenic.com/
131 .. _celery: http://celeryproject.org/
128 .. _celery: http://celeryproject.org/
132 .. _rabbitmq: http://www.rabbitmq.com/ No newline at end of file
129 .. _rabbitmq: http://www.rabbitmq.com/
@@ -1,160 +1,171 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # rhodecode - Pylons environment configuration #
3 # rhodecode - Pylons environment configuration #
4 # #
4 # #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 ################################################################################
6 ################################################################################
7
7
8 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 ################################################################################
10 ################################################################################
11 ## Uncomment and replace with the address which should receive ##
11 ## Uncomment and replace with the address which should receive ##
12 ## any error reports after application crash ##
12 ## any error reports after application crash ##
13 ## Additionally those settings will be used by rhodecode mailing system ##
13 ## Additionally those settings will be used by rhodecode mailing system ##
14 ################################################################################
14 ################################################################################
15 #email_to = admin@localhost
15 #email_to = admin@localhost
16 #error_email_from = paste_error@localhost
16 #error_email_from = paste_error@localhost
17 #app_email_from = rhodecode-noreply@localhost
17 #app_email_from = rhodecode-noreply@localhost
18 #error_message =
18 #error_message =
19
19
20 #smtp_server = mail.server.com
20 #smtp_server = mail.server.com
21 #smtp_username =
21 #smtp_username =
22 #smtp_password =
22 #smtp_password =
23 #smtp_port =
23 #smtp_port =
24 #smtp_use_tls = false
24 #smtp_use_tls = false
25
25
26 [server:main]
26 [server:main]
27 ##nr of threads to spawn
27 ##nr of threads to spawn
28 threadpool_workers = 5
28 threadpool_workers = 5
29
29
30 ##max request before thread respawn
30 ##max request before thread respawn
31 threadpool_max_requests = 2
31 threadpool_max_requests = 2
32
32
33 ##option to use threads of process
33 ##option to use threads of process
34 use_threadpool = true
34 use_threadpool = true
35
35
36 use = egg:Paste#http
36 use = egg:Paste#http
37 host = 127.0.0.1
37 host = 127.0.0.1
38 port = 8001
38 port = 8001
39
39
40 [app:main]
40 [app:main]
41 use = egg:rhodecode
41 use = egg:rhodecode
42 full_stack = true
42 full_stack = true
43 static_files = false
43 static_files = false
44 lang=en
44 lang=en
45 cache_dir = %(here)s/data
45 cache_dir = %(here)s/data
46
46
47 ####################################
47 ####################################
48 ### BEAKER CACHE ####
48 ### BEAKER CACHE ####
49 ####################################
49 ####################################
50 beaker.cache.data_dir=/%(here)s/data/cache/data
50 beaker.cache.data_dir=/%(here)s/data/cache/data
51 beaker.cache.lock_dir=/%(here)s/data/cache/lock
51 beaker.cache.lock_dir=/%(here)s/data/cache/lock
52 beaker.cache.regions=super_short_term,short_term,long_term
52 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
53 beaker.cache.long_term.type=memory
53 beaker.cache.long_term.type=memory
54 beaker.cache.long_term.expire=36000
54 beaker.cache.long_term.expire=36000
55 beaker.cache.short_term.type=memory
55
56 beaker.cache.short_term.expire=60
56 beaker.cache.short_term.type=memory
57 beaker.cache.super_short_term.type=memory
57 beaker.cache.short_term.expire=60
58 beaker.cache.super_short_term.expire=10
58
59 beaker.cache.super_short_term.type=memory
60 beaker.cache.super_short_term.expire=10
61
62 beaker.cache.sql_cache_short.type=memory
63 beaker.cache.sql_cache_short.expire=5
64
65 beaker.cache.sql_cache_med.type=memory
66 beaker.cache.sql_cache_med.expire=360
67
68 beaker.cache.sql_cache_long.type=file
69 beaker.cache.sql_cache_long.expire=3600
59
70
60 ####################################
71 ####################################
61 ### BEAKER SESSION ####
72 ### BEAKER SESSION ####
62 ####################################
73 ####################################
63 ## Type of storage used for the session, current types are
74 ## Type of storage used for the session, current types are
64 ## dbm, file, memcached, database, and memory.
75 ## "dbm", "file", "memcached", "database", and "memory".
65 ## The storage uses the Container API
76 ## The storage uses the Container API
66 ##that is also used by the cache system.
77 ##that is also used by the cache system.
67 beaker.session.type = file
78 beaker.session.type = file
68
79
69 beaker.session.key = rhodecode
80 beaker.session.key = rhodecode
70 beaker.session.secret = g654dcno0-9873jhgfreyu
81 beaker.session.secret = g654dcno0-9873jhgfreyu
71 beaker.session.timeout = 36000
82 beaker.session.timeout = 36000
72
83
73 ##auto save the session to not to use .save()
84 ##auto save the session to not to use .save()
74 beaker.session.auto = False
85 beaker.session.auto = False
75
86
76 ##true exire at browser close
87 ##true exire at browser close
77 #beaker.session.cookie_expires = 3600
88 #beaker.session.cookie_expires = 3600
78
89
79
90
80 ################################################################################
91 ################################################################################
81 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
92 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
82 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
93 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
83 ## execute malicious code after an exception is raised. ##
94 ## execute malicious code after an exception is raised. ##
84 ################################################################################
95 ################################################################################
85 set debug = false
96 set debug = false
86
97
87 ##################################
98 ##################################
88 ### LOGVIEW CONFIG ###
99 ### LOGVIEW CONFIG ###
89 ##################################
100 ##################################
90 logview.sqlalchemy = #faa
101 logview.sqlalchemy = #faa
91 logview.pylons.templating = #bfb
102 logview.pylons.templating = #bfb
92 logview.pylons.util = #eee
103 logview.pylons.util = #eee
93
104
94 #########################################################
105 #########################################################
95 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
106 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
96 #########################################################
107 #########################################################
97 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
108 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
98 #sqlalchemy.db1.echo = False
109 #sqlalchemy.db1.echo = False
99 #sqlalchemy.db1.pool_recycle = 3600
110 #sqlalchemy.db1.pool_recycle = 3600
100 sqlalchemy.convert_unicode = true
111 sqlalchemy.convert_unicode = true
101
112
102 ################################
113 ################################
103 ### LOGGING CONFIGURATION ####
114 ### LOGGING CONFIGURATION ####
104 ################################
115 ################################
105 [loggers]
116 [loggers]
106 keys = root, routes, rhodecode, sqlalchemy
117 keys = root, routes, rhodecode, sqlalchemy
107
118
108 [handlers]
119 [handlers]
109 keys = console
120 keys = console
110
121
111 [formatters]
122 [formatters]
112 keys = generic,color_formatter
123 keys = generic,color_formatter
113
124
114 #############
125 #############
115 ## LOGGERS ##
126 ## LOGGERS ##
116 #############
127 #############
117 [logger_root]
128 [logger_root]
118 level = INFO
129 level = INFO
119 handlers = console
130 handlers = console
120
131
121 [logger_routes]
132 [logger_routes]
122 level = INFO
133 level = INFO
123 handlers = console
134 handlers = console
124 qualname = routes.middleware
135 qualname = routes.middleware
125 # "level = DEBUG" logs the route matched and routing variables.
136 # "level = DEBUG" logs the route matched and routing variables.
126
137
127 [logger_rhodecode]
138 [logger_rhodecode]
128 level = DEBUG
139 level = DEBUG
129 handlers = console
140 handlers = console
130 qualname = rhodecode
141 qualname = rhodecode
131 propagate = 0
142 propagate = 0
132
143
133 [logger_sqlalchemy]
144 [logger_sqlalchemy]
134 level = ERROR
145 level = ERROR
135 handlers = console
146 handlers = console
136 qualname = sqlalchemy.engine
147 qualname = sqlalchemy.engine
137 propagate = 0
148 propagate = 0
138
149
139 ##############
150 ##############
140 ## HANDLERS ##
151 ## HANDLERS ##
141 ##############
152 ##############
142
153
143 [handler_console]
154 [handler_console]
144 class = StreamHandler
155 class = StreamHandler
145 args = (sys.stderr,)
156 args = (sys.stderr,)
146 level = NOTSET
157 level = NOTSET
147 formatter = color_formatter
158 formatter = color_formatter
148
159
149 ################
160 ################
150 ## FORMATTERS ##
161 ## FORMATTERS ##
151 ################
162 ################
152
163
153 [formatter_generic]
164 [formatter_generic]
154 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
165 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
155 datefmt = %Y-%m-%d %H:%M:%S
166 datefmt = %Y-%m-%d %H:%M:%S
156
167
157 [formatter_color_formatter]
168 [formatter_color_formatter]
158 class=rhodecode.lib.colored_formatter.ColorFormatter
169 class=rhodecode.lib.colored_formatter.ColorFormatter
159 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
170 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
160 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
171 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,35 +1,35 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # encoding: utf-8
2 # encoding: utf-8
3 # RhodeCode, a web based repository management based on pylons
3 # RhodeCode, a web based repository management based on pylons
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
5 #
5 #
6 # This program is free software; you can redistribute it and/or
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; version 2
8 # as published by the Free Software Foundation; version 2
9 # of the License or (at your opinion) any later version of the license.
9 # of the License or (at your opinion) any later version of the license.
10 #
10 #
11 # This program is distributed in the hope that it will be useful,
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
14 # GNU General Public License for more details.
15 #
15 #
16 # You should have received a copy of the GNU General Public License
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 # MA 02110-1301, USA.
19 # MA 02110-1301, USA.
20 """
20 """
21 Created on April 9, 2010
21 Created on April 9, 2010
22 RhodeCode, a web based repository management based on pylons
22 RhodeCode, a web based repository management based on pylons
23 versioning implementation: http://semver.org/
23 versioning implementation: http://semver.org/
24 @author: marcink
24 @author: marcink
25 """
25 """
26
26
27 VERSION = (1, 0, 0, 'rc3')
27 VERSION = (1, 0, 0, 'rc4')
28
28
29 __version__ = '.'.join((str(each) for each in VERSION[:4]))
29 __version__ = '.'.join((str(each) for each in VERSION[:4]))
30
30
31 def get_version():
31 def get_version():
32 """
32 """
33 Returns shorter version (digit parts only) as string.
33 Returns shorter version (digit parts only) as string.
34 """
34 """
35 return '.'.join((str(each) for each in VERSION[:3]))
35 return '.'.join((str(each) for each in VERSION[:3]))
@@ -1,161 +1,172 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # rhodecode - Pylons environment configuration #
3 # rhodecode - Pylons environment configuration #
4 # #
4 # #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 ################################################################################
6 ################################################################################
7
7
8 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 ################################################################################
10 ################################################################################
11 ## Uncomment and replace with the address which should receive ##
11 ## Uncomment and replace with the address which should receive ##
12 ## any error reports after application crash ##
12 ## any error reports after application crash ##
13 ## Additionally those settings will be used by rhodecode mailing system ##
13 ## Additionally those settings will be used by rhodecode mailing system ##
14 ################################################################################
14 ################################################################################
15 #email_to = admin@localhost
15 #email_to = admin@localhost
16 #error_email_from = paste_error@localhost
16 #error_email_from = paste_error@localhost
17 #app_email_from = rhodecode-noreply@localhost
17 #app_email_from = rhodecode-noreply@localhost
18 #error_message =
18 #error_message =
19
19
20 #smtp_server = mail.server.com
20 #smtp_server = mail.server.com
21 #smtp_username =
21 #smtp_username =
22 #smtp_password =
22 #smtp_password =
23 #smtp_port =
23 #smtp_port =
24 #smtp_use_tls = false
24 #smtp_use_tls = false
25
25
26 [server:main]
26 [server:main]
27 ##nr of threads to spawn
27 ##nr of threads to spawn
28 threadpool_workers = 5
28 threadpool_workers = 5
29
29
30 ##max request before thread respawn
30 ##max request before thread respawn
31 threadpool_max_requests = 2
31 threadpool_max_requests = 2
32
32
33 ##option to use threads of process
33 ##option to use threads of process
34 use_threadpool = true
34 use_threadpool = true
35
35
36 use = egg:Paste#http
36 use = egg:Paste#http
37 host = 127.0.0.1
37 host = 127.0.0.1
38 port = 5000
38 port = 5000
39
39
40 [app:main]
40 [app:main]
41 use = egg:rhodecode
41 use = egg:rhodecode
42 full_stack = true
42 full_stack = true
43 static_files = true
43 static_files = true
44 lang=en
44 lang=en
45 cache_dir = %(here)s/data
45 cache_dir = %(here)s/data
46 app_instance_uuid = ${app_instance_uuid}
46 app_instance_uuid = ${app_instance_uuid}
47
47
48 ####################################
48 ####################################
49 ### BEAKER CACHE ####
49 ### BEAKER CACHE ####
50 ####################################
50 ####################################
51 beaker.cache.data_dir=/%(here)s/data/cache/data
51 beaker.cache.data_dir=/%(here)s/data/cache/data
52 beaker.cache.lock_dir=/%(here)s/data/cache/lock
52 beaker.cache.lock_dir=/%(here)s/data/cache/lock
53 beaker.cache.regions=super_short_term,short_term,long_term
53 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
54 beaker.cache.long_term.type=memory
54 beaker.cache.long_term.type=memory
55 beaker.cache.long_term.expire=36000
55 beaker.cache.long_term.expire=36000
56 beaker.cache.short_term.type=memory
56
57 beaker.cache.short_term.expire=60
57 beaker.cache.short_term.type=memory
58 beaker.cache.super_short_term.type=memory
58 beaker.cache.short_term.expire=60
59 beaker.cache.super_short_term.expire=10
59
60 beaker.cache.super_short_term.type=memory
61 beaker.cache.super_short_term.expire=10
62
63 beaker.cache.sql_cache_short.type=memory
64 beaker.cache.sql_cache_short.expire=5
65
66 beaker.cache.sql_cache_med.type=memory
67 beaker.cache.sql_cache_med.expire=360
68
69 beaker.cache.sql_cache_long.type=file
70 beaker.cache.sql_cache_long.expire=3600
60
71
61 ####################################
72 ####################################
62 ### BEAKER SESSION ####
73 ### BEAKER SESSION ####
63 ####################################
74 ####################################
64 ## Type of storage used for the session, current types are
75 ## Type of storage used for the session, current types are
65 ## dbm, file, memcached, database, and memory.
76 ## "dbm", "file", "memcached", "database", and "memory".
66 ## The storage uses the Container API
77 ## The storage uses the Container API
67 ##that is also used by the cache system.
78 ##that is also used by the cache system.
68 beaker.session.type = file
79 beaker.session.type = file
69
80
70 beaker.session.key = rhodecode
81 beaker.session.key = rhodecode
71 beaker.session.secret = ${app_instance_secret}
82 beaker.session.secret = ${app_instance_secret}
72 beaker.session.timeout = 36000
83 beaker.session.timeout = 36000
73
84
74 ##auto save the session to not to use .save()
85 ##auto save the session to not to use .save()
75 beaker.session.auto = False
86 beaker.session.auto = False
76
87
77 ##true exire at browser close
88 ##true exire at browser close
78 #beaker.session.cookie_expires = 3600
89 #beaker.session.cookie_expires = 3600
79
90
80
91
81 ################################################################################
92 ################################################################################
82 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
93 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
83 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
94 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
84 ## execute malicious code after an exception is raised. ##
95 ## execute malicious code after an exception is raised. ##
85 ################################################################################
96 ################################################################################
86 set debug = false
97 set debug = false
87
98
88 ##################################
99 ##################################
89 ### LOGVIEW CONFIG ###
100 ### LOGVIEW CONFIG ###
90 ##################################
101 ##################################
91 logview.sqlalchemy = #faa
102 logview.sqlalchemy = #faa
92 logview.pylons.templating = #bfb
103 logview.pylons.templating = #bfb
93 logview.pylons.util = #eee
104 logview.pylons.util = #eee
94
105
95 #########################################################
106 #########################################################
96 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
107 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
97 #########################################################
108 #########################################################
98 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
109 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
99 #sqlalchemy.db1.echo = False
110 #sqlalchemy.db1.echo = False
100 #sqlalchemy.db1.pool_recycle = 3600
111 #sqlalchemy.db1.pool_recycle = 3600
101 sqlalchemy.convert_unicode = true
112 sqlalchemy.convert_unicode = true
102
113
103 ################################
114 ################################
104 ### LOGGING CONFIGURATION ####
115 ### LOGGING CONFIGURATION ####
105 ################################
116 ################################
106 [loggers]
117 [loggers]
107 keys = root, routes, rhodecode, sqlalchemy
118 keys = root, routes, rhodecode, sqlalchemy
108
119
109 [handlers]
120 [handlers]
110 keys = console
121 keys = console
111
122
112 [formatters]
123 [formatters]
113 keys = generic,color_formatter
124 keys = generic,color_formatter
114
125
115 #############
126 #############
116 ## LOGGERS ##
127 ## LOGGERS ##
117 #############
128 #############
118 [logger_root]
129 [logger_root]
119 level = INFO
130 level = INFO
120 handlers = console
131 handlers = console
121
132
122 [logger_routes]
133 [logger_routes]
123 level = INFO
134 level = INFO
124 handlers = console
135 handlers = console
125 qualname = routes.middleware
136 qualname = routes.middleware
126 # "level = DEBUG" logs the route matched and routing variables.
137 # "level = DEBUG" logs the route matched and routing variables.
127
138
128 [logger_rhodecode]
139 [logger_rhodecode]
129 level = DEBUG
140 level = DEBUG
130 handlers = console
141 handlers = console
131 qualname = rhodecode
142 qualname = rhodecode
132 propagate = 0
143 propagate = 0
133
144
134 [logger_sqlalchemy]
145 [logger_sqlalchemy]
135 level = ERROR
146 level = ERROR
136 handlers = console
147 handlers = console
137 qualname = sqlalchemy.engine
148 qualname = sqlalchemy.engine
138 propagate = 0
149 propagate = 0
139
150
140 ##############
151 ##############
141 ## HANDLERS ##
152 ## HANDLERS ##
142 ##############
153 ##############
143
154
144 [handler_console]
155 [handler_console]
145 class = StreamHandler
156 class = StreamHandler
146 args = (sys.stderr,)
157 args = (sys.stderr,)
147 level = NOTSET
158 level = NOTSET
148 formatter = color_formatter
159 formatter = color_formatter
149
160
150 ################
161 ################
151 ## FORMATTERS ##
162 ## FORMATTERS ##
152 ################
163 ################
153
164
154 [formatter_generic]
165 [formatter_generic]
155 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
166 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
156 datefmt = %Y-%m-%d %H:%M:%S
167 datefmt = %Y-%m-%d %H:%M:%S
157
168
158 [formatter_color_formatter]
169 [formatter_color_formatter]
159 class=rhodecode.lib.colored_formatter.ColorFormatter
170 class=rhodecode.lib.colored_formatter.ColorFormatter
160 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
171 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
161 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
172 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,90 +1,96 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # encoding: utf-8
2 # encoding: utf-8
3 # changelog controller for pylons
3 # changelog controller for pylons
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
5 #
5 #
6 # This program is free software; you can redistribute it and/or
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; version 2
8 # as published by the Free Software Foundation; version 2
9 # of the License or (at your opinion) any later version of the license.
9 # of the License or (at your opinion) any later version of the license.
10 #
10 #
11 # This program is distributed in the hope that it will be useful,
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
14 # GNU General Public License for more details.
15 #
15 #
16 # You should have received a copy of the GNU General Public License
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 # MA 02110-1301, USA.
19 # MA 02110-1301, USA.
20 """
20 """
21 Created on April 21, 2010
21 Created on April 21, 2010
22 changelog controller for pylons
22 changelog controller for pylons
23 @author: marcink
23 @author: marcink
24 """
24 """
25 from json import dumps
25
26 from mercurial.graphmod import colored, CHANGESET, revisions as graph_rev
26 from mercurial.graphmod import colored, CHANGESET, revisions as graph_rev
27 from pylons import request, session, tmpl_context as c
27 from pylons import request, session, tmpl_context as c
28 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
28 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
29 from rhodecode.lib.base import BaseController, render
29 from rhodecode.lib.base import BaseController, render
30 from rhodecode.model.hg_model import HgModel
30 from rhodecode.model.hg_model import HgModel
31 from webhelpers.paginate import Page
31 from webhelpers.paginate import Page
32 import logging
32 import logging
33 log = logging.getLogger(__name__)
33 log = logging.getLogger(__name__)
34
34
35 try:
36 import json
37 except ImportError:
38 #python 2.5 compatibility
39 import simplejson as json
40
35 class ChangelogController(BaseController):
41 class ChangelogController(BaseController):
36
42
37 @LoginRequired()
43 @LoginRequired()
38 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
44 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
39 'repository.admin')
45 'repository.admin')
40 def __before__(self):
46 def __before__(self):
41 super(ChangelogController, self).__before__()
47 super(ChangelogController, self).__before__()
42
48
43 def index(self):
49 def index(self):
44 limit = 100
50 limit = 100
45 default = 20
51 default = 20
46 if request.params.get('size'):
52 if request.params.get('size'):
47 try:
53 try:
48 int_size = int(request.params.get('size'))
54 int_size = int(request.params.get('size'))
49 except ValueError:
55 except ValueError:
50 int_size = default
56 int_size = default
51 int_size = int_size if int_size <= limit else limit
57 int_size = int_size if int_size <= limit else limit
52 c.size = int_size
58 c.size = int_size
53 session['changelog_size'] = c.size
59 session['changelog_size'] = c.size
54 session.save()
60 session.save()
55 else:
61 else:
56 c.size = int(session.get('changelog_size', default))
62 c.size = int(session.get('changelog_size', default))
57
63
58 changesets = HgModel().get_repo(c.repo_name)
64 changesets = HgModel().get_repo(c.repo_name)
59
65
60 p = int(request.params.get('page', 1))
66 p = int(request.params.get('page', 1))
61 c.total_cs = len(changesets)
67 c.total_cs = len(changesets)
62 c.pagination = Page(changesets, page=p, item_count=c.total_cs,
68 c.pagination = Page(changesets, page=p, item_count=c.total_cs,
63 items_per_page=c.size)
69 items_per_page=c.size)
64
70
65 self._graph(changesets, c.size, p)
71 self._graph(changesets, c.size, p)
66
72
67 return render('changelog/changelog.html')
73 return render('changelog/changelog.html')
68
74
69
75
70 def _graph(self, repo, size, p):
76 def _graph(self, repo, size, p):
71 revcount = size
77 revcount = size
72 if not repo.revisions:return dumps([]), 0
78 if not repo.revisions:return json.dumps([]), 0
73
79
74 max_rev = repo.revisions[-1]
80 max_rev = repo.revisions[-1]
75 offset = 1 if p == 1 else ((p - 1) * revcount + 1)
81 offset = 1 if p == 1 else ((p - 1) * revcount + 1)
76 rev_start = repo.revisions[(-1 * offset)]
82 rev_start = repo.revisions[(-1 * offset)]
77
83
78 revcount = min(max_rev, revcount)
84 revcount = min(max_rev, revcount)
79 rev_end = max(0, rev_start - revcount)
85 rev_end = max(0, rev_start - revcount)
80 dag = graph_rev(repo.repo, rev_start, rev_end)
86 dag = graph_rev(repo.repo, rev_start, rev_end)
81
87
82 c.dag = tree = list(colored(dag))
88 c.dag = tree = list(colored(dag))
83 data = []
89 data = []
84 for (id, type, ctx, vtx, edges) in tree:
90 for (id, type, ctx, vtx, edges) in tree:
85 if type != CHANGESET:
91 if type != CHANGESET:
86 continue
92 continue
87 data.append(('', vtx, edges))
93 data.append(('', vtx, edges))
88
94
89 c.jsdata = dumps(data)
95 c.jsdata = json.dumps(data)
90
96
@@ -1,104 +1,108 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # encoding: utf-8
2 # encoding: utf-8
3 # summary controller for pylons
3 # summary controller for pylons
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
5 #
5 #
6 # This program is free software; you can redistribute it and/or
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; version 2
8 # as published by the Free Software Foundation; version 2
9 # of the License or (at your opinion) any later version of the license.
9 # of the License or (at your opinion) any later version of the license.
10 #
10 #
11 # This program is distributed in the hope that it will be useful,
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
14 # GNU General Public License for more details.
15 #
15 #
16 # You should have received a copy of the GNU General Public License
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 # MA 02110-1301, USA.
19 # MA 02110-1301, USA.
20 """
20 """
21 Created on April 18, 2010
21 Created on April 18, 2010
22 summary controller for pylons
22 summary controller for pylons
23 @author: marcink
23 @author: marcink
24 """
24 """
25 from pylons import tmpl_context as c, request, url
25 from pylons import tmpl_context as c, request, url
26 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
26 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
27 from rhodecode.lib.base import BaseController, render
27 from rhodecode.lib.base import BaseController, render
28 from rhodecode.lib.utils import OrderedDict
28 from rhodecode.lib.utils import OrderedDict
29 from rhodecode.model.hg_model import HgModel
29 from rhodecode.model.hg_model import HgModel
30 from rhodecode.model.db import Statistics
30 from rhodecode.model.db import Statistics
31 from webhelpers.paginate import Page
31 from webhelpers.paginate import Page
32 from rhodecode.lib.celerylib import run_task
32 from rhodecode.lib.celerylib import run_task
33 from rhodecode.lib.celerylib.tasks import get_commits_stats
33 from rhodecode.lib.celerylib.tasks import get_commits_stats
34 from datetime import datetime, timedelta
34 from datetime import datetime, timedelta
35 from time import mktime
35 from time import mktime
36 import calendar
36 import calendar
37 import logging
37 import logging
38 import json
38 try:
39 import json
40 except ImportError:
41 #python 2.5 compatibility
42 import simplejson as json
39 log = logging.getLogger(__name__)
43 log = logging.getLogger(__name__)
40
44
41 class SummaryController(BaseController):
45 class SummaryController(BaseController):
42
46
43 @LoginRequired()
47 @LoginRequired()
44 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
48 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
45 'repository.admin')
49 'repository.admin')
46 def __before__(self):
50 def __before__(self):
47 super(SummaryController, self).__before__()
51 super(SummaryController, self).__before__()
48
52
49 def index(self):
53 def index(self):
50 hg_model = HgModel()
54 hg_model = HgModel()
51 c.repo_info = hg_model.get_repo(c.repo_name)
55 c.repo_info = hg_model.get_repo(c.repo_name)
52 c.repo_changesets = Page(list(c.repo_info[:10]), page=1, items_per_page=20)
56 c.repo_changesets = Page(list(c.repo_info[:10]), page=1, items_per_page=20)
53 e = request.environ
57 e = request.environ
54
58
55 uri = u'%(protocol)s://%(user)s@%(host)s%(prefix)s/%(repo_name)s' % {
59 uri = u'%(protocol)s://%(user)s@%(host)s%(prefix)s/%(repo_name)s' % {
56 'protocol': e.get('wsgi.url_scheme'),
60 'protocol': e.get('wsgi.url_scheme'),
57 'user':str(c.rhodecode_user.username),
61 'user':str(c.rhodecode_user.username),
58 'host':e.get('HTTP_HOST'),
62 'host':e.get('HTTP_HOST'),
59 'prefix':e.get('SCRIPT_NAME'),
63 'prefix':e.get('SCRIPT_NAME'),
60 'repo_name':c.repo_name, }
64 'repo_name':c.repo_name, }
61 c.clone_repo_url = uri
65 c.clone_repo_url = uri
62 c.repo_tags = OrderedDict()
66 c.repo_tags = OrderedDict()
63 for name, hash in c.repo_info.tags.items()[:10]:
67 for name, hash in c.repo_info.tags.items()[:10]:
64 c.repo_tags[name] = c.repo_info.get_changeset(hash)
68 c.repo_tags[name] = c.repo_info.get_changeset(hash)
65
69
66 c.repo_branches = OrderedDict()
70 c.repo_branches = OrderedDict()
67 for name, hash in c.repo_info.branches.items()[:10]:
71 for name, hash in c.repo_info.branches.items()[:10]:
68 c.repo_branches[name] = c.repo_info.get_changeset(hash)
72 c.repo_branches[name] = c.repo_info.get_changeset(hash)
69
73
70 td = datetime.today() + timedelta(days=1)
74 td = datetime.today() + timedelta(days=1)
71 y, m, d = td.year, td.month, td.day
75 y, m, d = td.year, td.month, td.day
72
76
73 ts_min_y = mktime((y - 1, (td - timedelta(days=calendar.mdays[m])).month,
77 ts_min_y = mktime((y - 1, (td - timedelta(days=calendar.mdays[m])).month,
74 d, 0, 0, 0, 0, 0, 0,))
78 d, 0, 0, 0, 0, 0, 0,))
75 ts_min_m = mktime((y, (td - timedelta(days=calendar.mdays[m])).month,
79 ts_min_m = mktime((y, (td - timedelta(days=calendar.mdays[m])).month,
76 d, 0, 0, 0, 0, 0, 0,))
80 d, 0, 0, 0, 0, 0, 0,))
77
81
78 ts_max_y = mktime((y, m, d, 0, 0, 0, 0, 0, 0,))
82 ts_max_y = mktime((y, m, d, 0, 0, 0, 0, 0, 0,))
79
83
80 run_task(get_commits_stats, c.repo_info.name, ts_min_y, ts_max_y)
84 run_task(get_commits_stats, c.repo_info.name, ts_min_y, ts_max_y)
81 c.ts_min = ts_min_m
85 c.ts_min = ts_min_m
82 c.ts_max = ts_max_y
86 c.ts_max = ts_max_y
83
87
84 stats = self.sa.query(Statistics)\
88 stats = self.sa.query(Statistics)\
85 .filter(Statistics.repository == c.repo_info.dbrepo)\
89 .filter(Statistics.repository == c.repo_info.dbrepo)\
86 .scalar()
90 .scalar()
87
91
88
92
89 if stats and stats.languages:
93 if stats and stats.languages:
90 lang_stats = json.loads(stats.languages)
94 lang_stats = json.loads(stats.languages)
91 c.commit_data = stats.commit_activity
95 c.commit_data = stats.commit_activity
92 c.overview_data = stats.commit_activity_combined
96 c.overview_data = stats.commit_activity_combined
93 c.trending_languages = json.dumps(OrderedDict(
97 c.trending_languages = json.dumps(OrderedDict(
94 sorted(lang_stats.items(), reverse=True,
98 sorted(lang_stats.items(), reverse=True,
95 key=lambda k: k[1])[:2]
99 key=lambda k: k[1])[:2]
96 )
100 )
97 )
101 )
98 else:
102 else:
99 c.commit_data = json.dumps({})
103 c.commit_data = json.dumps({})
100 c.overview_data = json.dumps([[ts_min_y, 0], [ts_max_y, 0] ])
104 c.overview_data = json.dumps([[ts_min_y, 0], [ts_max_y, 0] ])
101 c.trending_languages = json.dumps({})
105 c.trending_languages = json.dumps({})
102
106
103 return render('summary/summary.html')
107 return render('summary/summary.html')
104
108
@@ -1,63 +1,26 b''
1 """SQLAlchemy Metadata and Session object"""
1 """SQLAlchemy Metadata and Session object"""
2 from sqlalchemy.ext.declarative import declarative_base
2 from sqlalchemy.ext.declarative import declarative_base
3 from sqlalchemy.orm import scoped_session, sessionmaker
3 from sqlalchemy.orm import scoped_session, sessionmaker
4 from rhodecode.model import caching_query
4 from rhodecode.model import caching_query
5 from beaker import cache
5 from beaker import cache
6 import os
7 from os.path import join as jn, dirname as dn, abspath
8 import time
9
6
10 # Beaker CacheManager. A home base for cache configurations.
7 # Beaker CacheManager. A home base for cache configurations.
11 cache_manager = cache.CacheManager()
8 cache_manager = cache.CacheManager()
12
9
13 __all__ = ['Base', 'Session']
10 __all__ = ['Base', 'Session']
14 #
11 #
15 # SQLAlchemy session manager. Updated by model.init_model()
12 # SQLAlchemy session manager. Updated by model.init_model()
16 #
13 #
17 Session = scoped_session(
14 Session = scoped_session(
18 sessionmaker(
15 sessionmaker(
19 query_cls=caching_query.query_callable(cache_manager)
16 query_cls=caching_query.query_callable(cache_manager)
20 )
17 )
21 )
18 )
22
19
23 # The declarative Base
20 # The declarative Base
24 Base = declarative_base()
21 Base = declarative_base()
25 #For another db...
22 #For another db...
26 #Base2 = declarative_base()
23 #Base2 = declarative_base()
27
24
28 #===============================================================================
29 # CACHE OPTIONS
30 #===============================================================================
31 cache_base = jn(dn(dn(dn(abspath(__file__)))), 'data')
32 cache_dir = jn(cache_base, 'cache')
33
34 if not os.path.isdir(cache_base):
35 os.mkdir(cache_base)
36
37 if not os.path.isdir(cache_dir):
38 os.mkdir(cache_dir)
39 # set start_time to current time
40 # to re-cache everything
41 # upon application startup
42 start_time = time.time()
43 # configure the "sqlalchemy" cache region.
44 cache_manager.regions['sql_cache_short'] = {
45 'type':'memory',
46 'data_dir':cache_dir,
47 'expire':10,
48 'start_time':start_time
49 }
50 cache_manager.regions['sql_cache_med'] = {
51 'type':'memory',
52 'data_dir':cache_dir,
53 'expire':360,
54 'start_time':start_time
55 }
56 cache_manager.regions['sql_cache_long'] = {
57 'type':'file',
58 'data_dir':cache_dir,
59 'expire':3600,
60 'start_time':start_time
61 }
62 #to use cache use this in query
25 #to use cache use this in query
63 #.options(FromCache("sqlalchemy_cache_type", "cachekey"))
26 #.options(FromCache("sqlalchemy_cache_type", "cachekey"))
@@ -1,34 +1,42 b''
1 [egg_info]
1 [egg_info]
2 tag_build = rc3
2 tag_build = rc4
3 tag_svn_revision = true
3 tag_svn_revision = true
4
4
5 [easy_install]
5 [easy_install]
6 find_links = http://www.pylonshq.com/download/
6 find_links = http://www.pylonshq.com/download/
7
7
8 [nosetests]
8 [nosetests]
9 verbose=True
9 verbose=True
10 verbosity=2
10 verbosity=2
11 with-pylons=test.ini
11 with-pylons=test.ini
12 detailed-errors=1
12 detailed-errors=1
13
13
14 # Babel configuration
14 # Babel configuration
15 [compile_catalog]
15 [compile_catalog]
16 domain = rhodecode
16 domain = rhodecode
17 directory = rhodecode/i18n
17 directory = rhodecode/i18n
18 statistics = true
18 statistics = true
19
19
20 [extract_messages]
20 [extract_messages]
21 add_comments = TRANSLATORS:
21 add_comments = TRANSLATORS:
22 output_file = rhodecode/i18n/rhodecode.pot
22 output_file = rhodecode/i18n/rhodecode.pot
23 width = 80
23 width = 80
24
24
25 [init_catalog]
25 [init_catalog]
26 domain = rhodecode
26 domain = rhodecode
27 input_file = rhodecode/i18n/rhodecode.pot
27 input_file = rhodecode/i18n/rhodecode.pot
28 output_dir = rhodecode/i18n
28 output_dir = rhodecode/i18n
29
29
30 [update_catalog]
30 [update_catalog]
31 domain = rhodecode
31 domain = rhodecode
32 input_file = rhodecode/i18n/rhodecode.pot
32 input_file = rhodecode/i18n/rhodecode.pot
33 output_dir = rhodecode/i18n
33 output_dir = rhodecode/i18n
34 previous = true
34 previous = true
35
36 [build_sphinx]
37 source-dir = docs/
38 build-dir = docs/_build
39 all_files = 1
40
41 [upload_sphinx]
42 upload-dir = docs/_build/html No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now