Adds an attachment to an existing ticket.
190810
def cli(env, identifier, path, name):
    """"""
    mgr = SoftLayer.TicketManager(env.client)

    ticket_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'ticket')

    if path is None:
        raise exceptions.ArgumentError("Missing argument --path")

    if not os.path.exists(path):
        raise exceptions.ArgumentError("%s not exist" % path)

    if name is None:
        name = os.path.basename(path)

    attached_file = mgr.upload_attachment(ticket_id=ticket_id,
                                          file_path=path,
                                          file_name=name)
    env.fout("File attached: \n%s" % attached_file)
647106
public void attach(Pipe pipe)
    {
        //  If we are in the middle of sending a message, we'll add new pipe
        //  into the list of eligible pipes. Otherwise we add it to the list
        //  of active pipes.
        if (more) {
            pipes.add(pipe);
            Collections.swap(pipes, eligible, pipes.size() - 1);
            eligible++;
        }
        else {
            pipes.add(pipe);
            Collections.swap(pipes, active, pipes.size() - 1);
            active++;
            eligible++;
        }
    }
192844
public function addAttachment(
        $path,
        $name = '',
        $encoding = 'base64',
        $type = 'application/octet-stream',
        $disposition = 'attachment'
    ) {
        $this->_aAttachments[] = [$path, $name, $encoding, $type, $disposition];
        $result = false;

        try {
            $result = parent::addAttachment($path, $name, $encoding, $type, $disposition);
        } catch (Exception $exception) {
        }

        return $result;
    }
468735
private void addAttachment(Multipart multipart, Attachment attachment) throws AttachmentResourceHandlerException {
		MimeBodyPart part = new MimeBodyPart();
		try {
			part.setFileName(attachment.getResource().getName());
			part.setDisposition(attachment.getDisposition());
			part.setDescription(attachment.getDescription());
			part.setContentID(attachment.getContentId());
			attachmentHandler.setData(part, attachment.getResource(), attachment);
			multipart.addBodyPart(part);
		} catch (MessagingException e) {
			throw new AttachmentResourceHandlerException("Failed to attach " + attachment.getResource().getName(), attachment, e);
		}
	}
392629
def post_ticket(self, title, body):
        '''

        '''

        # Populate the ticket
        ticket = {'subject': title,
                  'message': body }

        response = self.client.post("/api/v1/tickets.json", {
                                    'email': self.email,
                                    'ticket': ticket })['ticket']
        bot.info(response['url'])
843992
def put_attachment(self, attachmentid, attachment_update):
        ''''''
        assert type(attachment_update) is DotDict
        if (not 'ids' in attachment_update):
            attachment_update.ids = [attachmentid]

        return self._put('bug/attachment/{attachmentid}'.format(attachmentid=attachmentid),
                json.dumps(attachment_update))
1115017
def addAttachment(self, title, attachment):
        
        self._attachments[title] = attachment
        self.resizeToContents()
228822
def _put_attachment_data(self, id, filename, data, content_type, include_online=False):
        """"""
        uri = '/'.join([self.base_url, self.name, id, 'Attachments', filename])
        params = {'IncludeOnline': 'true'} if include_online else {}
        headers = {'Content-Type': content_type, 'Content-Length': str(len(data))}
        return uri, params, 'put', data, headers, False
1100583
def create_ticket(self, service):
        """"""
        ticket = AuthTicket(owner=self, service=service)
        ticket.authorize()
        return ticket
704312
def attach(self, handle, filters=None, resolution=None):
        """"""
        params = self._get_params(filters=filters, resolution=resolution)
        c = computation.Computation(
            lambda since: self._transport.attach(handle, params))
        self._computations.add(c)
        return c
467371
public void addAttachments(Attachments attachments) {
    Attachments newAttachment = new Attachments();
    newAttachment.setContent(attachments.getContent());
    newAttachment.setType(attachments.getType());
    newAttachment.setFilename(attachments.getFilename());
    newAttachment.setDisposition(attachments.getDisposition());
    newAttachment.setContentId(attachments.getContentId());
    this.attachments = addToList(newAttachment, this.attachments);
  }
661381
public function addAttachmentPart($resource, $mimeType, $filename = null, $disposition = 'attachment')
    {
        $this->messageHelperService
            ->getMultipartHelper()
            ->createAndAddPartForAttachment($this, $resource, $mimeType, $disposition, $filename);
    }
1317295
def attach_alternative(self, content, mimetype=None):
        """"""
        self.attach(content=content, mimetype=mimetype)
1121780
def add_attachment(message, attachment, rfc2231=True):
    '''
    '''
    data = attachment.read()

    part = MIMEBase('application', 'octet-stream')
    part.set_payload(data)
    encoders.encode_base64(part)
    filename = attachment.name if rfc2231 else Header(attachment.name).encode()
    part.add_header('Content-Disposition', 'attachment',
                    filename=filename)

    message.attach(part)
1206355
def attach(item, action, greedy=False, ignore_no_tokens=None, ignore_one_token=None):
    """"""
    if use_computation_graph:
        # use the action's annotations to generate the defaults
        if ignore_no_tokens is None:
            ignore_no_tokens = getattr(action, "ignore_no_tokens", False)
        if ignore_one_token is None:
            ignore_one_token = getattr(action, "ignore_one_token", False)
        # only include True keyword arguments in the partial, since False is the default
        kwargs = {}
        if greedy:
            kwargs["greedy"] = greedy
        if ignore_no_tokens:
            kwargs["ignore_no_tokens"] = ignore_no_tokens
        if ignore_one_token:
            kwargs["ignore_one_token"] = ignore_one_token
        action = partial(ComputationNode, action, **kwargs)
    return add_action(item, action)
359414
protected function addAddCart()
    {
        if (!$this->isError()) {
            $id = $this->cart->add($this->getSubmitted());
            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }
            $this->line($id);
        }
    }
1012888
function AddStringAttachment($string, $filename, $encoding = "binary", $type = "application/octet-stream") {
      // Append to $attachment array
      $cur = count($this->attachment);
      $this->attachment[$cur][0] = $string;
      $this->attachment[$cur][1] = $filename;
      $this->attachment[$cur][2] = $filename;
      $this->attachment[$cur][3] = $encoding;
      $this->attachment[$cur][4] = $type;
      $this->attachment[$cur][5] = true; // isString
   }