Locates a target container for the given portal_type and record

    :param record: The dictionary representation of a content object
    :type record: dict
    :returns: folder which contains the object
    :rtype: object
193115
def find_target_container(portal_type, record):
    
    portal_type = portal_type or record.get("portal_type")
    container = get_container_for(portal_type)
    if container:
        return container

    parent_uid = record.pop("parent_uid", None)
    parent_path = record.pop("parent_path", None)

    target = None

    # Try to find the target object
    if parent_uid:
        target = get_object_by_uid(parent_uid)
    elif parent_path:
        target = get_object_by_path(parent_path)
    else:
        fail(404, "No target UID/PATH information found")

    if not target:
        fail(404, "No target container found")

    return target
363111
def addRecord(self, record):
        
        label_mapper    = self.labelMapper()
        icon_mapper     = self.iconMapper()
        
        self.addItem(label_mapper(record))
        self.setItemData(self.count() - 1, wrapVariant(record), Qt.UserRole)
        
        # load icon
        if icon_mapper:
            self.setItemIcon(self.count() - 1, icon_mapper(record))
        
        if self.showTreePopup():
            XOrbRecordItem(self.treePopupWidget(), record)
766267
def get_record(self, dns_record_type, host):
        """"""
        record_list = self._entries
        for record in record_list:
            if record._record_type == dns_record_type \
                    and record.host == host:
                return record
        return False
1202091
def emit(self, record):
        

        try:
            from .models import Model, Application, ModelObject
            from django.contrib.contenttypes.models import ContentType

            if not hasattr(record, 'action'):
                from .settings import AUTOMATED_LOGGING

                signal = True
                for excluded in AUTOMATED_LOGGING['exclude']:
                    if record.module.startswith(excluded):
                        signal = False
                        break

                if 'unspecified' not in AUTOMATED_LOGGING['modules']:
                    signal = False

                if signal:
                    from .models import Unspecified

                    entry = Unspecified()

                    if hasattr(record, 'message'):
                        entry.message = record.message

                    entry.level = record.levelno
                    entry.file = record.pathname
                    entry.line = record.lineno

                    entry.save()

                    if self.maxage:
                        current = timezone.now()
                        Unspecified.objects.filter(created_at__lte=current - self.maxage)\
                                           .delete()

                return

            if record.action == 'model':
                if ('al_evt' in record.data['instance'].__dict__.keys() and
                        record.data['instance'].al_evt):
                    entry = record.data['instance'].al_evt
                else:
                    entry = Model()
                    entry.user = record.data['user']
                    entry.save()

                    name = record.data['instance']._meta.app_label
                    entry.application = Application.objects.get_or_create(name=name)[0]

                    if hasattr(record, 'message'):
                        entry.message = record.message

                    if record.data['status'] == 'add':
                        status = 1
                    elif record.data['status'] == 'change':
                        status = 2
                    elif record.data['status'] == 'delete':
                        status = 3
                    else:
                        status = 0

                        from automated_logging.settings import AUTOMATED_LOGGING
                        if not AUTOMATED_LOGGING['save_na']:
                            entry.delete()

                            return None

                    entry.action = status
                    entry.information = ModelObject()
                    entry.information.value = repr(record.data['instance'])[:255]
                    ct = ContentType.objects.get_for_model(record.data['instance'])

                    try:
                        # check if the ContentType actually exists.
                        ContentType.objects.get(pk=ct.pk)
                        ct_exists = True
                    except ContentType.DoesNotExist:
                        ct_exists = False

                    if ct_exists:
                        entry.information.type = ct

                    entry.information.save()

                    record.data['instance'].al_evt = entry

                if ('al_chl' in record.data['instance'].__dict__.keys() and
                        record.data['instance'].al_chl and
                        not entry.modification):
                    entry.modification = record.data['instance'].al_chl

                entry.save()

                if self.maxage:
                    current = timezone.now()
                    Model.objects.filter(created_at__lte=current - self.maxage).delete()

            elif record.action == 'request':
                from .models import Request

                if record.data['uri'] is not None:
                    entry = Request()
                    entry.application = record.data['application']
                    entry.uri = record.data['uri'][:255]
                    entry.user = record.data['user']
                    entry.status = record.data['status']
                    entry.method = record.data['method']
                    entry.save()

                if self.maxage:
                    current = timezone.now()
                    Request.objects.filter(created_at__lte=current - self.maxage).delete()

        except Exception as e:
            print(e)
591842
def get(self, record_id):
        
        record_url = self.record_url(record_id)
        return self._get(record_url)
