Set the context to published
165232
def published_context(cls):
        """"""
        previous_state = g.get('draft')
        try:
            g.draft = False
            yield
        finally:
            g.draft = previous_state
883894
def set_register(self, register, value):
        
        context = self.get_context()
        context[register] = value
        self.set_context(context)
1248306
private static void setPublisherInfo(Map<String, String> env, Run build, BuildInfo pipelineBuildInfo, PublisherContext context,
                                         ArtifactoryClientConfiguration configuration) {
        configuration.setActivateRecorder(Boolean.TRUE);
        String buildName;
        String buildNumber;
        if (pipelineBuildInfo != null) {
            buildName = pipelineBuildInfo.getName();
            buildNumber = pipelineBuildInfo.getNumber();
        } else {
            buildName = context.isOverrideBuildName() ? context.getCustomBuildName() : BuildUniqueIdentifierHelper.getBuildName(build);
            buildNumber = BuildUniqueIdentifierHelper.getBuildNumber(build);
        }

        configuration.info.setBuildName(buildName);
        configuration.publisher.addMatrixParam("build.name", buildName);
        configuration.info.setBuildNumber(buildNumber);
        configuration.publisher.addMatrixParam("build.number", buildNumber);
        configuration.info.setArtifactoryPluginVersion(ActionableHelper.getArtifactoryPluginVersion());

        Date buildStartDate = build.getTimestamp().getTime();
        configuration.info.setBuildStarted(buildStartDate.getTime());
        configuration.info.setBuildTimestamp(String.valueOf(build.getStartTimeInMillis()));
        configuration.publisher.addMatrixParam("build.timestamp", String.valueOf(build.getStartTimeInMillis()));

        String vcsRevision = getVcsRevision(env);
        if (StringUtils.isNotBlank(vcsRevision)) {
            configuration.info.setVcsRevision(vcsRevision);
            configuration.publisher.addMatrixParam(BuildInfoFields.VCS_REVISION, vcsRevision);
        }

        String vcsUrl = getVcsUrl(env);
        if (StringUtils.isNotBlank(vcsUrl)) {
            configuration.info.setVcsUrl(vcsUrl);
        }

        if (StringUtils.isNotBlank(context.getArtifactsPattern())) {
            configuration.publisher.setIvyArtifactPattern(Util.replaceMacro(context.getArtifactsPattern(), env));
        }
        if (StringUtils.isNotBlank(context.getIvyPattern())) {
            configuration.publisher.setIvyPattern(Util.replaceMacro(context.getIvyPattern(), env));
        }
        configuration.publisher.setM2Compatible(context.isMaven2Compatible());
        String buildUrl = ActionableHelper.getBuildUrl(build);
        if (StringUtils.isNotBlank(buildUrl)) {
            configuration.info.setBuildUrl(buildUrl);
        }

        String userName = null;
        Cause.UpstreamCause parent = ActionableHelper.getUpstreamCause(build);
        if (parent != null) {
            String parentProject = sanitizeBuildName(parent.getUpstreamProject());
            configuration.info.setParentBuildName(parentProject);
            configuration.publisher.addMatrixParam(BuildInfoFields.BUILD_PARENT_NAME, parentProject);
            String parentBuildNumber = parent.getUpstreamBuild() + "";
            configuration.info.setParentBuildNumber(parentBuildNumber);
            configuration.publisher.addMatrixParam(BuildInfoFields.BUILD_PARENT_NUMBER, parentBuildNumber);
            userName = "auto";
        }

        userName = ActionableHelper.getUserCausePrincipal(build, userName);

        configuration.info.setPrincipal(userName);
        configuration.info.setAgentName("Jenkins");
        configuration.info.setAgentVersion(Jenkins.VERSION);
        ArtifactoryServer artifactoryServer = context.getArtifactoryServer();
        if (artifactoryServer != null) {
            CredentialsConfig preferredDeployer = CredentialManager.getPreferredDeployer(context.getDeployerOverrider(), artifactoryServer);
            if (StringUtils.isNotBlank(preferredDeployer.provideUsername(build.getParent()))) {
                configuration.publisher.setUsername(preferredDeployer.provideUsername(build.getParent()));
                configuration.publisher.setPassword(preferredDeployer.providePassword(build.getParent()));
            }
            configuration.setTimeout(artifactoryServer.getTimeout());
            setRetryParams(configuration, artifactoryServer);

            configuration.publisher.setContextUrl(artifactoryServer.getUrl());
        }

        ServerDetails serverDetails = context.getServerDetails();
        if (serverDetails != null) {
            String inputRepKey = serverDetails.getDeployReleaseRepositoryKey();
            String repoKEy = Util.replaceMacro(inputRepKey, env);
            configuration.publisher.setRepoKey(repoKEy);
            String inputSnapshotRepKey = serverDetails.getDeploySnapshotRepositoryKey();
            String snapshotRepoKey = Util.replaceMacro(inputSnapshotRepKey, env);
            configuration.publisher.setSnapshotRepoKey(snapshotRepoKey);
        }

        if (context.isDiscardOldBuilds()) {
            BuildRetention buildRetention = BuildRetentionFactory.createBuildRetention(build, context.isDiscardBuildArtifacts());
            if (buildRetention.getCount() > -1) {
                configuration.info.setBuildRetentionCount(buildRetention.getCount());
            }
            if (buildRetention.getMinimumBuildDate() != null) {
                long days = daysBetween(buildRetention.getMinimumBuildDate(), new Date());
                configuration.info.setBuildRetentionMinimumDate(String.valueOf(days));
            }
            configuration.info.setDeleteBuildArtifacts(context.isDiscardBuildArtifacts());
            configuration.info.setAsyncBuildRetention(context.isAsyncBuildRetention());
            configuration.info.setBuildNumbersNotToDelete(getBuildNumbersNotToBeDeletedAsString(build));
        }
        configuration.publisher.setPublishArtifacts(context.isDeployArtifacts());
        configuration.publisher.setEvenUnstable(context.isEvenIfUnstable());
        if (context.isDeployIvy() != null) {
            configuration.publisher.setIvy(context.isDeployIvy());
        }
        if (context.isDeployMaven() != null) {
            configuration.publisher.setMaven(context.isDeployMaven());
        }
        IncludesExcludes deploymentPatterns = context.getIncludesExcludes();
        if (deploymentPatterns != null) {
            String includePatterns = deploymentPatterns.getIncludePatterns();
            if (StringUtils.isNotBlank(includePatterns)) {
                configuration.publisher.setIncludePatterns(Util.replaceMacro(includePatterns, env));
            }
            String excludePatterns = deploymentPatterns.getExcludePatterns();
            if (StringUtils.isNotBlank(excludePatterns)) {
                configuration.publisher.setExcludePatterns(Util.replaceMacro(excludePatterns, env));
            }
        }
        ReleaseAction releaseAction = ActionableHelper.getLatestAction(build, ReleaseAction.class);
        if (releaseAction != null) {
            configuration.info.setReleaseEnabled(true);
            String comment = releaseAction.getStagingComment();
            if (StringUtils.isNotBlank(comment)) {
                configuration.info.setReleaseComment(comment);
            }
        }
        configuration.publisher.setFilterExcludedArtifactsFromBuild(context.isFilterExcludedArtifactsFromBuild());
        configuration.publisher.setPublishBuildInfo(!context.isSkipBuildInfoDeploy());
        configuration.publisher.setRecordAllDependencies(context.isRecordAllDependencies());
        configuration.setIncludeEnvVars(context.isIncludeEnvVars());
        IncludesExcludes envVarsPatterns = context.getEnvVarsPatterns();
        if (envVarsPatterns != null) {
            configuration.setEnvVarsIncludePatterns(Util.replaceMacro(envVarsPatterns.getIncludePatterns(), env));
            configuration.setEnvVarsExcludePatterns(Util.replaceMacro(envVarsPatterns.getExcludePatterns(), env));
        }
        addDeploymentProperties(context, configuration.publisher, env);
    }
