예제 #1
0
파일: forms.py 프로젝트: chupahanks/kitsune
    def submit_ticket(self):
        """Submit the ticket to Zendesk."""
        if self.user.is_authenticated():
            email = self.user.email
        else:
            email = self.cleaned_data["email"]

        submit_ticket(email, self.cleaned_data["category"], self.cleaned_data["subject"], self.ticket_body(email), [])
예제 #2
0
파일: forms.py 프로젝트: kapalselam/kitsune
    def submit_ticket(self):
        """Submit the ticket to Zendesk."""
        if self.user.is_authenticated():
            email = self.user.email
        else:
            email = self.cleaned_data['email']

        submit_ticket(email, self.cleaned_data['category'],
                      self.cleaned_data['subject'], self.ticket_body, [])
예제 #3
0
파일: forms.py 프로젝트: AndryulE/kitsune
    def submit_ticket(self):
        """Submit the ticket to Zendesk."""
        if self.user.is_authenticated():
            email = self.user.email
        else:
            email = self.cleaned_data['email']

        submit_ticket(
            email,
            self.cleaned_data['category'],
            self.cleaned_data['subject'],
            self.ticket_body)
예제 #4
0
    def submit_ticket(self):
        """Submit the ticket to Zendesk."""
        if self.user.is_authenticated():
            email = self.user.email
        else:
            email = self.cleaned_data["email"]

        submit_ticket(
            email,
            self.cleaned_data["category"],
            self.cleaned_data["subject"],
            self.ticket_body(email),
            [],
        )
예제 #5
0
파일: tasks.py 프로젝트: bea/kitsune
def escalate_question(question_id):
    """Escalate a question to zendesk by submitting a ticket."""
    from kitsune.questions.models import Question
    question = Question.objects.get(id=question_id)

    url = 'https://{domain}{url}'.format(
        domain=Site.objects.get_current().domain,
        url=question.get_absolute_url())

    submit_ticket(
        email='*****@*****.**',
        category='Escalated',
        subject=u'[Escalated] {title}'.format(title=question.title),
        body=u'{url}\n\n{content}'.format(url=url, content=question.content))
예제 #6
0
    def test_submit_ticket(self, get_zendesk):
        """Verify the http calls that are triggered by submit_ticket"""
        zd = FauxZendesk("https://appsmarket.zendesk.com", "[email protected]", "pwd")
        get_zendesk.return_value = zd

        submit_ticket("[email protected]", "cat", "subject", "description")
        zd.client.request.assert_called_with(
            "https://appsmarket.zendesk.com/tickets.json?",
            "POST",
            body='{"ticket": {"requester_email": "[email protected]", "set_tags": "cat", '
            '"description": "description", '
            '"subject": "[TEST] subject"}}',
            headers={"Content-Type": "application/json", "User-agent": "Zendesk Python Library v1.1.0"},
        )
예제 #7
0
    def test_submit_ticket(self, get_zendesk):
        """Verify the http calls that are triggered by submit_ticket"""
        zd = FauxZendesk('https://appsmarket.zendesk.com', '[email protected]', 'pwd')
        get_zendesk.return_value = zd

        submit_ticket('[email protected]', 'cat', 'subject', 'description')
        zd.client.request.assert_called_with(
            'https://appsmarket.zendesk.com/tickets.json?',
            'POST',
            body='{"ticket": {"requester_email": "[email protected]", "set_tags": "cat", '
                 '"description": "description", '
                 '"subject": "[TEST] subject"}}',
            headers={
                'Content-Type': 'application/json',
                'User-agent': 'Zendesk Python Library v1.1.1'})
예제 #8
0
    def test_submit_ticket(self, get_zendesk):
        """Verify the http calls that are triggered by submit_ticket"""
        zd = FauxZendesk('https://appsmarket.zendesk.com', '[email protected]', 'pwd')
        get_zendesk.return_value = zd

        submit_ticket('[email protected]', 'cat', 'subject', 'description')
        zd.client.request.assert_called_with(
            'https://appsmarket.zendesk.com/tickets.json?',
            'POST',
            body='{"ticket": {"requester_email": "[email protected]", "set_tags": "cat", '
            '"description": "description", '
            '"subject": "[TEST] subject"}}',
            headers={
                'Content-Type': 'application/json',
                'User-agent': 'Zendesk Python Library v1.1.1'
            })
예제 #9
0
def escalate_question(question_id):
    """Escalate a question to zendesk by submitting a ticket."""
    from kitsune.questions.models import Question
    question = Question.objects.get(id=question_id)

    url = 'https://{domain}{url}'.format(
        domain=Site.objects.get_current().domain,
        url=question.get_absolute_url())

    try:
        submit_ticket(
            email='*****@*****.**',
            category='Escalated',
            subject=u'[Escalated] {title}'.format(title=question.title),
            body=u'{url}\n\n{content}'.format(url=url, content=question.content))
    except ZendeskError:
        # This is unpickleable, so we need to unwrap it a bit
        raise PickleableZendeskError()
예제 #10
0
def escalate_question(question_id):
    """Escalate a question to zendesk by submitting a ticket."""
    from kitsune.questions.models import Question
    question = Question.objects.get(id=question_id)

    url = 'https://{domain}{url}'.format(
        domain=Site.objects.get_current().domain,
        url=question.get_absolute_url())

    try:
        submit_ticket(
            email='*****@*****.**',
            category='Escalated',
            subject=u'[Escalated] {title}'.format(title=question.title),
            body=u'{url}\n\n{content}'.format(url=url,
                                              content=question.content))
    except ZendeskError:
        # This is unpickleable, so we need to unwrap it a bit
        raise PickleableZendeskError()