##// END OF EJS Templates
added custom messages for remote responses.
marcink -
r257:66f617f1 default
parent child Browse files
Show More
@@ -37,6 +37,7 b' from pylons_app.model.db import UserLog,'
37 37 from webob.exc import HTTPNotFound
38 38 import logging
39 39 import os
40 from itertools import chain
40 41 log = logging.getLogger(__name__)
41 42
42 43 class SimpleHg(object):
@@ -89,8 +90,24 b' class SimpleHg(object):'
89 90 if action:
90 91 username = self.__get_environ_user(environ)
91 92 self.__log_user_action(username, action, repo_name)
92
93 return app(environ, start_response)
93 messages = ['thanks for using hg app !']
94 return self.msg_wrapper(app, environ, start_response, messages)
95
96
97 def msg_wrapper(self, app, environ, start_response, messages):
98 """
99 Wrapper for custom messages that come out of mercurial respond messages
100 is a list of messages that the user will see at the end of response from
101 merurial protocol actions that involves remote answers
102 @param app:
103 @param environ:
104 @param start_response:
105 """
106 def custom_messages(msg_list):
107 for msg in msg_list:
108 yield msg + '\n'
109 org_response = app(environ, start_response)
110 return chain(org_response, custom_messages(messages))
94 111
95 112 def __make_app(self):
96 113 hgserve = hgweb(self.repo_path)
General Comments 0
You need to be logged in to leave comments. Login now