Customise `UrlNodeQuerySet.published()` to add filtering by publication
        date constraints and exchange of draft items for published ones.
763799
def published(self, for_user=None, force_exchange=True):
        
        qs = self._single_site()
        # Avoid filtering to only published items when we are in a draft
        # context and we know this method is triggered by Fluent (because
        # the `for_user` is present) because we may actually want to find
        # and return draft items to priveleged users in this situation.
        if for_user and is_draft_request_context():
            return qs

        if for_user is not None and for_user.is_staff:
            pass  # Don't filter by publication date for Staff
        else:
            qs = qs.filter(
                    Q(publication_date__isnull=True) |
                    Q(publication_date__lt=now())
                ).filter(
                    Q(publication_end_date__isnull=True) |
                    Q(publication_end_date__gte=now())
                )
        if force_exchange:
            return _exchange_for_published(qs)
        else:
            return qs.filter(status=UrlNode.PUBLISHED)
105970
def get_queryset(self):
        
        entries = Entry.published.none()

        if self.request.GET:
            self.pattern = self.request.GET.get('pattern', '')
            if len(self.pattern) < 3:
                self.error = _('The pattern is too short')
            else:
                entries = Entry.published.search(self.pattern)
        else:
            self.error = _('No pattern to search found')
        return entries
