Mercurial > kallithea
changeset 2016:6020e3884a58 beta
implements #212 moved default encoding variable into rhodecode-config. It's now possible to change
default utf8 to some other encoding.
- also added instance-id to config
- update ini files
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 22 Feb 2012 04:30:26 +0200 |
parents | 5415d0de5970 |
children | 03a549b35c57 |
files | development.ini production.ini rhodecode/config/deployment.ini_tmpl rhodecode/config/environment.py rhodecode/lib/__init__.py rhodecode/lib/base.py rhodecode/lib/vcs/utils/__init__.py rhodecode/model/db.py rhodecode/templates/base/base.html rhodecode/templates/summary/summary.html |
diffstat | 10 files changed, 68 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/development.ini Wed Feb 22 04:11:29 2012 +0200 +++ b/development.ini Wed Feb 22 04:30:26 2012 +0200 @@ -46,16 +46,17 @@ use = egg:rhodecode full_stack = true static_files = true -lang=en +lang = en cache_dir = %(here)s/data index_dir = %(here)s/data/index -app_instance_uuid = develop +app_instance_uuid = rc-develop cut_off_limit = 256000 force_https = false commit_parse_limit = 25 use_gravatar = true container_auth_enabled = false proxypass_auth_enabled = false +default_encoding = utf8 ## overwrite schema of clone url ## available vars: @@ -86,6 +87,11 @@ issue_prefix = # +## instance-id prefix +## a prefix key for this instance used for cache invalidation when running +## multiple instances of rhodecode, make sure it's globally unique for +## all running rhodecode instances. Leave empty if you don't use it +instance_id = #################################### ### CELERY CONFIG #### @@ -179,7 +185,7 @@ ##true exire at browser close #beaker.session.cookie_expires = 3600 - + ################################################################################ ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
--- a/production.ini Wed Feb 22 04:11:29 2012 +0200 +++ b/production.ini Wed Feb 22 04:30:26 2012 +0200 @@ -46,16 +46,17 @@ use = egg:rhodecode full_stack = true static_files = true -lang=en +lang = en cache_dir = %(here)s/data index_dir = %(here)s/data/index -app_instance_uuid = prod1234 +app_instance_uuid = rc-production cut_off_limit = 256000 -force_https = false +force_https = false commit_parse_limit = 50 use_gravatar = true container_auth_enabled = false proxypass_auth_enabled = false +default_encoding = utf8 ## overwrite schema of clone url ## available vars: @@ -86,6 +87,11 @@ issue_prefix = # +## instance-id prefix +## a prefix key for this instance used for cache invalidation when running +## multiple instances of rhodecode, make sure it's globally unique for +## all running rhodecode instances. Leave empty if you don't use it +instance_id = #################################### ### CELERY CONFIG #### @@ -165,6 +171,7 @@ beaker.session.type = file beaker.session.key = rhodecode +# secure cookie requires AES python libraries #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu #beaker.session.validate_key = 9712sds2212c--zxc123 beaker.session.timeout = 36000
--- a/rhodecode/config/deployment.ini_tmpl Wed Feb 22 04:11:29 2012 +0200 +++ b/rhodecode/config/deployment.ini_tmpl Wed Feb 22 04:30:26 2012 +0200 @@ -46,16 +46,17 @@ use = egg:rhodecode full_stack = true static_files = true -lang=en +lang = en cache_dir = %(here)s/data index_dir = %(here)s/data/index app_instance_uuid = ${app_instance_uuid} cut_off_limit = 256000 -force_https = false +force_https = false commit_parse_limit = 50 use_gravatar = true container_auth_enabled = false proxypass_auth_enabled = false +default_encoding = utf8 ## overwrite schema of clone url ## available vars: @@ -65,7 +66,7 @@ ## netloc - network location ## path - usually repo_name -# clone_uri = {scheme}://{user}{pass}{netloc}{path} +#clone_uri = {scheme}://{user}{pass}{netloc}{path} ## issue tracking mapping for commits messages ## comment out issue_pat, issue_server, issue_prefix to enable @@ -86,6 +87,11 @@ issue_prefix = # +## instance-id prefix +## a prefix key for this instance used for cache invalidation when running +## multiple instances of rhodecode, make sure it's globally unique for +## all running rhodecode instances. Leave empty if you don't use it +instance_id = #################################### ### CELERY CONFIG #### @@ -272,13 +278,13 @@ class = StreamHandler args = (sys.stderr,) level = INFO -formatter = color_formatter +formatter = generic [handler_console_sql] class = StreamHandler args = (sys.stderr,) level = WARN -formatter = color_formatter_sql +formatter = generic ################ ## FORMATTERS ## @@ -296,4 +302,4 @@ [formatter_color_formatter_sql] class=rhodecode.lib.colored_formatter.ColorFormatterSql format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s -datefmt = %Y-%m-%d %H:%M:%S \ No newline at end of file +datefmt = %Y-%m-%d %H:%M:%S
--- a/rhodecode/config/environment.py Wed Feb 22 04:11:29 2012 +0200 +++ b/rhodecode/config/environment.py Wed Feb 22 04:30:26 2012 +0200 @@ -41,12 +41,11 @@ # store some globals into rhodecode rhodecode.CELERY_ON = str2bool(config['app_conf'].get('use_celery')) - rhodecode.CONFIG = config config['routes.map'] = make_map(config) config['pylons.app_globals'] = app_globals.Globals(config) config['pylons.h'] = rhodecode.lib.helpers - + rhodecode.CONFIG = config # Setup cache object as early as possible import pylons pylons.cache._push_object(config['pylons.app_globals'].cache) @@ -59,7 +58,7 @@ input_encoding='utf-8', default_filters=['escape'], imports=['from webhelpers.html import escape']) - #sets the c attribute access when don't existing attribute are accessed + # sets the c attribute access when don't existing attribute are accessed config['pylons.strict_tmpl_context'] = True test = os.path.split(config['__file__'])[-1] == 'test.ini' if test: @@ -68,7 +67,7 @@ create_test_env(TESTS_TMP_PATH, config) create_test_index(TESTS_TMP_PATH, config, True) - #MULTIPLE DB configs + # MULTIPLE DB configs # Setup the SQLAlchemy database engine sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.') @@ -82,4 +81,7 @@ # CONFIGURATION OPTIONS HERE (note: all config options will override # any Pylons config options) + # store config reference into our module to skip import magic of + # pylons + rhodecode.CONFIG.update(config) return config
--- a/rhodecode/lib/__init__.py Wed Feb 22 04:11:29 2012 +0200 +++ b/rhodecode/lib/__init__.py Wed Feb 22 04:30:26 2012 +0200 @@ -181,7 +181,7 @@ return hashlib.sha1(username + salt).hexdigest() -def safe_unicode(str_, from_encoding='utf8'): +def safe_unicode(str_, from_encoding=None): """ safe unicode function. Does few trick to turn str_ into unicode @@ -195,6 +195,11 @@ if isinstance(str_, unicode): return str_ + if not from_encoding: + import rhodecode + DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding','utf8') + from_encoding = DEFAULT_ENCODING + try: return unicode(str_) except UnicodeDecodeError: @@ -215,7 +220,7 @@ return unicode(str_, from_encoding, 'replace') -def safe_str(unicode_, to_encoding='utf8'): +def safe_str(unicode_, to_encoding=None): """ safe str function. Does few trick to turn unicode_ into string @@ -233,6 +238,11 @@ if isinstance(unicode_, str): return unicode_ + if not to_encoding: + import rhodecode + DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding','utf8') + to_encoding = DEFAULT_ENCODING + try: return unicode_.encode(to_encoding) except UnicodeEncodeError:
--- a/rhodecode/lib/base.py Wed Feb 22 04:11:29 2012 +0200 +++ b/rhodecode/lib/base.py Wed Feb 22 04:30:26 2012 +0200 @@ -111,6 +111,7 @@ def __before__(self): c.rhodecode_version = __version__ + c.rhodecode_instanceid = config.get('instance_id') c.rhodecode_name = config.get('rhodecode_title') c.use_gravatar = str2bool(config.get('use_gravatar')) c.ga_code = config.get('rhodecode_ga_code')
--- a/rhodecode/lib/vcs/utils/__init__.py Wed Feb 22 04:11:29 2012 +0200 +++ b/rhodecode/lib/vcs/utils/__init__.py Wed Feb 22 04:30:26 2012 +0200 @@ -27,7 +27,7 @@ return datetime.datetime.fromtimestamp(float(unixts)) -def safe_unicode(str_, from_encoding='utf8'): +def safe_unicode(str_, from_encoding=None): """ safe unicode function. Does few trick to turn str_ into unicode @@ -40,7 +40,10 @@ """ if isinstance(str_, unicode): return str_ - + if not from_encoding: + import rhodecode + DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding','utf8') + from_encoding = DEFAULT_ENCODING try: return unicode(str_) except UnicodeDecodeError: @@ -61,7 +64,7 @@ return unicode(str_, from_encoding, 'replace') -def safe_str(unicode_, to_encoding='utf8'): +def safe_str(unicode_, to_encoding=None): """ safe str function. Does few trick to turn unicode_ into string @@ -75,7 +78,10 @@ if isinstance(unicode_, str): return unicode_ - + if not to_encoding: + import rhodecode + DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding','utf8') + to_encoding = DEFAULT_ENCODING try: return unicode_.encode(to_encoding) except UnicodeEncodeError:
--- a/rhodecode/model/db.py Wed Feb 22 04:11:29 2012 +0200 +++ b/rhodecode/model/db.py Wed Feb 22 04:30:26 2012 +0200 @@ -1034,7 +1034,12 @@ :param key: """ - return "%s" % (key) + import rhodecode + prefix = '' + iid = rhodecode.CONFIG.get('instance_id') + if iid: + prefix = iid + return "%s%s" % (prefix, key) @classmethod def get_by_key(cls, key):
--- a/rhodecode/templates/base/base.html Wed Feb 22 04:11:29 2012 +0200 +++ b/rhodecode/templates/base/base.html Wed Feb 22 04:30:26 2012 +0200 @@ -41,7 +41,7 @@ <a href="${h.url('bugtracker')}">${_('Submit a bug')}</a> </p> <p class="footer-link-right"> - <a href="${h.url('rhodecode_official')}">RhodeCode</a> + <a href="${h.url('rhodecode_official')}">RhodeCode${'-%s' % c.rhodecode_instanceid if c.rhodecode_instanceid else ''}</a> ${c.rhodecode_version} © 2010-${h.datetime.today().year} by Marcin Kuzminski </p> </div>
--- a/rhodecode/templates/summary/summary.html Wed Feb 22 04:11:29 2012 +0200 +++ b/rhodecode/templates/summary/summary.html Wed Feb 22 04:30:26 2012 +0200 @@ -221,7 +221,7 @@ %if c.readme_data: <div class="box" style="background-color: #FAFAFA"> - <div class="title"> + <div id="readme" class="title"> <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> </div> <div class="readme">