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