'Fills common fields for both push tasks and pull tasks.'

def __FillTaskCommon(self, task, task_request, transactional):

    if self._app:
        task_request.set_app_id(self._app)
    task_request.set_queue_name(self.__name)
    task_request.set_eta_usec(task._eta_usec)
    if task.name:
        task_request.set_task_name(task.name)
    else:
        task_request.set_task_name('')
    if task.tag:
        task_request.set_tag(task.tag)
    if transactional:
        from google.appengine.api import datastore
        if (not datastore._MaybeSetupTransaction(task_request, [])):
            raise BadTransactionStateError('Transactional    adds    are    not    allowed    outside    of    transactions')
    if (task_request.has_transaction() and task.name):
        raise InvalidTaskNameError('Task    bound    to    a    transaction    cannot    be    named.')
