Esempio n. 1
0
    def deploy_task(self, project_info, notice_info):

        if notice_info['repo_mode'] == ProjectModel.repo_mode_tag:
            version = notice_info['tag']
        else:
            version = '%s/%s' % (notice_info['branch'], notice_info['commit'])

        '''
        上线单新建, 上线完成, 上线失败

        @param hook:
        @param notice_info:
            'title',
            'username',
            'project_name',
            'task_name',
            'branch',
            'commit',
            'is_branch',
        @return:
        '''
        message = """ %s %s 
                <br><br> <strong>项目</strong>:%s
                <br><br> <strong>任务</strong>:%s
                <br><br> <strong>分支</strong>:%s
                <br><br><br><img src='http://walle-web.io/dingding.jpg'> """ % (
                notice_info['username'], notice_info['title'], notice_info['project_name'], notice_info['task_name'],
                version)
        emails.send_email(project_info['notice_hook'], notice_info['title'], message, '')
Esempio n. 2
0
    def deploy_task(self, project_info, notice_info):

        if notice_info['repo_mode'] == ProjectModel.repo_mode_tag:
            version = notice_info['tag']
        else:
            version = '%s/%s' % (notice_info['branch'], notice_info['commit'])
        '''
        上线单新建, 上线完成, 上线失败

        @param hook:
        @param notice_info:
            'title',
            'username',
            'project_name',
            'task_name',
            'branch',
            'commit',
            'is_branch',
        @return:
        '''
        message = """ %s %s 
                <br><br> <strong>项目</strong>:%s
                <br><br> <strong>任务</strong>:%s
                <br><br> <strong>分支</strong>:%s
                <br><br><br><img src='http://walle-web.io/dingding.jpg'> """ % (
            notice_info['username'], notice_info['title'],
            notice_info['project_name'], notice_info['task_name'], version)
        emails.send_email(project_info['notice_hook'], notice_info['title'],
                          message, '')
Esempio n. 3
0
    def create_user(self):
        form = RegistrationForm(request.form, csrf_enabled=False)
        if form.validate_on_submit():
            user_info = form.form2dict()
            # add user
            user = UserModel().add(user_info)
            # send an email
            message = u"""Hi, %s
                    <br> <br>Welcome to walle, it cost a lot of time and lock to meet you, enjoy it : )
                    <br><br>name: %s<br>password: %s""" \
                              % (user.username, user.email, form.password.data)
            emails.send_email(user.email, 'Welcome to walle', message, '')

            return self.render_json(data=user.item(user_id=user.id))
        return self.render_error(code=Code.form_error, message=form.errors)
Esempio n. 4
0
    def create_user(self):
        form = RegistrationForm(request.form, csrf=False)
        if form.validate_on_submit():
            user_info = form.form2dict()
            # add user
            user = UserModel().add(user_info)
            # send an email
            message = """Hi, %s
                    <br> <br>Welcome to walle, it cost a lot of time and lock to meet you, enjoy it : )
                    <br><br>name: %s<br>password: %s""" \
                              % (user.username, user.email, form.password.data)
            emails.send_email(user.email, 'Welcome to walle', message, '')

            return self.render_json(data=user.item(user_id=user.id))
        return self.render_error(code=Code.form_error, message=form.errors)
Esempio n. 5
0
 def mail(self):
     ret = emails.send_email('*****@*****.**',
                             'email from [email protected]', 'xxxxxxx',
                             'yyyyyyy')
     return self.render_json(data={
         'avatar': 'emails.send_email',
         'done': ret,
     })
Esempio n. 6
0
    def create_user(self):
        form = RegistrationForm(request.form, csrf=False)
        if form.validate_on_submit():
            user_info = form.form2dict()
            # add user
            user = UserModel().add(user_info)
            # send an email
            message = """Hi, %s
                    <br> <br>Welcome to walle, it cost a lot of time and lock to meet you, enjoy it : )
                    <br><br>name: %s<br>password: %s""" \
                              % (user.username, user.email, form.password.data)

            try:
                emails.send_email(user.email, 'Welcome to walle', message, '')
            except Exception as e:
                # todo, response error message to the front.
                current_app.logger.warning(e)

            return self.render_json(data=user.item(user_id=user.id))
        return self.render_error(code=Code.form_error, message=form.errors)
Esempio n. 7
0
    def deploy_task(self, project_info, notice_info):
        '''
        上线单新建, 上线完成, 上线失败

        @param hook:
        @param notice_info:
            'title',
            'username',
            'project_name',
            'task_name',
            'branch',
            'commit',
            'is_branch',
        @return:
        '''
        message = u""" %s %s 
                <br><br> <strong>项目</strong>:%s
                <br><br> <strong>任务</strong>:%s
                <br><br> <strong>分支</strong>:%s
                <br><br> <strong>版本</strong>:%s
                <br><br><br><img src='http://walle-web.io/dingding.jpg'> """ % (
                notice_info['username'], notice_info['title'], notice_info['project_name'], notice_info['task_name'],
                notice_info['branch'], notice_info['commit'])
        emails.send_email(project_info['notice_hook'], notice_info['title'], message, '')
Esempio n. 8
0
    def deploy_task(self, project_info, notice_info):
        '''
        上线单新建, 上线完成, 上线失败

        @param hook:
        @param notice_info:
            'title',
            'username',
            'project_name',
            'task_name',
            'branch',
            'commit',
            'is_branch',
        @return:
        '''
        message = """ %s %s 
                <br><br> <strong>项目</strong>:%s
                <br><br> <strong>任务</strong>:%s
                <br><br> <strong>分支</strong>:%s
                <br><br> <strong>版本</strong>:%s
                <br><br><br><img src='http://walle-web.io/dingding.jpg'> """ % (
                notice_info['username'], notice_info['title'], notice_info['project_name'], notice_info['task_name'],
                notice_info['branch'], notice_info['commit'])
        emails.send_email(project_info['notice_hook'], notice_info['title'], message, '')
Esempio n. 9
0
 def mail(self):
     ret = emails.send_email('*****@*****.**', 'email from [email protected]', 'xxxxxxx', 'yyyyyyy')
     return self.render_json(data={
         'avatar': 'emails.send_email',
         'done': ret,
     })