1357775
def record(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('ST record not yet initialized!')

        return b'ST' + struct.pack('=BB', RRSTRecord.length(), SU_ENTRY_VERSION)
1352610
def _getPayload(self, record):
        
        payload = super(LogglyHandler, self)._getPayload(record)
        payload['tags'] = self._implodeTags()

        return payload
123104
def emit(self, record):
        
        msg = record.getMessage()
        list_store = self.list_view.get_model()
        Gdk.threads_enter()
        if msg:
            # Underline URLs in the record message
            msg = replace_markup_chars(record.getMessage())
            record.msg = URL_FINDER.sub(r'<u>\1</u>', msg)
            self.parent.debug_logs['logs'].append(record)
            # During execution if level is bigger then DEBUG
            # then GUI shows the message.
            event_type = getattr(record, 'event_type', '')
            if event_type:
                if event_type == 'dep_installation_start':
                    switch_cursor(Gdk.CursorType.WATCH, self.parent.run_window)
                    list_store.append([format_entry(record)])
                if event_type == 'dep_installation_end':
                    switch_cursor(Gdk.CursorType.ARROW, self.parent.run_window)
            if not self.parent.debugging:
                # We will show only INFO messages and messages who have no dep_ event_type
                if int(record.levelno) > 10:
                    if event_type == "dep_check" or event_type == "dep_found":
                        list_store.append([format_entry(record)])
                    elif not event_type.startswith("dep_"):
                        list_store.append([format_entry(record, colorize=True)])
            if self.parent.debugging:
                if event_type != "cmd_retcode":
                    list_store.append([format_entry(record, show_level=True, colorize=True)])
        Gdk.threads_leave()
861548
def delete_record(self, dns_type, name):
        
        record = self.get_record(dns_type, name)
        content = self.request(
            urllib.parse.urljoin(self.api_url, self.zone['id'] + '/dns_records/' + record['id']),
            'delete'
        )
        return content['result']['id']
854299
def get_record(self, zone_name, record_id):
        
        return self._client.get(
            '/domain/zone/{}/record/{}'.format(zone_name, record_id))
1335541
def record(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('CL record not yet initialized!')

        return b'CL' + struct.pack('=BBLL', RRCLRecord.length(), SU_ENTRY_VERSION, self.child_log_block_num, utils.swab_32bit(self.child_log_block_num))
1339838
def emit(self, record):
        
        # avoid infinite recursion
        if record.name.startswith('requests'):
            return

        data, header = self._prepPayload(record)

        try:
            self.session.post(self._getEndpoint(),
                              data=data,
                              headers={'content-type': header})
        except Exception:
            self.handleError(record)
1357985
def get_record(self, dns_type, name):
        
        try:
            record = [record for record in self.dns_records
                      if record['type'] == dns_type and record['name'] == name][0]
        except IndexError:
            raise RecordNotFound(
                'Cannot find the specified dns record in domain {domain}'
                .format(domain=name))
        return record
789836
function on_record(record) {
    var parser = this
    //LOG.info('Record %s: %s', RECORD_NAMES[record.header.type], record.header.recordId)

    record.bodies = parser.bodies
    parser.bodies = []
    record.body_utf8 = function() {
      return this.bodies
                 .map(function(data) { return data.toString() })
                 .join('')
    }

    var req_id = record.header.recordId
    if(req_id == 0)
      return LOG.info('Ignoring management record: %j', record)

    var request = requests_in_flight[req_id]
    if(!request)
      return LOG.error('Record for unknown request: %s\n%s', req_id, util.inspect(request))

    if(record.header.type == FCGI.constants.record.FCGI_STDERR)
      return LOG.error('Error: %s', record.body_utf8().trim())

    else if(record.header.type == FCGI.constants.record.FCGI_STDOUT) {
      request.stdout = request.stdout.concat(record.bodies)
      return send_stdout(request)
    }

    else if(record.header.type == FCGI.constants.record.FCGI_END) {
      request.res.end()
      LOG.info('%s %s %d', request.req.method, request.req.url, request.status)
      delete requests_in_flight[req_id]

      if(request.keepalive == FCGI.constants.keepalive.ON)
        process_request() // If there are more in the queue, get to them now.
      else
        socket.end()
    }

    else {
      LOG.info('Unknown record: %j', record)
      Object.keys(FCGI.constants.record).forEach(function(type) {
        if(record.header.type == FCGI.constants.record[type])
          LOG.info('Unknown record type: %s', type)
      })
    }
  }
694466
def _nested_cwl_record(xs, want_attrs, input_files):
    
    if isinstance(xs, (list, tuple)):
        return [_nested_cwl_record(x, want_attrs, input_files) for x in xs]
    else:
        assert isinstance(xs, dict), pprint.pformat(xs)
        return _collapse_to_cwl_record_single(xs, want_attrs, input_files)
935465
def _get_record(self, name):
        """"""
        request = self._session.get(self._baseurl, params={'name': name,
                                                           'type': 'A'})
        if not request.ok:
            raise RuntimeError('Failed to search record: %s - %s' %
                               (self._format_hostname(name), request.json()))
        records = request.json()
        if len(records) == 0:
            return
        record = records[0]
        if 'record' not in record or 'id' not in record['record']:
            raise RuntimeError('Invalid record JSON format: %s - %s' %
                               (self._format_hostname(name), request.json()))
        return int(record['record']['id'])
524454
async def container_load(self, container_type, params=None, container=None, obj=None):
        
        if isinstance(obj, IModel):
            obj = obj.val

        if obj is None:
            return NoSetSentinel()

        c_len = len(obj)
        elem_type = params[0] if params else None
        if elem_type is None:
            elem_type = container_type.ELEM_TYPE

        res = container if container else []
        for i in range(c_len):
            try:
                self.tracker.push_index(i)
                fvalue = await self._load_field(elem_type,
                                                params[1:] if params else None,
                                                x.eref(res, i) if container else None, obj=obj[i])
                self.tracker.pop()

            except Exception as e:
                raise helpers.ArchiveException(e, tracker=self.tracker) from e

            if not container and not isinstance(fvalue, NoSetSentinel):
                res.append(fvalue)

        return res