Weird D2W rule selection
Weird D2W rule selection
- Subject: Weird D2W rule selection
- From: Markus Ruggiero <email@hidden>
- Date: Wed, 22 Aug 2018 15:11:57 +0200
I just had a debugging session with a customer. He complained that
"CreateProduct" page conf did not list the correct displayPropertyKeys. And
indeed they are wrong. But why?
Rule I want to work (list of properties truncated to anonymize the customer):
100 : (pageConfiguration = 'CreateProduct' and region = 'europe') =>
displayPropertyKeys = ("productCode", .... )
[com.webobjects.directtoweb.Assignment] (list of properties I want)
Rule that actually fires
100 : pageConfiguration = 'CreateProduct' => displayPropertyKeys =
("productCode", ....) [com.webobjects.directtoweb.Assignment] (fallback rule
with different list of properties
That can be when region is not properly defined, BUT it is.
Opening D2W debug output in the resulting browser shows at the very top when
hovering over the "?" the list from the second, less qualified rule
When entering "displayPropertyKeys into the little debug textfield I do get the
expected list of properties (the one for 'europe').
When manually asking for the displayPropertyKeys the first rule fires (which is
what I expect) but the D2W template resolves via the second rule. Even reducing
the priority of that rule to e.g. 80 does not give prio to the more qualified
first rule. D2WTraceRuleFiringEnabled shows what is displayed in the app.
Other pageConfigurations like EditProduct have similar rules but there the rule
with "region" is firing - as it should.
I inject the region code into d2wContext in the PageWrapper.awake() with the
fillowing code lines:
public void awake() {
super.awake();
D2WContext ctx = d2wContext();
if (ctx != null) {
Application application = (Application)Application.application();
ctx.takeValueForKey( application.region().code(), "region" );
}
}
public D2WContext d2wContext() {
if (context().page() instanceof D2WPage) {
D2WPage d2wPage = (D2WPage) context().page();
return d2wPage.d2wContext();
}
return null;
}
Any idea why this happens? Could this be a timing issue?
---markus---
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden