Skip to content

Commit

Permalink
Only load Themes object for online processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ultraq committed Jun 16, 2013
1 parent 025d471 commit 7060d92
Showing 1 changed file with 7 additions and 4 deletions.
Expand Up @@ -36,6 +36,7 @@
import org.thymeleaf.context.IContext;
import org.thymeleaf.context.IContextVariableRestriction;
import org.thymeleaf.context.IProcessingContext;
import org.thymeleaf.context.IWebContext;
import org.thymeleaf.context.VariablesMap;
import org.thymeleaf.exceptions.TemplateProcessingException;
import org.thymeleaf.expression.ExpressionEvaluatorObjects;
Expand Down Expand Up @@ -160,11 +161,13 @@ public Map<String,Object> computeExpressionObjects(
final Fields fields = new Fields(configuration, processingContext);
expressionObjects.put(FIELDS_EVALUATION_VARIABLE_NAME, fields);

final VariablesMap<String,Object> variables = processingContext.getContext().getVariables();
if (!variables.containsKey(THEMES_EVALUATION_VARIABLE_NAME)) {
variables.put(THEMES_EVALUATION_VARIABLE_NAME, new Themes(processingContext));
if (processingContext.getContext() instanceof IWebContext) {
final VariablesMap<String,Object> variables = processingContext.getContext().getVariables();
if (!variables.containsKey(THEMES_EVALUATION_VARIABLE_NAME)) {
variables.put(THEMES_EVALUATION_VARIABLE_NAME, new Themes(processingContext));
}
expressionObjects.put(THEMES_EVALUATION_VARIABLE_NAME, variables.get(THEMES_EVALUATION_VARIABLE_NAME));
}
expressionObjects.put(THEMES_EVALUATION_VARIABLE_NAME, variables.get(THEMES_EVALUATION_VARIABLE_NAME));

final Map<String,Object> additionalExpressionObjects = computeAdditionalExpressionObjects(processingContext);
if (additionalExpressionObjects != null && !additionalExpressionObjects.isEmpty()) {
Expand Down

1 comment on commit 7060d92

@danielfernandez
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #26

Please sign in to comment.