list attachements for a given OBJECT ID
433875
def listAttachments(self, oid):
        
        url = self._url + "/%s/attachments" % oid
        params = {
            "f":"json"
        }
        return self._get(url, params,
                            securityHandler=self._securityHandler,
                            proxy_port=self._proxy_port,
                            proxy_url=self._proxy_url)
1265960
protected boolean fillAttachmentList(@NonNull Context context, @NonNull String reportText, @NonNull List<Uri> attachments) {
        final InstanceCreator instanceCreator = new InstanceCreator();
        attachments.addAll(instanceCreator.create(config.attachmentUriProvider(), DefaultAttachmentProvider::new).getAttachments(context, config));
        if (mailConfig.reportAsFile()) {
            final Uri report = createAttachmentFromString(context, mailConfig.reportFileName(), reportText);
            if (report != null) {
                attachments.add(report);
                return true;
            }
        }
        return false;
    }
925456
def each_object_id(collection):
    """"""
    c_path = collection_path(collection)
    paths = glob('%s/*.%s' % (c_path, _ext))
    for path in paths:
        match = regex.match(r'.+/(.+)\.%s$' % _ext, path)
        yield match.groups()[0]
788887
def attachment_form(context, obj):
    
    if context['user'].has_perm('attachments.add_attachment'):
        return {
            'form': AttachmentForm(),
            'form_url': add_url_for_obj(obj),
            'next': context.request.build_absolute_uri(),
        }
    else:
        return {'form': None}
797738
@InterfaceAudience.Public
    public List<String> getAttachmentNames() {
        Map<String, Object> attachmentMetadata = getAttachmentMetadata();
        if (attachmentMetadata == null) {
            return new ArrayList<String>();
        }
        return new ArrayList<String>(attachmentMetadata.keySet());
    }
297677
function addAttachment(obj_list) {
    for (let key in obj_list) {
      if (typeof(obj_list[key]) === 'string' &&
        regexAttach.test(obj_list[key])) {
        const binaryKey = obj_list[key];
        const replacement = getAttachment(binaryKey);
        if (replacement !== null) obj_list[key] = replacement;
      } else if (typeof(obj_list[key]) === 'object') {
        // arrays are also 'object' with this test.
        addAttachment(obj_list[key]);
      }
    }
  }
616052
def _attachments(cmd, *args)
      requires_version(cmd, 3.6)

      raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)

      @iface.call(cmd, args[0])
    end
758200
def attach(self, id, attributes=None, touch=True):
        
        if isinstance(id, orator.orm.Model):
            id = id.get_key()

        query = self.new_pivot_statement()

        if not isinstance(id, list):
            id = [id]

        query.insert(self._create_attach_records(id, attributes))

        if touch:
            self.touch_if_touching()
1302732
def _attach_obj(self, req, obj):
        """"""

        # Attach the object to the request
        json.dump(obj, req)

        # Also set the content-type header
        req['content-type'] = self._content_type
253197
def attach_attachment(self, analysis, attachment):
        
        if not attachment:
            return
        if isinstance(attachment, list):
            for attach in attachment:
                self.attach_attachment(analysis, attach)
            return
        # current attachments
        an_atts = analysis.getAttachment()
        atts_filenames = [att.getAttachmentFile().filename for att in an_atts]
        if attachment.getAttachmentFile().filename not in atts_filenames:
            an_atts.append(attachment)
            logger.info(
                "Attaching %s to %s" % (attachment.UID(), analysis))
            analysis.setAttachment([att.UID() for att in an_atts])
            analysis.reindexObject()
        else:
            self.warn("Attachment %s was not linked to analysis %s" %
                      (attachment.UID(), analysis))
883578
function (id) {
    var todos = [];
    for (var i in _todos) {
      if (_todos[i].todo_list_id === id) {
        todos.push(_todos[i]);
      }
    }
    return todos;
  }
858754
def _attachToObject(self, anchorObj, relationName) :
		""
		#MutableSequence.__getattribute__(self, "develop")()
		self.develop()
		self._attachToObject(anchorObj, relationName)
1230044
public static function getAttachmentsList($object)
    {
        $fburl       = $object->getFlexiBeeURL();
        $attachments = [];
        $oFormat = $object->format;
        $object->setFormat('json');
        $atch        = $object->getFlexiData($fburl.'/prilohy'.(count($object->defaultUrlParams)
                ? '?'.http_build_query($object->defaultUrlParams) : ''));
        $object->setFormat($oFormat);
        if (count($atch) && ($object->lastResponseCode == 200)) {
            foreach ($atch as $attachmentID => $attachmentData) {
                $attachments[$attachmentID]        = $attachmentData;
                $attachments[$attachmentID]['url'] = $object->url.'/c/'.$object->company.'/priloha/'.$attachmentData['id'];
            }
        }
        return $attachments;
    }
466748
def _verify_attachments(self):
        '''
        '''
        if self.attachments is None:
            return
        keys = ('Name', 'Content', 'ContentType')
        self._verify_dict_list(self.attachments, keys, 'Attachment')
150768
def insert_attachments(self, volumeID, attachments):
        '''  '''
        log.debug("adding new attachments to volume '{}': {}".format(volumeID, attachments))
        if not attachments:
            return
        rawVolume = self._req_raw_volume(volumeID)
        attsID = list()
        for index, a in enumerate(attachments):
            try:
                rawAttachment = self._assemble_attachment(a['file'], a)
                rawVolume['_source']['_attachments'].append(rawAttachment)
                attsID.append(rawAttachment['id'])
            except Exception:
                log.exception("Error while elaborating attachments array at index: {}".format(index))
                raise
        self._db.modify_book(volumeID, rawVolume['_source'], version=rawVolume['_version'])
        return attsID
262015
protected function display_attached( $attached ) {
		$ids = array();

		// Remove any empty values
		$attached = array_filter( $attached );

		if ( empty( $attached ) ) {
			return $ids;
		}

		$count = 0;

		// Loop through and build our existing display items
		foreach ( $attached as $id ) {
			$object = $this->get_object( $id );
			$id     = $this->get_id( $object );

			if ( empty( $object ) ) {
				continue;
			}

			// Set our zebra stripes
			$class = ++$count % 2 == 0 ? 'even' : 'odd';

			$this->list_item( $object, $class, 'dashicons-minus' );
			$ids[ $id ] = $id;
		}

		return $ids;
	}
1338583
def for_entity(obj, check_support_attachments=False):
    """"""
    if check_support_attachments and not supports_attachments(obj):
        return []

    return getattr(obj, ATTRIBUTE)