14080
protected void pushContext() {
    antOut = System.out;
    antErr = System.err;
    System.setOut(new PrintStream(out));
    System.setErr(out == err ? System.out : new PrintStream(err));
  }
398343
def setContext(self, value = .5):
        
        for context in list(self.contextLayers.values()):
            context.resetFlags() # hidden activations have already been copied in
            context.setActivations(value)
931263
function emitContext (env, scope, context) {
    var shared = env.shared
    var CONTEXT = shared.context

    var contextEnter = env.scope()

    Object.keys(context).forEach(function (name) {
      scope.save(CONTEXT, '.' + name)
      var defn = context[name]
      contextEnter(CONTEXT, '.', name, '=', defn.append(env, scope), ';')
    })

    scope(contextEnter)
  }
605778
function Context(resolve, reject, custom) {
    this.resolve = resolve;
    this.reject = reject;
    this.custom = custom;
  }
349685
def make_published(self, request, queryset):
        
        rows_updated = queryset.update(is_published=True)
        self.message_user(request,
                          ungettext('%(count)d newsitem was published',
                                    '%(count)d newsitems were published',
                                    rows_updated) % {'count': rows_updated})
800291
def set_context(self, definition: Definition, explanation: str) -> None:
        """"""
        self.definition = definition
        self.explanation = explanation
