Exemple #1
0
from relengapi.lib import http
from relengapi.lib import time as relengapi_time
from relengapi.lib.api import apimethod
from relengapi.lib.permissions import p

bp = Blueprint('treestatus', __name__,
               static_folder='static',
               template_folder='templates')

p.treestatus.sheriff.doc('Modify tree status (open and close trees)')
p.treestatus.admin.doc('Administrate treestatus (add, delete, modify trees)')

log = logging.getLogger(__name__)
TREE_SUMMARY_LOG_LIMIT = 5
public_data = http.response_headers(
    ('cache-control', 'no-cache'),
    ('access-control-allow-origin', '*'))


bp.root_widget_template(
    'treestatus_root_widget.html', priority=100)


def update_tree_status(session, tree, status=None, reason=None,
                       tags=[], message_of_the_day=None):
    """Update the given tree's status; note that this does not commit
    the session.  Supply a tree object or name."""
    if status is not None:
        tree.status = status
    if reason is not None:
        tree.reason = reason
def test_response_headers_status_codes_str():
    """response_headers(.., status_codes='300') raises ValueError"""
    assert_raises(ValueError, lambda:
                  http.response_headers(('foo', 'bar'), status_codes='300'))
Exemple #3
0
def test_response_headers_status_codes_str():
    """response_headers(.., status_codes='300') raises ValueError"""
    assert_raises(
        ValueError, lambda: http.response_headers(
            ('foo', 'bar'), status_codes='300'))