##// END OF EJS Templates
some beaker cache changes, and added repr to models
marcink -
r232:37a832dc default
parent child Browse files
Show More
@@ -1,135 +1,135 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # pylons_app - Pylons environment configuration #
3 # pylons_app - 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 ##
11 ## Uncomment and replace with the address ##
12 ## which should receive any error reports ##
12 ## which should receive any error reports ##
13 ############################################
13 ############################################
14 #email_to = marcin.kuzminski@etelko.pl
14 #email_to = marcin.kuzminski@etelko.pl
15 #smtp_server = mail.etelko.pl
15 #smtp_server = mail.etelko.pl
16 #error_email_from = paste_error@localhost
16 #error_email_from = paste_error@localhost
17 #smtp_username =
17 #smtp_username =
18 #smtp_password =
18 #smtp_password =
19 #error_message = 'mercurial crash !'
19 #error_message = 'mercurial crash !'
20
20
21 [server:main]
21 [server:main]
22 ##nr of threads to spawn
22 ##nr of threads to spawn
23 threadpool_workers = 5
23 threadpool_workers = 5
24
24
25 ##max request before
25 ##max request before
26 threadpool_max_requests = 2
26 threadpool_max_requests = 2
27
27
28 ##option to use threads of process
28 ##option to use threads of process
29 use_threadpool = true
29 use_threadpool = true
30
30
31 use = egg:Paste#http
31 use = egg:Paste#http
32 host = 127.0.0.1
32 host = 127.0.0.1
33 port = 5000
33 port = 5000
34
34
35 [app:main]
35 [app:main]
36 use = egg:pylons_app
36 use = egg:pylons_app
37 full_stack = true
37 full_stack = true
38 static_files = false
38 static_files = false
39 lang=en
39 lang=en
40 cache_dir = %(here)s/data
40 cache_dir = %(here)s/data
41 ##a name for our application
41 ##a name for our application
42 hg_app_name = Python-works
42 hg_app_name = Python-works
43
43
44 ####################################
44 ####################################
45 ### BEAKER CACHE ####
45 ### BEAKER CACHE ####
46 ####################################
46 ####################################
47 beaker.cache.data_dir=/tmp/cache/data
47 beaker.cache.data_dir=/tmp/cache/data
48 beaker.cache.lock_dir=/tmp/cache/lock
48 beaker.cache.lock_dir=/tmp/cache/lock
49 beaker.cache.regions=short_term,long_term
49 beaker.cache.regions=short_term,long_term
50 beaker.cache.long_term.type=file
50 beaker.cache.long_term.type=memory
51 beaker.cache.long_term.expire=3600
51 beaker.cache.long_term.expire=36000
52 beaker.cache.short_term.type=memory
52 beaker.cache.short_term.type=memory
53 beaker.cache.short_term.expire=60
53 beaker.cache.short_term.expire=60
54
54
55 ################################################################################
55 ################################################################################
56 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
56 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
57 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
57 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
58 ## execute malicious code after an exception is raised. ##
58 ## execute malicious code after an exception is raised. ##
59 ################################################################################
59 ################################################################################
60 #set debug = false
60 #set debug = false
61
61
62 ##################################
62 ##################################
63 ### LOGVIEW CONFIG ###
63 ### LOGVIEW CONFIG ###
64 ##################################
64 ##################################
65 logview.sqlalchemy = #faa
65 logview.sqlalchemy = #faa
66 logview.pylons.templating = #bfb
66 logview.pylons.templating = #bfb
67 logview.pylons.util = #eee
67 logview.pylons.util = #eee
68
68
69 #########################################################
69 #########################################################
70 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
70 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
71 #########################################################
71 #########################################################
72 sqlalchemy.db1.url = sqlite:///%(here)s/hg_app.db
72 sqlalchemy.db1.url = sqlite:///%(here)s/hg_app.db
73 #sqlalchemy.db1.echo = False
73 #sqlalchemy.db1.echo = False
74 #sqlalchemy.db1.pool_recycle = 3600
74 #sqlalchemy.db1.pool_recycle = 3600
75 sqlalchemy.convert_unicode = true
75 sqlalchemy.convert_unicode = true
76
76
77 ################################
77 ################################
78 ### LOGGING CONFIGURATION ####
78 ### LOGGING CONFIGURATION ####
79 ################################
79 ################################
80 [loggers]
80 [loggers]
81 keys = root, routes, pylons_app, sqlalchemy
81 keys = root, routes, pylons_app, sqlalchemy
82
82
83 [handlers]
83 [handlers]
84 keys = console
84 keys = console
85
85
86 [formatters]
86 [formatters]
87 keys = generic,color_formatter
87 keys = generic,color_formatter
88
88
89 #############
89 #############
90 ## LOGGERS ##
90 ## LOGGERS ##
91 #############
91 #############
92 [logger_root]
92 [logger_root]
93 level = NOTSET
93 level = NOTSET
94 handlers = console
94 handlers = console
95
95
96 [logger_routes]
96 [logger_routes]
97 level = DEBUG
97 level = DEBUG
98 handlers = console
98 handlers = console
99 qualname = routes.middleware
99 qualname = routes.middleware
100 # "level = DEBUG" logs the route matched and routing variables.
100 # "level = DEBUG" logs the route matched and routing variables.
101
101
102 [logger_pylons_app]
102 [logger_pylons_app]
103 level = DEBUG
103 level = DEBUG
104 handlers = console
104 handlers = console
105 qualname = pylons_app
105 qualname = pylons_app
106 propagate = 0
106 propagate = 0
107
107
108 [logger_sqlalchemy]
108 [logger_sqlalchemy]
109 level = ERROR
109 level = ERROR
110 handlers = console
110 handlers = console
111 qualname = sqlalchemy.engine
111 qualname = sqlalchemy.engine
112 propagate = 0
112 propagate = 0
113
113
114 ##############
114 ##############
115 ## HANDLERS ##
115 ## HANDLERS ##
116 ##############
116 ##############
117
117
118 [handler_console]
118 [handler_console]
119 class = StreamHandler
119 class = StreamHandler
120 args = (sys.stderr,)
120 args = (sys.stderr,)
121 level = NOTSET
121 level = NOTSET
122 formatter = color_formatter
122 formatter = color_formatter
123
123
124 ################
124 ################
125 ## FORMATTERS ##
125 ## FORMATTERS ##
126 ################
126 ################
127
127
128 [formatter_generic]
128 [formatter_generic]
129 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
129 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
130 datefmt = %Y-%m-%d %H:%M:%S
130 datefmt = %Y-%m-%d %H:%M:%S
131
131
132 [formatter_color_formatter]
132 [formatter_color_formatter]
133 class=pylons_app.lib.colored_formatter.ColorFormatter
133 class=pylons_app.lib.colored_formatter.ColorFormatter
134 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
134 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
135 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
135 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,135 +1,135 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # pylons_app - Pylons environment configuration #
3 # pylons_app - 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 ##
11 ## Uncomment and replace with the address ##
12 ## which should receive any error reports ##
12 ## which should receive any error reports ##
13 ############################################
13 ############################################
14 #email_to = marcin.kuzminski@etelko.pl
14 #email_to = marcin.kuzminski@etelko.pl
15 #smtp_server = mail.etelko.pl
15 #smtp_server = mail.etelko.pl
16 #error_email_from = paste_error@localhost
16 #error_email_from = paste_error@localhost
17 #smtp_username =
17 #smtp_username =
18 #smtp_password =
18 #smtp_password =
19 #error_message = 'mercurial crash !'
19 #error_message = 'mercurial crash !'
20
20
21 [server:main]
21 [server:main]
22 ##nr of threads to spawn
22 ##nr of threads to spawn
23 threadpool_workers = 5
23 threadpool_workers = 5
24
24
25 ##max request before
25 ##max request before
26 threadpool_max_requests = 2
26 threadpool_max_requests = 2
27
27
28 ##option to use threads of process
28 ##option to use threads of process
29 use_threadpool = true
29 use_threadpool = true
30
30
31 use = egg:Paste#http
31 use = egg:Paste#http
32 host = 127.0.0.1
32 host = 127.0.0.1
33 port = 8001
33 port = 8001
34
34
35 [app:main]
35 [app:main]
36 use = egg:pylons_app
36 use = egg:pylons_app
37 full_stack = true
37 full_stack = true
38 static_files = false
38 static_files = false
39 lang=en
39 lang=en
40 cache_dir = %(here)s/data
40 cache_dir = %(here)s/data
41 ##a name for our application
41 ##a name for our application
42 hg_app_name = Python-works
42 hg_app_name = Python-works
43
43
44 ####################################
44 ####################################
45 ### BEAKER CACHE ####
45 ### BEAKER CACHE ####
46 ####################################
46 ####################################
47 beaker.cache.data_dir=/tmp/cache/data
47 beaker.cache.data_dir=/tmp/cache/data
48 beaker.cache.lock_dir=/tmp/cache/lock
48 beaker.cache.lock_dir=/tmp/cache/lock
49 beaker.cache.regions=short_term,long_term
49 beaker.cache.regions=short_term,long_term
50 beaker.cache.long_term.type=file
50 beaker.cache.long_term.type=memory
51 beaker.cache.long_term.expire=3600
51 beaker.cache.long_term.expire=36000
52 beaker.cache.short_term.type=memory
52 beaker.cache.short_term.type=memory
53 beaker.cache.short_term.expire=60
53 beaker.cache.short_term.expire=60
54
54
55 ################################################################################
55 ################################################################################
56 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
56 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
57 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
57 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
58 ## execute malicious code after an exception is raised. ##
58 ## execute malicious code after an exception is raised. ##
59 ################################################################################
59 ################################################################################
60 set debug = false
60 set debug = false
61
61
62 ##################################
62 ##################################
63 ### LOGVIEW CONFIG ###
63 ### LOGVIEW CONFIG ###
64 ##################################
64 ##################################
65 logview.sqlalchemy = #faa
65 logview.sqlalchemy = #faa
66 logview.pylons.templating = #bfb
66 logview.pylons.templating = #bfb
67 logview.pylons.util = #eee
67 logview.pylons.util = #eee
68
68
69 #########################################################
69 #########################################################
70 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
70 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
71 #########################################################
71 #########################################################
72 sqlalchemy.db1.url = sqlite:///%(here)s/hg_app.db
72 sqlalchemy.db1.url = sqlite:///%(here)s/hg_app.db
73 #sqlalchemy.db1.echo = False
73 #sqlalchemy.db1.echo = False
74 #sqlalchemy.db1.pool_recycle = 3600
74 #sqlalchemy.db1.pool_recycle = 3600
75 sqlalchemy.convert_unicode = true
75 sqlalchemy.convert_unicode = true
76
76
77 ################################
77 ################################
78 ### LOGGING CONFIGURATION ####
78 ### LOGGING CONFIGURATION ####
79 ################################
79 ################################
80 [loggers]
80 [loggers]
81 keys = root, routes, pylons_app, sqlalchemy
81 keys = root, routes, pylons_app, sqlalchemy
82
82
83 [handlers]
83 [handlers]
84 keys = console
84 keys = console
85
85
86 [formatters]
86 [formatters]
87 keys = generic,color_formatter
87 keys = generic,color_formatter
88
88
89 #############
89 #############
90 ## LOGGERS ##
90 ## LOGGERS ##
91 #############
91 #############
92 [logger_root]
92 [logger_root]
93 level = INFO
93 level = INFO
94 handlers = console
94 handlers = console
95
95
96 [logger_routes]
96 [logger_routes]
97 level = INFO
97 level = INFO
98 handlers = console
98 handlers = console
99 qualname = routes.middleware
99 qualname = routes.middleware
100 # "level = DEBUG" logs the route matched and routing variables.
100 # "level = DEBUG" logs the route matched and routing variables.
101
101
102 [logger_pylons_app]
102 [logger_pylons_app]
103 level = DEBUG
103 level = DEBUG
104 handlers = console
104 handlers = console
105 qualname = pylons_app
105 qualname = pylons_app
106 propagate = 0
106 propagate = 0
107
107
108 [logger_sqlalchemy]
108 [logger_sqlalchemy]
109 level = ERROR
109 level = ERROR
110 handlers = console
110 handlers = console
111 qualname = sqlalchemy.engine
111 qualname = sqlalchemy.engine
112 propagate = 0
112 propagate = 0
113
113
114 ##############
114 ##############
115 ## HANDLERS ##
115 ## HANDLERS ##
116 ##############
116 ##############
117
117
118 [handler_console]
118 [handler_console]
119 class = StreamHandler
119 class = StreamHandler
120 args = (sys.stderr,)
120 args = (sys.stderr,)
121 level = NOTSET
121 level = NOTSET
122 formatter = color_formatter
122 formatter = color_formatter
123
123
124 ################
124 ################
125 ## FORMATTERS ##
125 ## FORMATTERS ##
126 ################
126 ################
127
127
128 [formatter_generic]
128 [formatter_generic]
129 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
129 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
130 datefmt = %Y-%m-%d %H:%M:%S
130 datefmt = %Y-%m-%d %H:%M:%S
131
131
132 [formatter_color_formatter]
132 [formatter_color_formatter]
133 class=pylons_app.lib.colored_formatter.ColorFormatter
133 class=pylons_app.lib.colored_formatter.ColorFormatter
134 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
134 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
135 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
135 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,35 +1,29 b''
1 from pylons import tmpl_context as c, app_globals as g, session, request, config, \
1 from pylons import tmpl_context as c, request
2 url
3 from pylons.controllers.util import abort, redirect
4 from pylons_app.lib.auth import LoginRequired
2 from pylons_app.lib.auth import LoginRequired
5 from pylons_app.lib.base import BaseController, render
3 from pylons_app.lib.base import BaseController, render, _full_changelog_cached
6 from pylons_app.lib.utils import get_repo_slug
7 from pylons_app.model.hg_model import HgModel
4 from pylons_app.model.hg_model import HgModel
8 import logging
5 import logging
9
6
10
11 log = logging.getLogger(__name__)
7 log = logging.getLogger(__name__)
12
8
13 class SummaryController(BaseController):
9 class SummaryController(BaseController):
14
10
15 @LoginRequired()
11 @LoginRequired()
16 def __before__(self):
12 def __before__(self):
17 super(SummaryController, self).__before__()
13 super(SummaryController, self).__before__()
18
14
19 def index(self):
15 def index(self):
20 hg_model = HgModel()
16 hg_model = HgModel()
21 c.repo_info = hg_model.get_repo(c.repo_name)
17 c.repo_info = hg_model.get_repo(c.repo_name)
22 c.repo_changesets = c.repo_info.get_changesets(10)
18 c.repo_changesets = _full_changelog_cached(c.repo_name)[:10]
23
19
24 e = request.environ
20 e = request.environ
25 #BUG: protocol doesnt show https
26 uri = u'%(protocol)s://%(user)s@%(host)s/%(repo_name)s' % {
21 uri = u'%(protocol)s://%(user)s@%(host)s/%(repo_name)s' % {
27 'protocol': e.get('wsgi.url_scheme'),
22 'protocol': e.get('wsgi.url_scheme'),
28 'user':str(c.hg_app_user.username),
23 'user':str(c.hg_app_user.username),
29 'host':e.get('HTTP_HOST'),
24 'host':e.get('HTTP_HOST'),
30 'repo_name':c.repo_name,
25 'repo_name':c.repo_name, }
31 }
32 c.clone_repo_url = uri
26 c.clone_repo_url = uri
33 c.repo_tags = c.repo_info.tags[:10]
27 c.repo_tags = c.repo_info.tags[:10]
34 c.repo_branches = c.repo_info.branches[:10]
28 c.repo_branches = c.repo_info.branches[:10]
35 return render('summary/summary.html')
29 return render('summary/summary.html')
@@ -1,36 +1,42 b''
1 from pylons_app.model.meta import Base
1 from pylons_app.model.meta import Base
2 from sqlalchemy.orm import relation, backref
2 from sqlalchemy.orm import relation, backref
3 from sqlalchemy import *
3 from sqlalchemy import *
4
4
5 class Users(Base):
5 class Users(Base):
6 __tablename__ = 'users'
6 __tablename__ = 'users'
7 __table_args__ = {'useexisting':True}
7 __table_args__ = {'useexisting':True}
8 user_id = Column("user_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=1)
8 user_id = Column("user_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=1)
9 username = Column("username", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
9 username = Column("username", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
10 password = Column("password", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
10 password = Column("password", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
11 active = Column("active", BOOLEAN(), nullable=True, unique=None, default=None)
11 active = Column("active", BOOLEAN(), nullable=True, unique=None, default=None)
12 admin = Column("admin", BOOLEAN(), nullable=True, unique=None, default=None)
12 admin = Column("admin", BOOLEAN(), nullable=True, unique=None, default=None)
13 name = Column("name", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
13 name = Column("name", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
14 lastname = Column("lastname", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
14 lastname = Column("lastname", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
15 email = Column("email", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
15 email = Column("email", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
16 last_login = Column("last_login", DATETIME(timezone=False), nullable=True, unique=None, default=None)
16 last_login = Column("last_login", DATETIME(timezone=False), nullable=True, unique=None, default=None)
17
17
18 user_log = relation('UserLogs')
18 user_log = relation('UserLogs')
19
20 def __repr__(self):
21 return "<User('%s:%s')>" % (self.user_id, self.username)
19
22
20 class UserLogs(Base):
23 class UserLogs(Base):
21 __tablename__ = 'user_logs'
24 __tablename__ = 'user_logs'
22 __table_args__ = {'useexisting':True}
25 __table_args__ = {'useexisting':True}
23 user_log_id = Column("id", INTEGER(), nullable=False, unique=True, default=None, primary_key=1)
26 user_log_id = Column("id", INTEGER(), nullable=False, unique=True, default=None, primary_key=1)
24 user_id = Column("user_id", INTEGER(), ForeignKey(u'users.user_id'), nullable=True, unique=None, default=None)
27 user_id = Column("user_id", INTEGER(), ForeignKey(u'users.user_id'), nullable=True, unique=None, default=None)
25 repository = Column("repository", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
28 repository = Column("repository", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
26 action = Column("action", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
29 action = Column("action", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
27 action_date = Column("action_date", DATETIME(timezone=False), nullable=True, unique=None, default=None)
30 action_date = Column("action_date", DATETIME(timezone=False), nullable=True, unique=None, default=None)
28
31
29 user = relation('Users')
32 user = relation('Users')
30
33
31
34
32 class Permissions(Base):
35 class Permissions(Base):
33 __tablename__ = 'permissions'
36 __tablename__ = 'permissions'
34 __table_args__ = {'useexisting':True}
37 __table_args__ = {'useexisting':True}
35 permission_id = Column("id", INTEGER(), nullable=False, unique=True, default=None, primary_key=1)
38 permission_id = Column("id", INTEGER(), nullable=False, unique=True, default=None, primary_key=1)
36 permission_name = Column("permission_name", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
39 permission_name = Column("permission_name", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
40
41 def __repr__(self):
42 return "<Permission('%s:%s')>" % (self.permission_id, self.permission_name)
General Comments 0
You need to be logged in to leave comments. Login now