337224
def get_context(self, publish=False):
        
        context = self.project.DEFAULT_CONTEXT
        try:
            file = self.project.CONTEXT_SOURCE_FILE
            # CSV
            if re.search(r'(csv|CSV)$', file):
                context.update(self.get_context_from_csv())
            # Excel
            if re.search(r'(xlsx|XLSX|xls|XLS)$', file):
                context.update(self.get_context_from_xlsx())
        except AttributeError:
            context.update(self.get_context_from_gdoc())

        return context
907212
public void setContext(DisplayContext context) {
        if (context.type() == DisplayContext.Type.CAPITALIZATION) {
            capitalizationSetting = context;
        }
    }
653774
def generate_context(force_overwrite=False, drop_secret_key=False):
    

    print('... generating context')
    context_fp = '%s/context.json' % os.environ['PRODUCT_DIR']
    context = {}

    if os.path.isfile(context_fp):
        print('... augment existing context.json')

        with open(context_fp, 'r') as context_f:
            content = context_f.read().strip() or '{}'
            try:
                context = json.loads(content)
            except ValueError:
                print('ERROR: not valid json in your existing context.json!!!')
                return

        if force_overwrite:
            print('... overwriting existing context.json')
            if drop_secret_key:
                print('... generating new SECRET_KEY')
                context = {}
            else:
                print('... using existing SECRET_KEY from existing context.json')
                context = {'SECRET_KEY': context['SECRET_KEY']}

    with open(context_fp, 'w') as context_f:
        new_context = tasks.get_context_template()

        new_context.update(context)
        context_f.write(json.dumps(new_context, indent=4, sort_keys=True))
    print()
    print('*** Successfully generated context.json')
1374388
public void setContext(Context context) {
        context.put(JavacTypes.class, this);
        syms = Symtab.instance(context);
        types = Types.instance(context);
    }
856490
def make_published(self, request, queryset):
        
        cnt1 = queryset.filter(
            date_published__isnull=True,
            publish=False,
        ).update(date_published=timezone.now(), publish=True)
        cnt2 = queryset.filter(
            date_published__isnull=False,
            publish=False,
        ).update(publish=True)
        messages.add_message(
            request, messages.INFO,
            __('%(updates)d entry published.',
                '%(updates)d entries published.', cnt1+cnt2) % {
                'updates':  cnt1+cnt2, })
347540
def Publish(self, request, context):
        """"""
        LOG.debug("Publish called")
        try:
            self.plugin.publish(
                [Metric(pb=m) for m in request.Metrics],
                ConfigMap(pb=request.Config)
            )
            return ErrReply()
        except Exception as err:
            msg = "message: {}\n\nstack trace: {}".format(
                err, traceback.format_exc())
            return ErrReply(error=msg)
1244184
public void setContext(Context context) {
    super.setContext(context);
    if (null != context) {
      Object count = context.getDatas().get("countPerSheet");
      if (null != count && Numbers.isDigits(count.toString())) {
        int countParam = Numbers.toInt(count.toString());
        if (countParam > 0) this.countPerSheet = countParam;
      }
    }
  }
939905
function set_site_blog_context( $blog_id ) {
            $this->_storage = $this->get_site_storage( $blog_id );
            $this->_blog_id = $blog_id;
        }