On 11/24/2011 04:35 PM, jprovazn(a)redhat.com wrote:
From: Jan Provaznik<jprovazn(a)redhat.com>
This rescue block was catching REXML parse error, but template xml wasn't parsed.
This fixes error with " uninitialized constant REXML::ParseException"
---
src/app/controllers/images_controller.rb | 31 ++++++++++++-----------------
src/config/locales/en.yml | 2 -
2 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/src/app/controllers/images_controller.rb
b/src/app/controllers/images_controller.rb
index 222ab60..be95d42 100644
--- a/src/app/controllers/images_controller.rb
+++ b/src/app/controllers/images_controller.rb
@@ -105,24 +105,19 @@ class ImagesController< ApplicationController
render :edit_xml and return
end
- begin
- uuid = UUIDTools::UUID.timestamp_create.to_s
- @template = Aeolus::Image::Warehouse::Template.create!(uuid, @xml, {
- :object_type => 'template',
- :uuid => uuid
- })
- uuid = UUIDTools::UUID.timestamp_create.to_s
- body =
"<image><name>#{(a)template.name}</name></image>"
- @image = Aeolus::Image::Warehouse::Image.create!(uuid, body, {
- :uuid => uuid,
- :object_type => 'image',
- :template => @template.uuid
- })
- flash.now[:error] = t('images.flash.notice.created')
- rescue REXML::ParseException
- flash.now[:error] = t('images.flash.warning.invalid_xml')
- render :edit_xml and return
- end
+ uuid = UUIDTools::UUID.timestamp_create.to_s
+ @template = Aeolus::Image::Warehouse::Template.create!(uuid, @xml, {
+ :object_type => 'template',
+ :uuid => uuid
+ })
+ uuid = UUIDTools::UUID.timestamp_create.to_s
+ body =
"<image><name>#{(a)template.name}</name></image>"
+ @image = Aeolus::Image::Warehouse::Image.create!(uuid, body, {
+ :uuid => uuid,
+ :object_type => 'image',
+ :template => @template.uuid
+ })
+ flash.now[:error] = t('images.flash.notice.created')
redirect_to image_path((a)image.id)
end
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index f69c3b1..5b142fd 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -650,8 +650,6 @@ en:
warning:
delete_failed: Unable to Delete Image
not_found: Image not found
- invalid_xml:
- The provided XML is not valid. Please fix it before continuing.
error:
invalid_url: Could not load the provided URL
new:
self ACK & pushed