<s> """<STR_LIT>""" <EOL> import httplib as http <EOL> from flask import request <EOL> from modularodm . exceptions import ValidationError <EOL> from framework . exceptions import HTTPError <EOL> from website . project . decorators import ( <EOL> must_have_addon , <EOL> must_have_permission , <EOL> must_not_be_registration , <EOL> must_be_valid_project ) <EOL> from website . addons . forward . utils import serialize_settings <EOL> @ must_be_valid_project <EOL> @ must_have_addon ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def forward_config_get ( node_addon , ** kwargs ) : <EOL> return serialize_settings ( node_addon ) <EOL> @ must_have_permission ( '<STR_LIT>' ) <EOL> @ must_not_be_registration <EOL> @ must_have_addon ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def forward_config_put ( auth , node_addon , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> node_addon . url = request . json [ '<STR_LIT:url>' ] <EOL> node_addon . label = request . json . get ( '<STR_LIT:label>' ) <EOL> node_addon . redirect_bool = request . json [ '<STR_LIT>' ] <EOL> node_addon . redirect_secs = int ( request . json [ '<STR_LIT>' ] ) <EOL> except ( KeyError , TypeError , ValueError ) : <EOL> raise HTTPError ( http . BAD_REQUEST ) <EOL> try : <EOL> saved_fields = node_addon . save ( ) <EOL> except ValidationError : <EOL> raise HTTPError ( http . BAD_REQUEST ) <EOL> if '<STR_LIT:url>' in saved_fields : <EOL> node_addon . owner . add_log ( <EOL> action = '<STR_LIT>' , <EOL> params = dict ( <EOL> node = node_addon . owner . _id , <EOL> project = node_addon . owner . parent_id , <EOL> forward_url = node_addon . url , <EOL> ) , <EOL> auth = auth , <EOL> save = True , <EOL> ) <EOL> return { } </s>
