-{% endblock %}}
+{% endblock %}
diff --git a/kallithea/bin/kallithea_cli_config.py b/kallithea/bin/kallithea_cli_config.py
--- a/kallithea/bin/kallithea_cli_config.py
+++ b/kallithea/bin/kallithea_cli_config.py
@@ -62,6 +62,7 @@ def config_create(config_file, key_value
"""
mako_variable_values = {
+ 'version': kallithea.__version__,
'git_hook_interpreter': sys.executable,
'user_home_path': os.path.expanduser('~'),
'kallithea_cli_path': cli_base.kallithea_cli_path,
diff --git a/kallithea/lib/auth_modules/auth_crowd.py b/kallithea/lib/auth_modules/auth_crowd.py
--- a/kallithea/lib/auth_modules/auth_crowd.py
+++ b/kallithea/lib/auth_modules/auth_crowd.py
@@ -78,42 +78,26 @@ class CrowdServer(object):
handler = urllib.request.HTTPBasicAuthHandler(mgr)
self.opener = urllib.request.build_opener(handler)
- def _request(self, url, body=None, headers=None,
- method=None, noformat=False,
- empty_response_ok=False):
+ def _request(self, url, body=None):
_headers = {"Content-type": "application/json",
"Accept": "application/json"}
if self.user and self.passwd:
authstring = ascii_str(base64.b64encode(safe_bytes("%s:%s" % (self.user, self.passwd))))
_headers["Authorization"] = "Basic %s" % authstring
- if headers:
- _headers.update(headers)
log.debug("Sent to crowd at %s:\nHeaders: %s\nBody:\n%s", url, _headers, body)
req = urllib.request.Request(url, body, _headers)
- if method:
- req.get_method = lambda: method
global msg
- msg = ""
+ msg = None
try:
rdoc = self.opener.open(req)
- msg = "".join(rdoc.readlines())
- if not msg and empty_response_ok:
- rval = {}
- rval["status"] = True
- rval["error"] = "Response body was empty"
- elif not noformat:
- rval = ext_json.loads(msg)
- rval["status"] = True
- else:
- rval = "".join(rdoc.readlines())
+ msg = rdoc.read()
+ rval = ext_json.loads(msg)
+ rval["status"] = True
except Exception as e:
- if not noformat:
- rval = {"status": False,
- "body": body,
- "error": str(e) + "\n" + msg}
- else:
- rval = None
+ rval = {"status": False,
+ "body": body,
+ "error": "%s\n%r" % (e, msg)}
return rval
def user_auth(self, username, password):
diff --git a/kallithea/lib/inifile.py b/kallithea/lib/inifile.py
--- a/kallithea/lib/inifile.py
+++ b/kallithea/lib/inifile.py
@@ -40,6 +40,7 @@ default_variables = {
'host': '127.0.0.1',
'port': '5000',
'uuid': lambda: 'VERY-SECRET',
+ 'version': '',
}
variable_options = {
diff --git a/kallithea/lib/paster_commands/template.ini.mako b/kallithea/lib/paster_commands/template.ini.mako
--- a/kallithea/lib/paster_commands/template.ini.mako
+++ b/kallithea/lib/paster_commands/template.ini.mako
@@ -1,59 +1,60 @@
## -*- coding: utf-8 -*-
-<%text>###################################################################################%text>
-<%text>###################################################################################%text>
-<%text>## Kallithea config file generated with kallithea-config ##%text>
-<%text>## ##%text>
-<%text>## The %(here)s variable will be replaced with the parent directory of this file ##%text>
-<%text>###################################################################################%text>
-<%text>###################################################################################%text>
+<%text>##%text>#################################################################################
+<%text>##%text>#################################################################################
+<%text>##%text> Kallithea config file generated with kallithea-cli ${'%-27s' % version }##
+<%text>##%text> ##
+<%text>##%text> The %(here)s variable will generally be replaced with the parent directory of ##
+<%text>##%text> this file. Other use of % must be escaped as %% . ##
+<%text>##%text>#################################################################################
+<%text>##%text>#################################################################################
[DEFAULT]
-<%text>################################################################################%text>
-<%text>## Email settings ##%text>
-<%text>## ##%text>
-<%text>## Refer to the documentation ("Email settings") for more details. ##%text>
-<%text>## ##%text>
-<%text>## It is recommended to use a valid sender address that passes access ##%text>
-<%text>## validation and spam filtering in mail servers. ##%text>
-<%text>################################################################################%text>
+<%text>##%text>##############################################################################
+<%text>##%text> Email settings ##
+<%text>##%text> ##
+<%text>##%text> Refer to the documentation ("Email settings") for more details. ##
+<%text>##%text> ##
+<%text>##%text> It is recommended to use a valid sender address that passes access ##
+<%text>##%text> validation and spam filtering in mail servers. ##
+<%text>##%text>##############################################################################
-<%text>## 'From' header for application emails. You can optionally add a name.%text>
-<%text>## Default:%text>
+<%text>##%text> 'From' header for application emails. You can optionally add a name.
+<%text>##%text> Default:
#app_email_from = Kallithea
-<%text>## Examples:%text>
+<%text>##%text> Examples:
#app_email_from = Kallithea