1239617
private void addQueryParams(final Request request) {
        if (from != null) {
            request.addQueryParam("From", from);
        }

        if (to != null) {
            request.addQueryParam("To", to);
        }

        if (dateCreatedOnOrBefore != null) {
            request.addQueryParam("DateCreatedOnOrBefore", dateCreatedOnOrBefore.toString());
        }

        if (dateCreatedAfter != null) {
            request.addQueryParam("DateCreatedAfter", dateCreatedAfter.toString());
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
1161773
private function AddPublishToDateField()
    {
        $name = 'PublishToDate';
        $to = $this->article->GetPublishTo();
        $field = Input::Text($name, $to ? $to->ToString($this->dateFormat) : '');
        $field->SetHtmlAttribute('data-type', 'date');
        $this->AddField($field);
    }
1309257
def get_absolute_url_with_date(self):
        """"""
        pub_date = self.published_on

        if pub_date and settings.USE_TZ:
            # If TZ is enabled, convert all of these dates from UTC to whatever
            # the project's timezone is set as. Ideally, we'd pull this form
            # some user settings, but the *canonical* publish time is that of
            # the author (asssuming author == owner of this project).
            pub_date = make_naive(pub_date, pytz.utc)  # Make naive
            pub_date = pytz.timezone(settings.TIME_ZONE).localize(pub_date)
        if pub_date:
            args = [
                pub_date.strftime("%Y"),
                pub_date.strftime("%m"),
                pub_date.strftime("%d"),
                self.slug
            ]
        else:
            args = [self.slug]
        return reverse('blargg:entry_detail', args=args)
788416
def publish(self):
        
        if self.is_draft:
            # If the object has previously been linked then patch the
            # placeholder data and remove the previously linked object.
            # Otherwise set the published date.
            if self.publishing_linked:
                self.patch_placeholders()
                # Unlink draft and published copies then delete published.
                # NOTE: This indirect dance is necessary to avoid
                # triggering unwanted MPTT tree structure updates via
                # `save`.
                type(self.publishing_linked).objects \
                    .filter(pk=self.publishing_linked.pk) \
                    .delete()  # Instead of self.publishing_linked.delete()
            else:
                self.publishing_published_at = timezone.now()

            # Create a new object copying all fields.
            publish_obj = deepcopy(self)

            # If any fields are defined not to copy set them to None.
            for fld in self.publishing_publish_empty_fields + (
                'urlnode_ptr_id', 'publishing_linked_id'
            ):
                setattr(publish_obj, fld, None)

            # Set the state of publication to published on the object.
            publish_obj.publishing_is_draft = False

            # Update Fluent's publishing status field mechanism to correspond
            # to our own notion of publication, to help use work together more
            # easily with Fluent Pages.
            if isinstance(self, UrlNode):
                self.status = UrlNode.DRAFT
                publish_obj.status = UrlNode.PUBLISHED

            # Set the date the object should be published at.
            publish_obj.publishing_published_at = self.publishing_published_at

            # Perform per-model preparation before saving published copy
            publish_obj.publishing_prepare_published_copy(self)

            # Save the new published object as a separate instance to self.
            publish_obj.save()
            # Sanity-check that we successfully saved the published copy
            if not publish_obj.pk:  # pragma: no cover
                raise PublishingException("Failed to save published copy")

            # As it is a new object we need to clone each of the
            # translatable fields, placeholders and required relations.
            self.clone_parler_translations(publish_obj)
            self.clone_fluent_placeholders_and_content_items(publish_obj)
            self.clone_fluent_contentitems_m2m_relationships(publish_obj)

            # Extra relationship-cloning smarts
            publish_obj.publishing_clone_relations(self)

            # Link the published object to the draft object.
            self.publishing_linked = publish_obj

            # Flag draft instance when it is being updated as part of a
            # publish action, for use in `publishing_set_update_time`
            self._skip_update_publishing_modified_at = True

            # Signal the pre-save hook for publication, save then signal
            # the post publish hook.
            publishing_signals.publishing_publish_pre_save_draft.send(
                sender=type(self), instance=self)

            # Save the draft and its new relationship with the published copy
            publishing_signals.publishing_publish_save_draft.send(
                sender=type(self), instance=self)

            publishing_signals.publishing_post_publish.send(
                sender=type(self), instance=self)
            return publish_obj
1081733
def list(self, request, *args, **kwargs):
        """"""
        search_kwargs = {"published": False}

        for field_name in ("before", "after", "status", "published"):

            if field_name in get_query_params(self.request):
                search_kwargs[field_name] = get_query_params(self.request).get(field_name)

        for field_name in ("tags", "types", "feature_types"):

            if field_name in get_query_params(self.request):
                search_kwargs[field_name] = get_query_params(self.request).getlist(field_name)

        if "search" in get_query_params(self.request):
            search_kwargs["query"] = get_query_params(self.request).get("search")

        queryset = self.model.search_objects.search(**search_kwargs)

        if "authors" in get_query_params(self.request):
            authors = get_query_params(self.request).getlist("authors")
            queryset = queryset.filter(Authors(authors))

        if "exclude" in get_query_params(self.request):
            exclude = get_query_params(self.request).get("exclude")
            queryset = queryset.filter(
                es_filter.Not(es_filter.Type(**{'value': exclude}))
            )

        # always filter out Super Features from listing page
        queryset = queryset.filter(
            es_filter.Not(filter=es_filter.Type(
                value=get_superfeature_model().search_objects.mapping.doc_type))
        )

        page = self.paginate_queryset(queryset)
        if page is not None:
            serializer = self.get_serializer(page, many=True)
            return self.get_paginated_response(serializer.data)

        serializer = self.get_serializer(queryset, many=True)
        return Response(serializer.data)
84060
function submitSearch() {
    var searchInput = getSearchInput();
    // FIXME: SUI validation for select2 field
      if (!searchInput.valid) {
      alert('Please select team members');
      return;
    }
    console.log('publishing', searchInput);
    $('.search.message').html('Search results:');
    $('.search.message').removeClass('hidden');
    context.pubsub.status('queued', function(res) {
      console.log(res);
      var message = '';
      if (res.err) {
        message = res.err;
      } else {
        message = 'found <a target="_searchresult" href="' + res.status.uri + '">' + res.status.uri + '</a> from ' + res.status.source;
      }

      $('.search.message').append('<div>' + message + '</div>');
    });

    context.pubsub.search.queue(searchInput);
    context.queryLib.setAnnotationTags($('#searchCategories').val().split(','));
    context.queryLib.submitQuery();
  }
635506
def make_hidden(self, request, queryset):
        
        queryset.update(status=HIDDEN)
        EntryPublishedVectorBuilder().cache_flush()
        self.message_user(
            request, _('The selected entries are now marked as hidden.'))
1146976
def drafts(self):
        """"""
        pub = self.on_site().filter(status=self.model.DRAFT)
        if settings.PAGE_SHOW_START_DATE:
            pub = pub.filter(publication_date__gte=get_now())
        return pub
1025015
def publish(self, dataset_identifier, content_type="json"):
        '''
        
        '''
        base = _format_old_api_request(dataid=dataset_identifier)
        resource = "{0}/publication.{1}".format(base, content_type)

        return self._perform_request("post", resource)
784983
def only_published(cls, at=None):
		
		
		if isinstance(at, timedelta):
			at = utcnow() + at
		else:
			at = at or utcnow()
		
		pub, ret = cls.published, cls.retracted
		
		publication = (-pub) | (pub == None) | (pub <= at)
		retraction = (-ret) | (ret == None) | (ret > at)
		
		return publication & retraction
804478
def get_queryset(self):
        
        now = timezone.now()
        return super(
            EntryRelatedPublishedManager, self).get_queryset().filter(
            models.Q(entries__start_publication__lte=now) |
            models.Q(entries__start_publication=None),
            models.Q(entries__end_publication__gt=now) |
            models.Q(entries__end_publication=None),
            entries__status=PUBLISHED,
            entries__sites=Site.objects.get_current()
            ).distinct()
406005
def recent_articles(limit=10, exclude=None):
    """"""
    queryset = Article.objects.filter(published=True).order_by('-modified')
    if exclude:
        if hasattr(exclude, '__iter__'):
            queryset = queryset.exclude(pk__in=exclude)
        else:
            queryset = queryset.exclude(pk=exclude)
    return queryset
446094
public void performUpdateQuery(String queryString, SPARQLQueryBindingSet bindings, Transaction tx, boolean includeInferred, String baseURI) {
        SPARQLQueryDefinition qdef = sparqlManager.newQueryDefinition(queryString);
        if(notNull(baseURI) && !baseURI.isEmpty()){ qdef.setBaseUri(baseURI);}
        if (notNull(ruleset) ) {qdef.setRulesets(ruleset);}
        if(notNull(graphPerms)){ qdef.setUpdatePermissions(graphPerms);}
        qdef.setIncludeDefaultRulesets(includeInferred);
        sparqlManager.clearPageLength();
        sparqlManager.executeUpdate(qdef, tx);
    }
954139
function archive(cb) {
  db.getClient(function(err, client, done) {
    client.query(qb.select() + ' WHERE published = true', function(err, r) {
      if(err) {
        cb(err);
        done(err);
      } else {
        cb(null, r.rows);
        done();
      }
    });
  });
}
245980
def publish(self, request, **kwargs):
        
        content = self.get_object()

        if "published" in get_request_data(request):
            if not get_request_data(request)["published"]:
                content.published = None
            else:
                publish_dt = parse_datetime(get_request_data(request)["published"])
                if publish_dt:
                    publish_dt = publish_dt.astimezone(timezone.utc)
                else:
                    publish_dt = None
                content.published = publish_dt
        else:
            content.published = timezone.now()

        content.save()
        LogEntry.objects.log(request.user, content, content.get_status())
        return Response({"status": content.get_status(), "published": content.published})