how to get the username of the reviewer who clicked ship it? I need to 
validate certain condition and send out a mail if the submitter and 
reviewer is same. 

Here is the code:

from __future__ import unicode_literals

from django.conf import settings
from django.conf.urls import patterns, include
from reviewboard.extensions.base import Extension
from reviewboard.extensions.hooks import ReviewRequestApprovalHook
import io
import os
import requests
import time


class SampleApprovalHook(ReviewRequestApprovalHook):
    def is_approved(self, review_request, prev_approved, prev_failure):
        if not prev_approved:
            return prev_approved, prev_failure
        elif (review_request.shipit_count < 3):
                file = open(os.path.join('/tmp',"approvedTest.txt"), "w")
                file.write("SUBMITTED BY:")
                file.write(review_request.submitter.username)
                file.write("REVIEWED BY:")
                file.write(review_request.approved.username)
                file.close()
        return True;

class TestHook(Extension):
    metadata = {
        'Name': 'Test',
        'Summary': 'Describe your extension here.',
    }
    is_configurable = True

    def initialize(self):
        # Your extension initialization is done here.
        SampleApprovalHook(self)
        pass

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to