Commit b593f2b7 authored by Pascal's avatar Pascal
Browse files

add mail config

parent 6d39fdd3
......@@ -39,12 +39,14 @@ class CommitPublisher(Publisher):
commit all changes from current tree
get username from session cookie
def get_author(self):
commit = get_plugin('commit', self.env)
user = commit.current_author
return user
_plugin = None
def plugin(self):
if self._plugin is None:
self._plugin = get_plugin('commit', self.env)
return self._plugin
def get_authormail(self):
user = self.get_author()
user = self.plugin.current_author
return '%s <%s>'%(user.get('username'),user.get('email'))
def git_process(self):
yield 'done'
......@@ -58,10 +60,10 @@ class AskReviewPublisher(CommitPublisher):
commit changes and ask for review before push
def send_mail(self, address, author, status):
def send_mail(self, address, author, data):
subject = "[Review] site modifié par %s"%author
sender = 'lektor <>'
replyto = 'replyto=reviewers<>'
sender = self.plugin.mail_info.get('sender')
reply_to = "replyto=%s"%self.plugin.mail_info.get('reply_to')
cc = author
body = status.source['mail','-s',subject,'-r',sender,'-c',cc,'-S',replyto,address], input=body)
......@@ -110,14 +112,21 @@ class CommitPlugin(Plugin):
def on_setup_env(self, *args, **extra):
repo.path = self.env.root_path
self.env.add_publisher('askreview', AskReviewPublisher)
self.env.add_publisher('gitpush', GitPushPublisher)
admin_extra = get_plugin('admin-extra', self.env)
login = get_plugin('login', self.env)
self.current_author = None
config = self.get_config()
self.mail_info = {
'sender': config.get('mail.sender','<no-reply@dev.null>'),
'reply_to': config.get('mail.reply_to','<no-reply@dev.null>'),
self.env.add_publisher('askreview', AskReviewPublisher)
self.env.add_publisher('gitpush', GitPushPublisher)
#pylint: disable=unused-variable
def setup_git_bp():
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment