http://thecodinglove.com/post/49933241299/when-i-start-using-a-3rd-party-lib-and-notice-there-is

ERXValidationFactory.templateForEntityPropertyType determines what keys are 
considered for most validation messages. In order, they are

entity.property.type
entity.property
property.type
property
type

So let's say you have an EO named Document with a mandatory title attribute. 
Leaving that blank would result in a NullPropertyException type validation 
error. So, your keys would be from most specific to least:

Document.title.NullPropertyException
Document.title
title.NullPropertyException
title
NullPropertyException

Typically, the least specific key is already defined in Wonder's 
ValidationTemplate.strings in the frameworks.

"NullPropertyException" = "Please provide @@indefiniteArticleForProperty@@ 
<b>@@displayNameForProperty@@</b>.";

You can override these with the more specific keys.

In this specific case, the validation template string is actually defined 
elsewhere. It's the result of an EOGeneralAdaptorException being converted into 
a standard validation exception in the ERXSQLHelper. You can find it in the 
PostgresqlSQLHelper.handleDatabaseException method.

On Aug 21, 2013, at 10:22 AM, Christoph Wick wrote:

> Is there a documentation about the possible keys for that? What kinds of keys 
> can I put into a ValidationTemplates.string?
> 
> Thx, C.U.CW
> -- 
> What are the three enemies of a programmer? Sunlight, oxygen, and the 
> appalling roar of the birds.
> 
> On 14.08.2013, at 04:07, Theodore Petrosky <tedp...@yahoo.com> wrote:
> 
>> wow, that's beautiful
>> 
>> 
>> 
>> On Aug 13, 2013, at 8:45 PM, Paul Hoadley <pa...@logicsquad.net> wrote:
>> 
>>> Hi Ted,
>>> 
>>> On 14/08/2013, at 10:03 AM, Theodore Petrosky <tedp...@yahoo.com> wrote:
>>> 
>>>> I added an index and unique constraint to my User. loginName column. 
>>>> 
>>>> I see in the logs that when I try to violate the uniqueness my d2w does 
>>>> the correct thing and complain however this is the error:
>>>> 
>>>> Could not save your changes: CustomMethodException
>>>> 
>>>> I do see in the logs:
>>>> 
>>>> ERROR: duplicate key value violates unique constraint "loginname_idx"
>>>> 
>>>> did I miss something in a rule to pass the better worded error message to 
>>>> the user?
>>> 
>>> Create Resources/English.lproj/ValidationTemplate.strings and add:
>>> 
>>> {
>>>     "UniqueConstraintException.loginname_idx" = "Please choose a different 
>>> username.";
>>> }
>>> 
>>> Does that work?
>>> 
>>> 
>>> -- 
>>> Paul Hoadley
>>> http://logicsquad.net/
>>> 
>>> 
>>> 
>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/wicki%40me.com
>> 
>> This email sent to wi...@me.com
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/rgurley%40smarthealth.com
> 
> This email sent to rgur...@smarthealth.com


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to