##// END OF EJS Templates
implements #212 moved default encoding variable into rhodecode-config. It's now possible to change...
marcink -
r2016:6020e388 beta
parent child Browse files
Show More
@@ -46,16 +46,17 b' port = 5000'
46 46 use = egg:rhodecode
47 47 full_stack = true
48 48 static_files = true
49 lang=en
49 lang = en
50 50 cache_dir = %(here)s/data
51 51 index_dir = %(here)s/data/index
52 app_instance_uuid = develop
52 app_instance_uuid = rc-develop
53 53 cut_off_limit = 256000
54 54 force_https = false
55 55 commit_parse_limit = 25
56 56 use_gravatar = true
57 57 container_auth_enabled = false
58 58 proxypass_auth_enabled = false
59 default_encoding = utf8
59 60
60 61 ## overwrite schema of clone url
61 62 ## available vars:
@@ -86,6 +87,11 b' issue_server_link = https://myissueserve'
86 87
87 88 issue_prefix = #
88 89
90 ## instance-id prefix
91 ## a prefix key for this instance used for cache invalidation when running
92 ## multiple instances of rhodecode, make sure it's globally unique for
93 ## all running rhodecode instances. Leave empty if you don't use it
94 instance_id =
89 95
90 96 ####################################
91 97 ### CELERY CONFIG ####
@@ -179,7 +185,7 b' beaker.session.auto = False'
179 185 ##true exire at browser close
180 186 #beaker.session.cookie_expires = 3600
181 187
182
188
183 189 ################################################################################
184 190 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
185 191 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
@@ -46,16 +46,17 b' port = 8001'
46 46 use = egg:rhodecode
47 47 full_stack = true
48 48 static_files = true
49 lang=en
49 lang = en
50 50 cache_dir = %(here)s/data
51 51 index_dir = %(here)s/data/index
52 app_instance_uuid = prod1234
52 app_instance_uuid = rc-production
53 53 cut_off_limit = 256000
54 force_https = false
54 force_https = false
55 55 commit_parse_limit = 50
56 56 use_gravatar = true
57 57 container_auth_enabled = false
58 58 proxypass_auth_enabled = false
59 default_encoding = utf8
59 60
60 61 ## overwrite schema of clone url
61 62 ## available vars:
@@ -86,6 +87,11 b' issue_server_link = https://myissueserve'
86 87
87 88 issue_prefix = #
88 89
90 ## instance-id prefix
91 ## a prefix key for this instance used for cache invalidation when running
92 ## multiple instances of rhodecode, make sure it's globally unique for
93 ## all running rhodecode instances. Leave empty if you don't use it
94 instance_id =
89 95
90 96 ####################################
91 97 ### CELERY CONFIG ####
@@ -165,6 +171,7 b' beaker.cache.sql_cache_long.key_length ='
165 171
166 172 beaker.session.type = file
167 173 beaker.session.key = rhodecode
174 # secure cookie requires AES python libraries
168 175 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
169 176 #beaker.session.validate_key = 9712sds2212c--zxc123
170 177 beaker.session.timeout = 36000
@@ -46,16 +46,17 b' port = 5000'
46 46 use = egg:rhodecode
47 47 full_stack = true
48 48 static_files = true
49 lang=en
49 lang = en
50 50 cache_dir = %(here)s/data
51 51 index_dir = %(here)s/data/index
52 52 app_instance_uuid = ${app_instance_uuid}
53 53 cut_off_limit = 256000
54 force_https = false
54 force_https = false
55 55 commit_parse_limit = 50
56 56 use_gravatar = true
57 57 container_auth_enabled = false
58 58 proxypass_auth_enabled = false
59 default_encoding = utf8
59 60
60 61 ## overwrite schema of clone url
61 62 ## available vars:
@@ -65,7 +66,7 b' proxypass_auth_enabled = false'
65 66 ## netloc - network location
66 67 ## path - usually repo_name
67 68
68 # clone_uri = {scheme}://{user}{pass}{netloc}{path}
69 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
69 70
70 71 ## issue tracking mapping for commits messages
71 72 ## comment out issue_pat, issue_server, issue_prefix to enable
@@ -86,6 +87,11 b' issue_server_link = https://myissueserve'
86 87
87 88 issue_prefix = #
88 89
90 ## instance-id prefix
91 ## a prefix key for this instance used for cache invalidation when running
92 ## multiple instances of rhodecode, make sure it's globally unique for
93 ## all running rhodecode instances. Leave empty if you don't use it
94 instance_id =
89 95
90 96 ####################################
91 97 ### CELERY CONFIG ####
@@ -272,13 +278,13 b' propagate = 0'
272 278 class = StreamHandler
273 279 args = (sys.stderr,)
274 280 level = INFO
275 formatter = color_formatter
281 formatter = generic
276 282
277 283 [handler_console_sql]
278 284 class = StreamHandler
279 285 args = (sys.stderr,)
280 286 level = WARN
281 formatter = color_formatter_sql
287 formatter = generic
282 288
283 289 ################
284 290 ## FORMATTERS ##
@@ -296,4 +302,4 b' datefmt = %Y-%m-%d %H:%M:%S'
296 302 [formatter_color_formatter_sql]
297 303 class=rhodecode.lib.colored_formatter.ColorFormatterSql
298 304 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
299 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
305 datefmt = %Y-%m-%d %H:%M:%S
@@ -41,12 +41,11 b' def load_environment(global_conf, app_co'
41 41
42 42 # store some globals into rhodecode
43 43 rhodecode.CELERY_ON = str2bool(config['app_conf'].get('use_celery'))
44 rhodecode.CONFIG = config
45 44
46 45 config['routes.map'] = make_map(config)
47 46 config['pylons.app_globals'] = app_globals.Globals(config)
48 47 config['pylons.h'] = rhodecode.lib.helpers
49
48 rhodecode.CONFIG = config
50 49 # Setup cache object as early as possible
51 50 import pylons
52 51 pylons.cache._push_object(config['pylons.app_globals'].cache)
@@ -59,7 +58,7 b' def load_environment(global_conf, app_co'
59 58 input_encoding='utf-8', default_filters=['escape'],
60 59 imports=['from webhelpers.html import escape'])
61 60
62 #sets the c attribute access when don't existing attribute are accessed
61 # sets the c attribute access when don't existing attribute are accessed
63 62 config['pylons.strict_tmpl_context'] = True
64 63 test = os.path.split(config['__file__'])[-1] == 'test.ini'
65 64 if test:
@@ -68,7 +67,7 b' def load_environment(global_conf, app_co'
68 67 create_test_env(TESTS_TMP_PATH, config)
69 68 create_test_index(TESTS_TMP_PATH, config, True)
70 69
71 #MULTIPLE DB configs
70 # MULTIPLE DB configs
72 71 # Setup the SQLAlchemy database engine
73 72 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.')
74 73
@@ -82,4 +81,7 b' def load_environment(global_conf, app_co'
82 81 # CONFIGURATION OPTIONS HERE (note: all config options will override
83 82 # any Pylons config options)
84 83
84 # store config reference into our module to skip import magic of
85 # pylons
86 rhodecode.CONFIG.update(config)
85 87 return config
@@ -181,7 +181,7 b' def generate_api_key(username, salt=None'
181 181 return hashlib.sha1(username + salt).hexdigest()
182 182
183 183
184 def safe_unicode(str_, from_encoding='utf8'):
184 def safe_unicode(str_, from_encoding=None):
185 185 """
186 186 safe unicode function. Does few trick to turn str_ into unicode
187 187
@@ -195,6 +195,11 b" def safe_unicode(str_, from_encoding='ut"
195 195 if isinstance(str_, unicode):
196 196 return str_
197 197
198 if not from_encoding:
199 import rhodecode
200 DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding','utf8')
201 from_encoding = DEFAULT_ENCODING
202
198 203 try:
199 204 return unicode(str_)
200 205 except UnicodeDecodeError:
@@ -215,7 +220,7 b" def safe_unicode(str_, from_encoding='ut"
215 220 return unicode(str_, from_encoding, 'replace')
216 221
217 222
218 def safe_str(unicode_, to_encoding='utf8'):
223 def safe_str(unicode_, to_encoding=None):
219 224 """
220 225 safe str function. Does few trick to turn unicode_ into string
221 226
@@ -233,6 +238,11 b" def safe_str(unicode_, to_encoding='utf8"
233 238 if isinstance(unicode_, str):
234 239 return unicode_
235 240
241 if not to_encoding:
242 import rhodecode
243 DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding','utf8')
244 to_encoding = DEFAULT_ENCODING
245
236 246 try:
237 247 return unicode_.encode(to_encoding)
238 248 except UnicodeEncodeError:
@@ -111,6 +111,7 b' class BaseController(WSGIController):'
111 111
112 112 def __before__(self):
113 113 c.rhodecode_version = __version__
114 c.rhodecode_instanceid = config.get('instance_id')
114 115 c.rhodecode_name = config.get('rhodecode_title')
115 116 c.use_gravatar = str2bool(config.get('use_gravatar'))
116 117 c.ga_code = config.get('rhodecode_ga_code')
@@ -27,7 +27,7 b' def date_fromtimestamp(unixts, tzoffset='
27 27 return datetime.datetime.fromtimestamp(float(unixts))
28 28
29 29
30 def safe_unicode(str_, from_encoding='utf8'):
30 def safe_unicode(str_, from_encoding=None):
31 31 """
32 32 safe unicode function. Does few trick to turn str_ into unicode
33 33
@@ -40,7 +40,10 b" def safe_unicode(str_, from_encoding='ut"
40 40 """
41 41 if isinstance(str_, unicode):
42 42 return str_
43
43 if not from_encoding:
44 import rhodecode
45 DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding','utf8')
46 from_encoding = DEFAULT_ENCODING
44 47 try:
45 48 return unicode(str_)
46 49 except UnicodeDecodeError:
@@ -61,7 +64,7 b" def safe_unicode(str_, from_encoding='ut"
61 64 return unicode(str_, from_encoding, 'replace')
62 65
63 66
64 def safe_str(unicode_, to_encoding='utf8'):
67 def safe_str(unicode_, to_encoding=None):
65 68 """
66 69 safe str function. Does few trick to turn unicode_ into string
67 70
@@ -75,7 +78,10 b" def safe_str(unicode_, to_encoding='utf8"
75 78
76 79 if isinstance(unicode_, str):
77 80 return unicode_
78
81 if not to_encoding:
82 import rhodecode
83 DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding','utf8')
84 to_encoding = DEFAULT_ENCODING
79 85 try:
80 86 return unicode_.encode(to_encoding)
81 87 except UnicodeEncodeError:
@@ -1034,7 +1034,12 b' class CacheInvalidation(Base, BaseModel)'
1034 1034
1035 1035 :param key:
1036 1036 """
1037 return "%s" % (key)
1037 import rhodecode
1038 prefix = ''
1039 iid = rhodecode.CONFIG.get('instance_id')
1040 if iid:
1041 prefix = iid
1042 return "%s%s" % (prefix, key)
1038 1043
1039 1044 @classmethod
1040 1045 def get_by_key(cls, key):
@@ -41,7 +41,7 b''
41 41 <a href="${h.url('bugtracker')}">${_('Submit a bug')}</a>
42 42 </p>
43 43 <p class="footer-link-right">
44 <a href="${h.url('rhodecode_official')}">RhodeCode</a>
44 <a href="${h.url('rhodecode_official')}">RhodeCode${'-%s' % c.rhodecode_instanceid if c.rhodecode_instanceid else ''}</a>
45 45 ${c.rhodecode_version} &copy; 2010-${h.datetime.today().year} by Marcin Kuzminski
46 46 </p>
47 47 </div>
@@ -221,7 +221,7 b''
221 221
222 222 %if c.readme_data:
223 223 <div class="box" style="background-color: #FAFAFA">
224 <div class="title">
224 <div id="readme" class="title">
225 225 <div class="breadcrumbs"><a href="${h.url('files_home',repo_name=c.repo_name,revision='tip',f_path=c.readme_file)}">${c.readme_file}</a></div>
226 226 </div>
227 227 <div class="readme">
General Comments 0
You need to be logged in to leave comments. Login now