From: Andreas Bauer
---
src/api/app/controllers/person_controller.rb | 10 +++-------
src/webui/app/controllers/package_controller.rb | 8 ++++----
src/webui/app/controllers/project_controller.rb | 17 +++++++++--------
3 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/src/api/app/controllers/person_controller.rb b/src/api/app/controllers/person_controller.rb
index 75c41f2..237da70 100644
--- a/src/api/app/controllers/person_controller.rb
+++ b/src/api/app/controllers/person_controller.rb
@@ -13,10 +13,7 @@ class PersonController < ApplicationController
@render_user = User.find_by_login( params[:login] )
if ! @render_user
logger.debug "User is not valid!"
- #FIXME: proper error returnage needed
- @errorcode = 442
- @summary = "Unknown user: #{params[:login]}"
- render :template => 'error', :status => 442
+ render_error :status => 404, :message => "Unknown user: #{params[:login]}"
end
else
logger.debug "Generating user info for logged in user #{@http_user.login}"
@@ -35,9 +32,8 @@ class PersonController < ApplicationController
# ok, may update user info
else
logger.debug "User has no permission to change userinfo"
- @errorcode = 442
- @summary = "no permission to change userinfo for user #{user.login}"
- render :template => 'error', :status => 401
+ render_error :status => 401,
+ :message => "no permission to change userinfo for user #{user.login}"
end
end
end
diff --git a/src/webui/app/controllers/package_controller.rb b/src/webui/app/controllers/package_controller.rb
index c8b10b5..36f5763 100644
--- a/src/webui/app/controllers/package_controller.rb
+++ b/src/webui/app/controllers/package_controller.rb
@@ -26,13 +26,13 @@ class PackageController < ApplicationController
@project = Project.find( params[:project] )
- if params[:package]
- @package = Package.new( :name => params[:package], :project => @project )
+ if params[:name]
+ @package = Package.new( :name => params[:name], :project => @project )
@package.title.data.text = params[:title]
@package.description.data.text = params[:description]
if params[:createSpecFileTemplate]
- @package.add_file :filename => params[:package] + ".spec"
+ @package.add_file :filename => params[:name] + ".spec"
end
@project.add_package @package
@@ -45,7 +45,7 @@ class PackageController < ApplicationController
end
flash[:note] = "Package '#{@package}' was created successfully"
- redirect_to :action => 'show', :project => params[:project], :package => params[:package]
+ redirect_to :action => 'show', :project => params[:project], :package => params[:name]
else
flash[:note] = "Failed to save package '#{@package}'"
redirect_to :controller => 'project', :action => 'show', :project => params[:project]
diff --git a/src/webui/app/controllers/project_controller.rb b/src/webui/app/controllers/project_controller.rb
index dcbf356..b9ab7a5 100644
--- a/src/webui/app/controllers/project_controller.rb
+++ b/src/webui/app/controllers/project_controller.rb
@@ -49,9 +49,9 @@ class ProjectController < ApplicationController
end
def new
- if params[:project]
+ if params[:name]
#store project
- @project = Project.new( :name => params[:project] )
+ @project = Project.new( :name => params[:name] )
@project.title.data.text = params[:title]
@project.description.data.text = params[:description]
@@ -63,7 +63,7 @@ class ProjectController < ApplicationController
flash[:note] = "Failed to save project '#{@project}'"
end
- redirect_to :action => 'show', :project => params[:project]
+ redirect_to :action => 'show', :project => params[:name]
else
#show template
end
@@ -161,15 +161,16 @@ class ProjectController < ApplicationController
return
end
- user = Person.find( :login => params[:userid] )
- logger.debug "found user: #{user.inspect}"
-
- if not user
+ begin
+ user = Person.find( :login => params[:userid] )
+ rescue ActiveXML::NotFoundError
flash[:error] = "Unknown user with id '#{params[:userid]}'"
redirect_to :action => :add_person, :project => params[:project], :role => params[:role]
return
end
-
+
+ logger.debug "found user: #{user.inspect}"
+
@project = Project.find( session[:project] )
@project.add_person( :userid => params[:userid], :role => params[:role] )
--
1.7.7
--
To unsubscribe, e-mail: obs-commits+unsubscribe@opensuse.org
To contact the owner, e-mail: obs-commits+owner@opensuse.org