[PATCH conductor] BZ808393: Fix invalid name error message

Tomáš Hrčka thrcka at redhat.com
Tue Jun 12 13:23:00 UTC 2012


On 05/29/2012 03:52 PM, ifarkas at redhat.com wrote:
> From: Imre Farkas <ifarkas at redhat.com>
>
> https://bugzilla.redhat.com/show_bug.cgi?id=808393
> ---
>   src/app/models/pool.rb                 |    2 +-
>   src/app/models/pool_family.rb          |    2 +-
>   src/app/models/provider.rb             |    2 +-
>   src/config/locales/activerecord/en.yml |   14 ++++++++++++++
>   src/config/locales/activerecord/fr.yml |   14 ++++++++++++++
>   src/config/locales/activerecord/ja.yml |   14 ++++++++++++++
>   src/config/locales/en.yml              |    1 -
>   src/config/locales/fr.yml              |    1 -
>   src/config/locales/ja.yml              |    1 -
>   9 files changed, 45 insertions(+), 6 deletions(-)
>
> diff --git a/src/app/models/pool.rb b/src/app/models/pool.rb
> index 7b6cf89..177de06 100644
> --- a/src/app/models/pool.rb
> +++ b/src/app/models/pool.rb
> @@ -55,7 +55,7 @@ class Pool < ActiveRecord::Base
>     validates_uniqueness_of :exported_as, :if => :exported_as
>     validates_length_of :name, :maximum => 255
>   
> -  validates_format_of :name, :with => /^[\w -]*$/n, :message => I18n.t('pools.valid_format_of_name')
> +  validates_format_of :name, :with => /^[\w -]*$/n
>   
>     has_many :permissions, :as => :permission_object, :dependent => :destroy,
>              :include => [:role],
> diff --git a/src/app/models/pool_family.rb b/src/app/models/pool_family.rb
> index 8f5ea24..a12068f 100644
> --- a/src/app/models/pool_family.rb
> +++ b/src/app/models/pool_family.rb
> @@ -45,7 +45,7 @@ class PoolFamily < ActiveRecord::Base
>     has_many :permissions, :as => :permission_object, :dependent => :destroy
>   
>     validates_length_of :name, :maximum => 255
> -  validates_format_of :name, :with => /^[\w -]*$/n, :message => "must only contain: numbers, letters, spaces, '_' and '-'"
> +  validates_format_of :name, :with => /^[\w -]*$/n
>   
>     validates_presence_of :name
>     validates_uniqueness_of :name
> diff --git a/src/app/models/provider.rb b/src/app/models/provider.rb
> index 2033a04..bb4b8a6 100644
> --- a/src/app/models/provider.rb
> +++ b/src/app/models/provider.rb
> @@ -49,7 +49,7 @@ class Provider < ActiveRecord::Base
>     validates_presence_of :provider_type_id
>     validates_presence_of :url
>   
> -  validates_format_of :name, :with => /^[\w -]*$/n, :message => "must only contain: numbers, letters, spaces, '_' and '-'"
> +  validates_format_of :name, :with => /^[\w -]*$/n
>     validates_length_of :name,  :maximum => 255
>     validate :validate_provider
>   
> diff --git a/src/config/locales/activerecord/en.yml b/src/config/locales/activerecord/en.yml
> index 3ac086f..6da4618 100644
> --- a/src/config/locales/activerecord/en.yml
> +++ b/src/config/locales/activerecord/en.yml
> @@ -343,3 +343,17 @@ en:
>           state: "State"
>           created_at: "Created At"
>           updated_at: "Updated At"
> +    errors:
> +      models:
> +        pool:
> +          attributes:
> +            name:
> +              invalid: "must only contain: numbers, letters, spaces, '_' and '-'"
> +        pool_family:
> +          attributes:
> +            name:
> +              invalid: "must only contain: numbers, letters, spaces, '_' and '-'"
> +        provider:
> +          attributes:
> +            name:
> +              invalid: "must only contain: numbers, letters, spaces, '_' and '-'"
> diff --git a/src/config/locales/activerecord/fr.yml b/src/config/locales/activerecord/fr.yml
> index ad6905d..86b4459 100644
> --- a/src/config/locales/activerecord/fr.yml
> +++ b/src/config/locales/activerecord/fr.yml
> @@ -343,3 +343,17 @@ fr:
>         task: Tâche
>         user: Utilisateur
>         view_state: "Afficher l'état"
> +    errors:
> +      models:
> +        pool:
> +          attributes:
> +            name:
> +              invalid: "doit uniquement contenir : nombres, lettres, espaces, '_' et '-'"
> +        pool_family:
> +          attributes:
> +            name:
> +              invalid: "doit uniquement contenir : nombres, lettres, espaces, '_' et '-'"
> +        provider:
> +          attributes:
> +            name:
> +              invalid: "doit uniquement contenir : nombres, lettres, espaces, '_' et '-'"
> diff --git a/src/config/locales/activerecord/ja.yml b/src/config/locales/activerecord/ja.yml
> index 13878c3..9cfef92 100644
> --- a/src/config/locales/activerecord/ja.yml
> +++ b/src/config/locales/activerecord/ja.yml
> @@ -343,3 +343,17 @@ ja:
>         task: タスク
>         user: ユーザー
>         view_state: 表示状態
> +    errors:
> +      models:
> +        pool:
> +          attributes:
> +            name:
> +              invalid: 数字、文字、空白、「_」、「-」以外は含ませないようにしてください。
> +        pool_family:
> +          attributes:
> +            name:
> +              invalid: 数字、文字、空白、「_」、「-」以外は含ませないようにしてください。
> +        provider:
> +          attributes:
> +            name:
> +              invalid: 数字、文字、空白、「_」、「-」以外は含ませないようにしてください。
> diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
> index d7a2b75..861f30d 100644
> --- a/src/config/locales/en.yml
> +++ b/src/config/locales/en.yml
> @@ -461,7 +461,6 @@ en:
>           iwhd_unavailable: Catalog Images are unavailable. It appears the image warehouse is not reachable
>         warning:
>           creation_failed: Pool creation failed.
> -    valid_format_of_name: "must only contain: numbers, letters, spaces, '_' and '-'"
>       list:
>         more_actions: More actions
>       form:
> diff --git a/src/config/locales/fr.yml b/src/config/locales/fr.yml
> index 3f787c5..1dafc83 100644
> --- a/src/config/locales/fr.yml
> +++ b/src/config/locales/fr.yml
> @@ -870,7 +870,6 @@ fr:
>         with_stopped_instances: "Avec des instances arrêtées"
>       properties:
>         properties: "Propriétés de %{pool}"
> -    valid_format_of_name: "doit uniquement contenir : nombres, lettres, espaces, '_' et '-'"
>     privileges: Privilèges
>     properties: Propriétés
>     provider_accounts:
> diff --git a/src/config/locales/ja.yml b/src/config/locales/ja.yml
> index d834b4e..efd088c 100644
> --- a/src/config/locales/ja.yml
> +++ b/src/config/locales/ja.yml
> @@ -870,7 +870,6 @@ ja:
>         with_stopped_instances: 停止インスタンスあり
>       properties:
>         properties: "%{pool} のプロパティ"
> -    valid_format_of_name: 数字、文字、空白、「_」、「-」以外は含ませないようにしてください。
>     privileges: 特権
>     properties: プロパティ
>     provider_accounts:
ACK.




More information about the aeolus-devel mailing list