Ensure attributes are copied to subsequent queries.
4912
def _clone(self, *args, **kwargs):
        
        for attr in ("_search_terms", "_search_fields", "_search_ordered"):
            kwargs[attr] = getattr(self, attr)
        return super(SearchableQuerySet, self)._clone(*args, **kwargs)
438147
def clone(self, **data):
        '''
'''
        meta = self._meta
        session = self.session
        pkname = meta.pkname()
        pkvalue = data.pop(pkname, None)
        fields = self.todict(exclude_cache=True)
        fields.update(data)
        fields.pop('__dbdata__', None)
        obj = self._meta.make_object((pkvalue, None, fields))
        obj.session = session
        return obj
787002
def _need_subquery(arg, attributes, named_attributes):
        
        if arg.heading.expressions or arg.distinct:  # argument has any renamed (computed) attributes
            return True
        restricting_attributes = arg.attributes_in_restriction()
        return (not restricting_attributes.issubset(attributes) or  # if any restricting attribute is projected out or
                any(v.strip() in restricting_attributes for v in named_attributes.values()))
1306934
def set_attributes_for exc, request
      self.backtrace      = exc.backtrace.join("\n"),
      self.request_url    = request.original_url,
      self.request_method = request.request_method,
      self.parameters     = request.filtered_parameters,
      self.user_agent     = request.user_agent,
      self.client_ip      = request.remote_ip,
      self.status         = "new",
      self.description    = exc.inspect
    end
476258
def _insert_attributes(attrs, order=[])
      return if attrs.nil?
      order.each do |k|
        v = attrs[k]
        @target << %{ #{k}=#{@quote}#{_attr_value(v)}#{@quote}} if v
      end
      attrs.each do |k, v|
        @target << %{ #{k}=#{@quote}#{_attr_value(v)}#{@quote}} unless order.member?(k) # " WART
      end
    end
632049
def copy(self, contents=True):
        ''''''
        cp = connection(collection=self._db_coll, baseiri=self._baseiri)
        if contents: cp.add_many(self._relationships)
        return cp
273332
def _populate_attributes(self, config, record, context, data):
        
        search_return_attributes = config['search_return_attributes']
        for attr in search_return_attributes.keys():
            if attr in record["attributes"]:
                if record["attributes"][attr]:
                    data.attributes[search_return_attributes[attr]] = record["attributes"][attr]
                    satosa_logging(
                        logger,
                        logging.DEBUG,
                        "Setting internal attribute {} with values {}".format(
                            search_return_attributes[attr],
                            record["attributes"][attr]
                            ),
                        context.state
                        )
                else:
                    satosa_logging(
                        logger,
                        logging.DEBUG,
                        "Not setting internal attribute {} because value {} is null or empty".format(
                            search_return_attributes[attr],
                            record["attributes"][attr]
                            ),
                        context.state
                        )
1191119
def ensure_attribute_uniqueness(associates_attribute_names, attribute_names)
      attribute_names.each do |attribute_name|
        if associates_attribute_names.include?(attribute_name)
          raise NameError, "already defined attribute name '#{attribute_name}' for #{name}(#{object_id})"
        end
      end
    end
75757
private void saveAttributesBeforeInclude(final Invocation inv) {
        ServletRequest request = inv.getRequest();
        logger.debug("Taking snapshot of request attributes before include");
        Map<String, Object> attributesSnapshot = new HashMap<String, Object>();
        Enumeration<?> attrNames = request.getAttributeNames();
        while (attrNames.hasMoreElements()) {
            String attrName = (String) attrNames.nextElement();
            attributesSnapshot.put(attrName, request.getAttribute(attrName));
        }
        inv.setAttribute("$$paoding-rose.attributesBeforeInclude", attributesSnapshot);
    }
380174
def clone(self):
        ''' 
        '''
        qclone = Query(self.type, self.session)
        qclone.__query = deepcopy(self.__query)
        qclone._sort = deepcopy(self._sort)
        qclone._fields = deepcopy(self._fields)
        qclone._hints = deepcopy(self.hints)
        qclone._limit = deepcopy(self._limit)
        qclone._skip = deepcopy(self._skip)
        qclone._raw_output = deepcopy(self._raw_output)
        return qclone
192898
def raw(self, query):
        
        clone = copy.deepcopy(self)
        clone.adapter._pre_compiled_query = query
        clone.adapter.compiled_query = query
        return clone
1161181
private void updateAttributesCache(String key, Attributes missAttrs, Attributes cachedAttrs) {
        final String METHODNAME = "updateAttributeCache(key,missAttrs,cachedAttrs)";
        if (missAttrs.size() > 0) {
            boolean newAttr = false; // differentiate between a new entry and an entry we'll update so we change the cache correctly and maintain the creation TTL.
            if (cachedAttrs != null) {
                cachedAttrs = (Attributes) cachedAttrs.clone();
            } else {
                cachedAttrs = new BasicAttributes(true);
                newAttr = true;
            }

            //Set extIdAttrs = iLdapConfigMgr.getExtIds();
            for (NamingEnumeration<?> neu = missAttrs.getAll(); neu.hasMoreElements();) {
                Attribute attr = (Attribute) neu.nextElement();
                // If the size of the attributes is larger than the limit, don not cache it.
                if (!(iAttrsSizeLmit > 0 && attr.size() > iAttrsSizeLmit)) {
                    cachedAttrs.put(attr);
                }
            }
            if (newAttr) {
                getAttributesCache().put(key, cachedAttrs, 1, iAttrsCacheTimeOut, 0, null);
            } else {
                getAttributesCache().put(key, cachedAttrs);
            }
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, METHODNAME + " Update " + iAttrsCacheName + "(size: " + getAttributesCache().size() + " newEntry: " + newAttr + ")\n" + key + ": " + cachedAttrs);
            }
        }
    }
791803
def copy(self, schema_only=False):
        
        o = type(self)()
        o.relation = self.relation
        o.attributes = list(self.attributes)
        o.attribute_types = self.attribute_types.copy()
        o.attribute_data = self.attribute_data.copy()
        if not schema_only:
            o.comment = list(self.comment)
            o.data = copy.deepcopy(self.data)
        return o
1317454
def old_attributes
      (audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)|
        attrs[attr] = Array(values).first

        attrs
      end
    end
669423
def update(self, _attributes=None, **attributes):
        
        if _attributes is not None:
            attributes.update(_attributes)

        if self._related.uses_timestamps():
            attributes[self.get_related_updated_at()] = self._related.fresh_timestamp()

        return self._query.update(attributes)
884285
def update_attributes(self, **original_kwargs):
        
        def update_attrs(layout_object):
            kwargs = original_kwargs.copy()
            if hasattr(layout_object, 'attrs'):
                if 'css_class' in kwargs:
                    if 'class' in layout_object.attrs:
                        layout_object.attrs['class'] += " %s" % kwargs.pop('css_class')
                    else:
                        layout_object.attrs['class'] = kwargs.pop('css_class')
                layout_object.attrs.update(kwargs)

        self.map(update_attrs)
931672
def new_attributes
      (audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)|
        attrs[attr] = values.is_a?(Array) ? values.last : values
        attrs
      end
    end