Add a forwarding address for graduating seniors.
166066
def senior_email_forward_view(request):
    """"""
    if not request.user.is_senior:
        messages.error(request, "Only seniors can set their forwarding address.")
        return redirect("index")
    try:
        forward = SeniorEmailForward.objects.get(user=request.user)
    except SeniorEmailForward.DoesNotExist:
        forward = None

    if request.method == "POST":
        if forward:
            form = SeniorEmailForwardForm(request.POST, instance=forward)
        else:
            form = SeniorEmailForwardForm(request.POST)
        logger.debug(form)
        if form.is_valid():
            obj = form.save(commit=False)
            obj.user = request.user
            obj.save()
            messages.success(request, "Successfully added forwarding address.")
            return redirect("index")
        else:
            messages.error(request, "Error adding forwarding address.")
    else:
        if forward:
            form = SeniorEmailForwardForm(instance=forward)
        else:
            form = SeniorEmailForwardForm()
    return render(request, "emailfwd/senior_forward.html", {"form": form, "forward": forward})
401147
function attachRedirect(router, { path, redirect }, site) {
  redirect = normalizeRedirectPath(redirect, site);

  return router.get(path, (req, res) => {
    res.redirect(301, redirect);
  });
}
136063
public void addForwardedField(int sourceField, int destinationField) {
		FieldSet fs;
		if((fs = this.forwardedFields.get(sourceField)) != null) {
			fs.add(destinationField);
		} else {
			fs = new FieldSet(destinationField);
			this.forwardedFields.put(sourceField, fs);
		}
	}
850106
def add_virtualip(self, lb, vip):
        """"""
        resp, body = self.api.method_post("/loadbalancers/%s/virtualips" % lb.id,
                body=vip.to_dict())
        return resp, body
1013825
def mark_address(self, addr, size):
        """"""
        i = 0
        while i < size:
            self._register_map[addr] = True
            i += 1
598710
def set_address(addr):
    """"""
    # Send DNLOAD with first byte=0x21 and page address
    buf = struct.pack("<BI", 0x21, addr)
    __dev.ctrl_transfer(0x21, __DFU_DNLOAD, 0, __DFU_INTERFACE, buf, __TIMEOUT)

    # Execute last command
    if get_status() != __DFU_STATE_DFU_DOWNLOAD_BUSY:
        raise Exception("DFU: set address failed")

    # Check command state
    if get_status() != __DFU_STATE_DFU_DOWNLOAD_IDLE:
        raise Exception("DFU: set address failed")
1231459
function forward(doc){

	if( doc && doc['entity'] && doc['category'] ){

	    // Erase any val, change the placeholder (to try and
	    // prevent races where the user selects and then hits
	    // "search" before the forwarding finishes).
	    jQuery('#' + wired_name).val('');
	    jQuery('#' + wired_name).attr('placeholder', 'Forwarding to ' +
					  doc['entity'] + '...');

	    // Forward to the new doc.
	    if( doc['category'] === 'ontology_class' ){
		window.location.href =
		    linker.url(doc['entity'], 'term');
	    }else if( doc['category'] === 'bioentity' ){
		window.location.href = linker.url(doc['entity'], 'gp');
	    }
	}
    }
1243595
def create_shipping_address(self, shipping_address):
        """"""
        url = urljoin(self._url, '/shipping_addresses')
        return shipping_address.post(url)
900191
def add(self, client_id, email_address, name, access_level, password):
        """"""
        body = {
            "EmailAddress": email_address,
            "Name": name,
            "AccessLevel": access_level,
            "Password": password}
        response = self._post("/clients/%s/people.json" %
                              client_id, json.dumps(body))
        return json_to_py(response)
614671
def add_peer_address(self, ext_bgp_peer_or_fw, rank=None):
        
        if ext_bgp_peer_or_fw.typeof == 'external_bgp_peer':
            ref = 'external_bgp_peer_address_ref'
        else: # engine
            ref = 'fwcluster_peer_address_ref'
        self.conditions.append(
            {ref: ext_bgp_peer_or_fw.href,
             'rank': rank,
             'type': 'peer_address'})
1259029
def update(cls, domain, source, dest_add, dest_del):
        """"""
        result = None

        if dest_add or dest_del:
            current_destinations = cls.get_destinations(domain, source)
            fwds = current_destinations[:]
            if dest_add:
                for dest in dest_add:
                    if dest not in fwds:
                        fwds.append(dest)
            if dest_del:
                for dest in dest_del:
                    if dest in fwds:
                        fwds.remove(dest)

            if ((len(current_destinations) != len(fwds))
                    or (current_destinations != fwds)):
                cls.echo('Updating mail forward %s@%s' % (source, domain))
                options = {'destinations': fwds}
                result = cls.call('domain.forward.update', domain, source,
                                  options)

        return result
152889
def _make_ssh_forward_handler_class(self, remote_address_):
        
        class Handler(_ForwardHandler):
            remote_address = remote_address_
            ssh_transport = self._transport
            logger = self.logger
        return Handler
253498
def add_entry(self, net_type, cn, addresses):
        
        self.entries.append({
            'cn': cn,
            'addresses': addresses})
1220200
def HandlePeerInfoReceived(self, payload):
        """"""
        addrs = IOHelper.AsSerializableWithType(payload, 'neo.Network.Payloads.AddrPayload.AddrPayload')

        if not addrs:
            return

        for nawt in addrs.NetworkAddressesWithTime:
            self.leader.RemoteNodePeerReceived(nawt.Address, nawt.Port, self.prefix)
13679
def add(self, transport, address=None):
        

        if not address:
            address = str(uuid.uuid1())

        if address in self.recipients:
            self.recipients[address].add(transport)
        else:
            self.recipients[address] = RecipientManager(transport, address)

        return address
292039
def update(gandi, address, dest_add, dest_del):
    """"""
    source, domain = address

    if not dest_add and not dest_del:
        gandi.echo('Nothing to update: you must provide destinations to '
                   'update, use --dest-add/-a or -dest-del/-d parameters.')
        return

    result = gandi.forward.update(domain, source, dest_add, dest_del)

    return result
99257
def add_relation(self, source, destination):
        """"""
        if self.in_sources(source):
            if self.forward[source] != destination:
                raise ValueError("Source is already in use. Destination does "
                                 "not match.")
            else:
                raise ValueError("Source-Destination relation already exists.")
        elif self.in_destinations(destination):
            raise ValueError("Destination is already in use. Source does not "
                             "match.")
        else:
            self.forward[source] = destination
            self.reverse[destination] = source