Esempio n. 1
0
    def save(self):
        request = self.request

        model_state = self.model_state

        model_state.schema = SuggestionSchema()

        if not model_state.validate():
            log.debug('validation error')
            request.errors = model_state.errors()
            return {}

        with request.connmgr.get_connection() as conn:
            sql = '''
				Declare @RC int, @ErrMsg nvarchar(500)
				EXEC @RC = sp_Suggest ?, ?, @ErrMsg=@ErrMsg OUTPUT

				SELECT @RC AS [Return], @ErrMsg AS ErrMsg'''
            result = conn.execute(sql, request.user.Email,
                                  model_state.value('Suggestion')).fetchone()

        if result.Return:
            model_state.add_error_for('*', result.ErrMsg)
            return self._get_edit_info()

        with request.connmgr.get_connection() as conn:
            addresses = conn.execute('EXEC sp_User_Admin_l').fetchall()

        if addresses:
            email_msg = new_suggestion_email_template % {
                'Email': request.user.Email,
                'Suggestion': model_state.value('Suggestion')
            }

            send_email(request,
                       '*****@*****.**', [x.Email for x in addresses],
                       'New Feature Suggestion',
                       email_msg,
                       reply=request.user.Email)

        request.session.flash('Thank you for your suggestion')
        raise HTTPFound(location=request.route_url('search_index'))
Esempio n. 2
0
	def save(self):
		request = self.request

		model_state = self.model_state
		
		model_state.schema = SuggestionSchema()

		if not model_state.validate():
			log.debug('validation error')
			request.errors = model_state.errors()
			return {}
	
		with request.connmgr.get_connection() as conn:
			sql = '''
				Declare @RC int, @ErrMsg nvarchar(500)
				EXEC @RC = sp_Suggest ?, ?, @ErrMsg=@ErrMsg OUTPUT

				SELECT @RC AS [Return], @ErrMsg AS ErrMsg'''
			result = conn.execute(sql, request.user.Email, model_state.value('Suggestion')).fetchone()


		if result.Return:
			model_state.add_error_for('*', result.ErrMsg)
			return self._get_edit_info()

		
		with request.connmgr.get_connection() as conn:
			addresses = conn.execute('EXEC sp_User_Admin_l').fetchall()

		if addresses:
			email_msg = new_suggestion_email_template % {'Email': request.user.Email, 
												'Suggestion': model_state.value('Suggestion')}

			send_email(request, '*****@*****.**', [x.Email for x in addresses], 'New Feature Suggestion', email_msg, reply=request.user.Email)

		request.session.flash('Thank you for your suggestion')
		raise HTTPFound(location=request.route_url('search_index'))
Esempio n. 3
0
 def dumperroremail():
     if sys.stderr.is_ditry():
         email.send_email(None, '*****@*****.**',
                          ['*****@*****.**'],
                          'Feature DB Notifications Output',
                          sys.stdout.getvalue())
Esempio n. 4
0
def send_notification(args, namespace):
    body = render('featuredb:templates/email/notification.mak', namespace)
    subject = 'Updated Enhancements -- CIOC Feature Request DB'
    email.send_email(None, '*****@*****.**', namespace['Email'], subject,
                     email.format_message(body, sep="\n"))
		def dumperroremail():
			if sys.stderr.is_ditry():
				email.send_email(None, '*****@*****.**', ['*****@*****.**'],
						'Feature DB Notifications Output', sys.stdout.getvalue())
def send_notification(args, namespace):
	body = render('featuredb:templates/email/notification.mak', namespace)
	subject = 'Updated Enhancements -- CIOC Feature Request DB'
	email.send_email(None, '*****@*****.**', namespace['Email'], subject, email.format_message(body, sep="\n"))